Optimize setMinimumHeight to skip geometry updates when effective height unchanged

This commit is contained in:
DawnFire42 2026-07-15 13:50:55 -04:00
parent d42b7c8003
commit 7a092677c7
No known key found for this signature in database
GPG key ID: 24BB855EE2911B33

View file

@ -51,21 +51,22 @@ void CommandZone::setMinimumHeight(int height)
if (minimumHeight == height) { if (minimumHeight == height) {
return; return;
} }
// Only meaningful while minimized, where currentHeight() depends on minimumHeight. // The floor only affects height while minimized; skip relayout if the displayed
// height is unchanged (e.g. a tax counter toggled while expanded).
const qreal oldEffectiveHeight = currentHeight(); const qreal oldEffectiveHeight = currentHeight();
minimumHeight = height; minimumHeight = height;
if (qFuzzyCompare(currentHeight(), oldEffectiveHeight)) {
return;
}
prepareGeometryChange(); prepareGeometryChange();
updateClipRect(); updateClipRect();
reorganizeCards(); reorganizeCards();
update(); update();
// Do NOT emit minimizedChanged: the minimized STATE is unchanged, and that signal // effectiveHeightChanged repositions neighbouring zones; that path re-enters with the
// feeds rearrangeZones -> rearrangeCounters -> setMinimumHeight (infinite loop). // same floor and early-returns above, so it converges.
// effectiveHeightChanged repositions neighbouring zones and converges instead: the
// rearrange re-enters setMinimumHeight with the same height and early-returns above.
if (!qFuzzyCompare(currentHeight(), oldEffectiveHeight)) {
emit effectiveHeightChanged(); emit effectiveHeightChanged();
} }
}
bool CommandZone::isMinimized() const bool CommandZone::isMinimized() const
{ {