geometry update fix

This commit is contained in:
Max-Wilhelm Bruker 2011-03-09 15:32:56 +01:00
parent 2711c0e9d0
commit ac46edd790
2 changed files with 13 additions and 12 deletions

View file

@ -23,7 +23,7 @@
#include <QDebug> #include <QDebug>
Player::Player(ServerInfo_User *info, int _id, bool _local, TabGame *_parent) Player::Player(ServerInfo_User *info, int _id, bool _local, TabGame *_parent)
: QObject(_parent), shortcutsActive(false), defaultNumberTopCards(3), lastTokenDestroy(true), userInfo(new ServerInfo_User(info)), id(_id), active(false), local(_local), mirrored(false), conceded(false), dialogSemaphore(false) : QObject(_parent), shortcutsActive(false), defaultNumberTopCards(3), lastTokenDestroy(true), userInfo(new ServerInfo_User(info)), id(_id), active(false), local(_local), mirrored(false), handVisible(false), conceded(false), dialogSemaphore(false)
{ {
setCacheMode(DeviceCoordinateCache); setCacheMode(DeviceCoordinateCache);
@ -328,15 +328,14 @@ void Player::playerListActionTriggered()
void Player::rearrangeZones() void Player::rearrangeZones()
{ {
QPointF base = QPointF(CARD_HEIGHT + counterAreaWidth + 15, 0); QPointF base = QPointF(CARD_HEIGHT + counterAreaWidth + 15, 0);
if (settingsCache->getHorizontalHand()) { if (settingsCache->getHorizontalHand()) {
if (mirrored) { if (mirrored) {
if (hand->contentsKnown()) { if (hand->contentsKnown()) {
hand->setVisible(true); handVisible = true;
hand->setPos(base); hand->setPos(base);
base += QPointF(0, hand->boundingRect().height()); base += QPointF(0, hand->boundingRect().height());
} else } else
hand->setVisible(false); handVisible = false;
stack->setPos(base); stack->setPos(base);
base += QPointF(stack->boundingRect().width(), 0); base += QPointF(stack->boundingRect().width(), 0);
@ -349,14 +348,14 @@ void Player::rearrangeZones()
base += QPointF(0, table->boundingRect().height()); base += QPointF(0, table->boundingRect().height());
if (hand->contentsKnown()) { if (hand->contentsKnown()) {
hand->setVisible(true); handVisible = true;
hand->setPos(base); hand->setPos(base);
} else } else
hand->setVisible(false); handVisible = false;
} }
hand->setWidth(table->getWidth() + stack->boundingRect().width()); hand->setWidth(table->getWidth() + stack->boundingRect().width());
} else { } else {
hand->setVisible(true); handVisible = true;
hand->setPos(base); hand->setPos(base);
base += QPointF(hand->boundingRect().width(), 0); base += QPointF(hand->boundingRect().width(), 0);
@ -366,6 +365,7 @@ void Player::rearrangeZones()
table->setPos(base); table->setPos(base);
} }
hand->setVisible(handVisible);
hand->updateOrientation(); hand->updateOrientation();
table->reorganizeCards(); table->reorganizeCards();
updateBoundingRect(); updateBoundingRect();
@ -392,7 +392,7 @@ void Player::updateBoundingRect()
prepareGeometryChange(); prepareGeometryChange();
qreal width = CARD_HEIGHT + 15 + counterAreaWidth + stack->boundingRect().width(); qreal width = CARD_HEIGHT + 15 + counterAreaWidth + stack->boundingRect().width();
if (settingsCache->getHorizontalHand()) { if (settingsCache->getHorizontalHand()) {
qreal handHeight = hand->isVisible() ? hand->boundingRect().height() : 0; qreal handHeight = handVisible ? hand->boundingRect().height() : 0;
bRect = QRectF(0, 0, width + table->boundingRect().width(), table->boundingRect().height() + handHeight); bRect = QRectF(0, 0, width + table->boundingRect().width(), table->boundingRect().height() + handHeight);
} else } else
bRect = QRectF(0, 0, width + hand->boundingRect().width() + table->boundingRect().width(), table->boundingRect().height()); bRect = QRectF(0, 0, width + hand->boundingRect().width() + table->boundingRect().width(), table->boundingRect().height());

View file

@ -135,6 +135,7 @@ private:
bool active; bool active;
bool local; bool local;
bool mirrored; bool mirrored;
bool handVisible;
bool conceded; bool conceded;
bool dialogSemaphore; bool dialogSemaphore;