From 1d8651bc0050ae9741be5316c7887e5b1fd435b9 Mon Sep 17 00:00:00 2001 From: Zach H Date: Fri, 29 Nov 2024 09:53:19 -0800 Subject: [PATCH] Fix Deck Popup Glitchy Rendering (#5204) - 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 20634f03a..7190bd043 100644 --- a/cockatrice/src/game/zones/view_zone_widget.cpp +++ b/cockatrice/src/game/zones/view_zone_widget.cpp @@ -140,6 +140,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::processGroupBy(int index)