cosmetic improvements

This commit is contained in:
Max-Wilhelm Bruker 2009-05-24 16:07:55 +02:00
parent 1e702642a4
commit 748d9bb603
4 changed files with 19 additions and 18 deletions

View file

@ -14,27 +14,28 @@ QRectF HandZone::boundingRect() const
return QRectF(0, 0, 100, 510);
}
void HandZone::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
void HandZone::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/, QWidget */*widget*/)
{
Q_UNUSED(option);
Q_UNUSED(widget);
painter->fillRect(boundingRect(), QColor("green"));
painter->fillRect(boundingRect(), Qt::darkGreen);
}
void HandZone::reorganizeCards()
{
if (cards->isEmpty())
return;
int cardCount = cards->size();
qreal totalWidth = boundingRect().width();
qreal totalHeight = boundingRect().height();
qreal cardWidth = cards->at(0)->boundingRect().width();
qreal cardHeight = cards->at(0)->boundingRect().height();
qreal x = (totalWidth - cardWidth) / 2;
qreal xspace = 5;
qreal x1 = xspace;
qreal x2 = totalWidth - xspace - cardWidth;
for (int i = 0; i < cardCount; i++) {
CardItem *c = cards->at(i);
qreal x = i % 2 ? x2 : x1;
// If the total height of the cards is smaller than the available height,
// the cards do not need to overlap and are displayed in the center of the area.
if (cardHeight * cardCount > totalHeight)
@ -50,7 +51,7 @@ void HandZone::addCardImpl(CardItem *card, int x, int /*y*/)
if (x == -1)
x = cards->size();
cards->insert(x, card);
if (!cards->getContentsKnown()) {
card->setId(-1);
card->setName();