Take hand visibility into account when calculating bounding boxes.

Took 34 minutes

Took 7 minutes

Took 8 seconds
This commit is contained in:
Lukas Brübach 2025-09-11 21:59:04 +02:00
parent 1cce0df0fa
commit 631903d605
4 changed files with 35 additions and 8 deletions

View file

@ -30,10 +30,12 @@
#include <QtConcurrent> #include <QtConcurrent>
Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, AbstractGame *_parent) Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, AbstractGame *_parent)
: QObject(_parent), game(_parent), playerInfo(new PlayerInfo(info, _id, _local, _judge)), : QObject(_parent), game(_parent), playerEventHandler(new PlayerEventHandler(this)),
playerEventHandler(new PlayerEventHandler(this)), playerActions(new PlayerActions(this)), active(false), playerActions(new PlayerActions(this)), active(false), conceded(false), handVisible(_local), deck(nullptr),
conceded(false), handVisible(false), deck(nullptr), zoneId(0), dialogSemaphore(false) zoneId(0), dialogSemaphore(false)
{ {
playerInfo = new PlayerInfo(info, _id, _local, _judge);
initializeZones(); initializeZones();
playerMenu = new PlayerMenu(this); playerMenu = new PlayerMenu(this);

View file

@ -54,10 +54,19 @@ void HandZone::handleDropEvent(const QList<CardDragItem *> &dragItems,
QRectF HandZone::boundingRect() const QRectF HandZone::boundingRect() const
{ {
if (SettingsCache::instance().getHorizontalHand()) if (SettingsCache::instance().getHorizontalHand()) {
return QRectF(0, 0, width, CARD_HEIGHT + 10); if (getLogic()->getPlayer()->getHandVisible()) {
else return QRectF(0, 0, width, CARD_HEIGHT + 10);
return QRectF(0, 0, 100, zoneHeight); } else {
return QRectF(0, 0, width, 0);
}
} else {
if (getLogic()->getPlayer()->getHandVisible()) {
return QRectF(0, 0, 100, zoneHeight);
} else {
return QRectF(0, 0, 0, zoneHeight);
}
}
} }
void HandZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) void HandZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)

View file

@ -30,7 +30,13 @@ TableZone::TableZone(TableZoneLogic *_logic, QGraphicsItem *parent) : SelectZone
updateBg(); updateBg();
height = MARGIN_TOP + MARGIN_BOTTOM + TABLEROWS * CARD_HEIGHT + (TABLEROWS - 1) * PADDING_Y; connect(getLogic()->getPlayer(), &Player::handVisibleChanged, this, &TableZone::updateHeight);
if (getLogic()->getPlayer()->getHandVisible()) {
height = MARGIN_TOP + MARGIN_BOTTOM + TABLEROWS * CARD_HEIGHT + (TABLEROWS - 1) * PADDING_Y;
} else {
height = MARGIN_TOP + MARGIN_BOTTOM + TABLEROWS * CARD_HEIGHT * PADDING_Y;
}
width = MIN_WIDTH; width = MIN_WIDTH;
currentMinimumWidth = width; currentMinimumWidth = width;
@ -43,6 +49,15 @@ void TableZone::updateBg()
update(); update();
} }
void TableZone::updateHeight()
{
if (getLogic()->getPlayer()->getHandVisible()) {
height = MARGIN_TOP + MARGIN_BOTTOM + TABLEROWS * CARD_HEIGHT + (TABLEROWS - 1) * PADDING_Y;
} else {
height = MARGIN_TOP + MARGIN_BOTTOM + TABLEROWS * CARD_HEIGHT * PADDING_Y;
}
}
QRectF TableZone::boundingRect() const QRectF TableZone::boundingRect() const
{ {
return QRectF(0, 0, width, height); return QRectF(0, 0, width, height);

View file

@ -85,6 +85,7 @@ private slots:
Loads in any found custom background and updates Loads in any found custom background and updates
*/ */
void updateBg(); void updateBg();
void updateHeight();
public slots: public slots:
/** /**