nice ellipses :)

This commit is contained in:
Max-Wilhelm Bruker 2009-05-23 01:58:11 +02:00
parent 7e13352a95
commit 175512a2ad
13 changed files with 144 additions and 101 deletions

View file

@ -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);
}