MuseScore
MuseScore copied to clipboard
Qt 6.5+: docks do not open after the last dock on a panel is closed
Issue type
UI bug (incorrect info or interface appearance)
Description with steps to reproduce
This issue only happens with Qt 6.5+ (tested on Qt 6.7.2). Previously discussed a bit in the comments of #24097
Description: When you open a score and attempt to open a dock that does not have a panel (e.g. you try to open piano or mixer, or you close all of the tabs on the left - palettes, properties, etc. - and try to open one of them back) visually nothing changes, the dock does not open. (@adam248 has also reported this issue as https://github.com/NixOS/nixpkgs/issues/343456)
Explanation: KDDockWidgets 1 (including the latest 1.7) are designed to restore docks incompatibly with the way Qt 6.5+ works.
When MuseScore calls setVisible(true)
in DockBase::open
to show a previously closed dock widget those panel was also closed, the expected call chain to recreate the panel (frame) is this:
muse::dock::DockWindowActionsController::toggleOpened
muse::dock::DockWindow::toggleDock
muse::dock::DockBase::open
KDDockWidgets::QWidgetAdapter::show
QQuickItem::setVisible(true)
QQuickItemPrivate::setVisible(true)
QQuickItemPrivate::setEffectiveVisibleRecur(calcEffectiveVisible()/*=true*/)
QQuickItemPrivate::itemChange
KDDockWidgets::QWidgetAdapter::itemChange
KDDockWidgets::DockWidgetQuick::event
KDDockWidgets::DockWidgetBase::onShown
KDDockWidgets::DockWidgetBase::Private::maybeRestoreToPreviousPosition
KDDockWidgets::DockWidgetBase::Private::restoreToPreviousPosition
KDDockWidgets::LayoutWidget::restorePlaceholder
KDDockWidgets::DefaultWidgetFactory::createFrame
However, in Qt 6.5 and later the chain ends at QQuickItemPrivate::setEffectiveVisibleRecur
since after https://github.com/qt/qtdeclarative/commit/d1b9a4cacfb966cf0a37983d8f8044f3aedf5de3 calcEffectiveVisible()
returns false
for an item without a parent (and a dock without a panel has none).
KDDockWidgets have redesigned this in https://github.com/KDAB/KDDockWidgets/commit/764385de9f9dd88c2685e42ef65e1daaaca3d679 which went into the 2.0.0 release. Updating to the latest KDDockWidgets (it still supports Qt 6.2+) seems to be the best way forward.
Note: If I revert https://github.com/qt/qtdeclarative/commit/d1b9a4cacfb966cf0a37983d8f8044f3aedf5de3, the closed docks are opened back again, and the only remaining issues with MuseScore 4.4.2 on Qt 6.7.2 that I see (after #24326 is merged) are:
-
The mixer dock is almost blank (only channel strip separators are visible) until I switch to a different dock in the same panel and back (e.g. by pressing 'p' twice to open and close piano keyboard).
-
The navigator dock is a white rectangle the first time it is opened (as long as it was closed when the MuseScore has opened the score) until it is redrawn, e.g. until I pan the view of the score or resize the window.
Supporting files, videos and screenshots
In this state P, F7, F8, F9, F10, F12 do nothing with the UI, while the console prints e.g.
| INFO | main_thread | ActionsDispatcher::dispatch | try call action: toggle-piano-keyboard
| INFO | main_thread | ActionsDispatcher::dispatch | try call action: dock-toggle
What is the latest version of MuseScore Studio where this issue is present?
4.4.2
Regression
No.
Operating system
NixOS
Additional context
No response
Checklist
- [X] This report follows the guidelines for reporting bugs and issues
- [X] I have verified that this issue has not been logged before, by searching the issue tracker for similar issues
- [X] I have attached all requested files and information to this report
- [X] I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible