mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -07:00
nice ellipses :)
This commit is contained in:
parent
7e13352a95
commit
175512a2ad
13 changed files with 144 additions and 101 deletions
|
|
@ -9,6 +9,7 @@ RfgZone::RfgZone(Player *_p, QGraphicsItem *parent)
|
|||
: CardZone(_p, "rfg", false, false, parent)
|
||||
{
|
||||
cards = new CardList(true);
|
||||
setCacheMode(DeviceCoordinateCache); // Do not move this line to the parent constructor!
|
||||
}
|
||||
|
||||
QRectF RfgZone::boundingRect() const
|
||||
|
|
@ -18,17 +19,13 @@ QRectF RfgZone::boundingRect() const
|
|||
|
||||
void RfgZone::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
if (!cards->isEmpty())
|
||||
cards->at(0)->paint(painter, option, widget);
|
||||
|
||||
painter->save();
|
||||
|
||||
painter->fillRect(boundingRect(), QColor("yellow"));
|
||||
|
||||
painter->setFont(QFont("Times", 32, QFont::Bold));
|
||||
painter->setPen(QPen(QColor("black")));
|
||||
painter->setBackground(QBrush(QColor(255, 255, 255, 100)));
|
||||
painter->setBackgroundMode(Qt::OpaqueMode);
|
||||
painter->drawText(boundingRect(), Qt::AlignCenter, QString::number(cards->size()));
|
||||
|
||||
paintCardNumberEllipse(painter);
|
||||
painter->drawRect(QRectF(0.5, 0.5, CARD_WIDTH - 1, CARD_HEIGHT - 1));
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
|
@ -72,7 +69,7 @@ void RfgZone::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||
|
||||
if (cards->empty())
|
||||
return;
|
||||
|
||||
|
||||
bool faceDown = event->modifiers().testFlag(Qt::ShiftModifier);
|
||||
CardItem *card = cards->at(0);
|
||||
CardDragItem *drag = card->createDragItem(this, card->getId(), event->pos(), event->scenePos(), faceDown);
|
||||
|
|
@ -80,8 +77,7 @@ void RfgZone::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||
setCursor(Qt::OpenHandCursor);
|
||||
}
|
||||
|
||||
void RfgZone::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
void RfgZone::mouseReleaseEvent(QGraphicsSceneMouseEvent */*event*/)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue