From: Arjen Hiemstra Date: Mon, 7 Apr 2025 15:21:41 +0000 (+0200) Subject: [PATCH] layout: Set implicit width of ToolBarLayout before using its width X-Git-Tag: archive/raspbian/6.13.0-2+rpi1^2~9 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1b3b76b0ebc7620a9af3e73c7a7ed88276efbcfb;p=kf6-kirigami.git [PATCH] layout: Set implicit width of ToolBarLayout before using its width Split setting implicit size into setting width and height separately, so that we if we use width() it will use the implicit width if no width was set yet. This avoids us hiding all actions because width is 0, only to then show them again because implicit width (and thus width) is now a valid value. Gbp-Pq: Name upstream_81352c22_layout-Set-implicit-width-of-ToolBarLayout-before-using-its-width.patch --- diff --git a/src/layouts/toolbarlayout.cpp b/src/layouts/toolbarlayout.cpp index dce591b..2e214c2 100644 --- a/src/layouts/toolbarlayout.cpp +++ b/src/layouts/toolbarlayout.cpp @@ -441,6 +441,8 @@ void ToolBarLayoutPrivate::calculateImplicitSize() visibleActionsWidth = 0.0; + q->setImplicitWidth(maxWidth); + if (maxWidth > q->width() - (hiddenActions.isEmpty() ? 0.0 : moreButtonInstance->width() + spacing)) { // We have more items than fit into the view, so start hiding some. @@ -473,7 +475,8 @@ void ToolBarLayoutPrivate::calculateImplicitSize() maxHeight = std::max(maxHeight, moreButtonInstance->implicitHeight()); }; - q->setImplicitSize(maxWidth, maxHeight); + q->setImplicitHeight(maxHeight); + Q_EMIT q->hiddenActionsChanged(); implicitSizeValid = true;