zone background textures

This commit is contained in:
Max-Wilhelm Bruker 2009-09-01 17:22:47 +02:00
parent af605ab1f8
commit 7c06d6d84f
8 changed files with 124 additions and 3 deletions

View file

@ -6,6 +6,11 @@
HandZone::HandZone(Player *_p, QGraphicsItem *parent)
: CardZone(_p, "hand", false, false, _p->getLocal(), parent)
{
QSettings settings;
QString bgPath = settings.value("zonebg/hand").toString();
if (!bgPath.isEmpty())
bgPixmap.load(bgPath);
setCacheMode(DeviceCoordinateCache);
setAcceptsHoverEvents(true); // Awkwardly, this is needed to repaint the cached item after it has been corrupted by buggy rubberband drag.
}
@ -17,7 +22,10 @@ QRectF HandZone::boundingRect() const
void HandZone::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/, QWidget */*widget*/)
{
painter->fillRect(boundingRect(), Qt::darkGreen);
if (bgPixmap.isNull())
painter->fillRect(boundingRect(), Qt::darkGreen);
else
painter->fillRect(boundingRect(), QBrush(bgPixmap));
}
void HandZone::reorganizeCards()