From d65b2333661fd800ec7af7dea4e79b34f1b1408f Mon Sep 17 00:00:00 2001 From: ZeldaZach Date: Thu, 28 Nov 2024 16:20:48 -0500 Subject: [PATCH] Fix Deck Popup Glitchy Rendering - QLabel sizes weren't taken into account until the widget is rendered - Long QLabels can cause exacerbated issues - Force refresh after 1ms to take QLabels into account --- cockatrice/src/game/zones/view_zone_widget.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cockatrice/src/game/zones/view_zone_widget.cpp b/cockatrice/src/game/zones/view_zone_widget.cpp index b6275c813..b602ab96e 100644 --- a/cockatrice/src/game/zones/view_zone_widget.cpp +++ b/cockatrice/src/game/zones/view_zone_widget.cpp @@ -120,6 +120,15 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, connect(zone, SIGNAL(optimumRectChanged()), this, SLOT(resizeToZoneContents())); connect(zone, SIGNAL(beingDeleted()), this, SLOT(zoneDeleted())); zone->initializeCards(cardList); + + auto *lastResizeBeforeVisibleTimer = new QTimer(this); + connect(lastResizeBeforeVisibleTimer, &QTimer::timeout, this, [=] { + resizeToZoneContents(); + disconnect(lastResizeBeforeVisibleTimer); + lastResizeBeforeVisibleTimer->deleteLater(); + }); + lastResizeBeforeVisibleTimer->setSingleShot(true); + lastResizeBeforeVisibleTimer->start(1); } void ZoneViewWidget::processSortByType(QT_STATE_CHANGED_T value)