Skip to content

Commit

Permalink
Fix MainToolbar, and AppMenuBar in Qt 6.5+
Browse files Browse the repository at this point in the history
The problem was that a ListView lazily creates delegates as needed to
actually display them. If the size of the ListView is 0, then it doesn't
need to display anything, so it may not create any of the delegates. If
it doesn't create any delegates, then we can't make it size itself to
fit its contents. By setting a minimum size of 1, we force the ListView
to create a delegate that we can then use to determine the ListView's
actual size.

Fixes: musescore#24097
  • Loading branch information
kbloom committed Aug 30, 2024
1 parent a20d940 commit b274f13
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/appshell/qml/MainToolBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ Item {

model: toolBarModel

width: contentItem.childrenRect.width
height: contentItem.childrenRect.height
width: Math.max(1, contentItem.childrenRect.width)
height: Math.max(1, contentItem.childrenRect.height)

delegate: PageTabButton {
id: radioButtonDelegate
Expand Down
2 changes: 1 addition & 1 deletion src/appshell/qml/platform/AppMenuBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import MuseScore.AppShell 1.0
ListView {
id: root

height: contentItem.childrenRect.height
height: Math.max(1,contentItem.childrenRect.height)
width: contentWidth

property alias appWindow: appMenuModel.appWindow
Expand Down

0 comments on commit b274f13

Please sign in to comment.