From e09060faca87e0196dcf874061cb9de16b3fb7f7 Mon Sep 17 00:00:00 2001 From: Max-Wilhelm Bruker Date: Thu, 9 Sep 2010 09:54:35 +0200 Subject: [PATCH] Fixed automatic table resize. This fixes bug #0000023. --- cockatrice/src/gamescene.cpp | 3 +++ cockatrice/src/gamescene.h | 1 + cockatrice/src/tablezone.cpp | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/gamescene.cpp b/cockatrice/src/gamescene.cpp index a1d3033e..972dfcf4 100644 --- a/cockatrice/src/gamescene.cpp +++ b/cockatrice/src/gamescene.cpp @@ -66,6 +66,7 @@ void GameScene::rearrange() playersRect = QRectF(0, 0, sceneWidth, sceneHeight); setSceneRect(sceneRect().x(), sceneRect().y(), sceneWidth, sceneHeight); + processViewSizeChange(viewSize); qDebug(QString("rearrange(): w=%1 h=%2").arg(sceneWidth).arg(sceneHeight).toLatin1()); } @@ -108,6 +109,8 @@ void GameScene::closeMostRecentZoneView() void GameScene::processViewSizeChange(const QSize &newSize) { + viewSize = newSize; + qreal newRatio = ((qreal) newSize.width()) / newSize.height(); qreal minWidth = 0; for (int i = 0; i < players.size(); ++i) { diff --git a/cockatrice/src/gamescene.h b/cockatrice/src/gamescene.h index 68697a19..f56250b4 100644 --- a/cockatrice/src/gamescene.h +++ b/cockatrice/src/gamescene.h @@ -15,6 +15,7 @@ private: QList players; QRectF playersRect; QList views; + QSize viewSize; public: GameScene(QObject *parent = 0); void retranslateUi(); diff --git a/cockatrice/src/tablezone.cpp b/cockatrice/src/tablezone.cpp index 6060386b..4837d2f8 100644 --- a/cockatrice/src/tablezone.cpp +++ b/cockatrice/src/tablezone.cpp @@ -186,7 +186,7 @@ void TableZone::resizeToContents() if (xMax < minWidth) xMax = minWidth; currentMinimumWidth = xMax + 2 * marginX + 2 * boxLineWidth; - if (currentMinimumWidth > width) { + if (currentMinimumWidth != width) { prepareGeometryChange(); width = currentMinimumWidth; emit sizeChanged();