Different backgrounds per player (#3990)

This commit is contained in:
fdipilla 2020-05-14 21:31:12 -03:00 committed by GitHub
parent 04274d2497
commit fd0620445c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View file

@ -55,7 +55,14 @@ bool TableZone::isInverted() const
void TableZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
{
painter->fillRect(boundingRect(), themeManager->getTableBgBrush());
QBrush brush = themeManager->getTableBgBrush();
// If the player is other than Player 1
if (player->getId() > 0) {
// The player's id starts with 0 so in order to get the correct image we need to add 1
brush = themeManager->getExtraTableBgBrush(QString::number(player->getId() + 1));
}
painter->fillRect(boundingRect(), brush);
if (active) {
paintZoneOutline(painter);

View file

@ -107,3 +107,8 @@ void ThemeManager::themeChangedSlot()
emit themeChanged();
}
QBrush ThemeManager::getExtraTableBgBrush(QString extraNumber)
{
return loadBrush(TABLEZONE_BG_NAME + extraNumber, QColor(70, 50, 100));
}

View file

@ -44,6 +44,7 @@ public:
return playerBgBrush;
}
QStringMap &getAvailableThemes();
QBrush getExtraTableBgBrush(QString extraNumber);
protected slots:
void themeChangedSlot();
signals: