mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 03:28:49 -07:00
make more use of SettingsCache
This commit is contained in:
parent
2c9a8c2b57
commit
e9a0203880
10 changed files with 106 additions and 48 deletions
|
|
@ -3,17 +3,23 @@
|
|||
#include "player.h"
|
||||
#include "client.h"
|
||||
#include "protocol_items.h"
|
||||
#include "settingscache.h"
|
||||
|
||||
HandZone::HandZone(Player *_p, int _zoneHeight, QGraphicsItem *parent)
|
||||
: CardZone(_p, "hand", false, false, _p->getLocal(), parent), zoneHeight(_zoneHeight)
|
||||
{
|
||||
QSettings settings;
|
||||
QString bgPath = settings.value("zonebg/hand").toString();
|
||||
if (!bgPath.isEmpty())
|
||||
bgPixmap.load(bgPath);
|
||||
connect(settingsCache, SIGNAL(handBgPathChanged()), this, SLOT(updateBgPixmap()));
|
||||
updateBgPixmap();
|
||||
|
||||
setCacheMode(DeviceCoordinateCache);
|
||||
setAcceptsHoverEvents(true); // Awkwardly, this is needed to repaint the cached item after it has been corrupted by buggy rubberband drag.
|
||||
}
|
||||
|
||||
void HandZone::updateBgPixmap()
|
||||
{
|
||||
QString bgPath = settingsCache->getHandBgPath();
|
||||
if (!bgPath.isEmpty())
|
||||
bgPixmap.load(bgPath);
|
||||
update();
|
||||
}
|
||||
|
||||
QRectF HandZone::boundingRect() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue