Qt 6.8/6.11: tabified QDockWidget freezes dock-area width after undock — regression from 5.15?
-
I have a QMainWindow with several QDockWidgets tabified together. As soon as I undock one of them (via the title-bar float button or by dragging it out), the width of the docked area gets frozen: the remaining docked widgets no longer stretch to fill the main window when it is resized. An empty region appears on the side and cannot be recovered — resizing the main window does not help, and re-docking the floated widget does not fix it either.
This works correctly on Qt 5.15.2, but is broken on Qt 6.8.3 and Qt 6.11.1 (Windows 11, MSVC 2022 x64, stock kit).Minimal example to reproduce
#include <QApplication> #include <QMainWindow> #include <QDockWidget> #include <QTextEdit> int main(int argc, char* argv[]) { QApplication app(argc, argv); QMainWindow window; window.resize(900, 700); auto* dock1 = new QDockWidget("One", &window); dock1 ->setWidget(new QTextEdit("one")); window.addDockWidget(Qt::TopDockWidgetArea, dock1); auto* dock2 = new QDockWidget("Two", &window); dock2->setWidget(new QTextEdit("two")); window.addDockWidget(Qt::TopDockWidgetArea, dock2); auto* dock3= new QDockWidget("Three", &window); dock3->setWidget(new QTextEdit("three")); window.addDockWidget(Qt::TopDockWidgetArea, dock3); window.tabifyDockWidget(dock1, dock2); window.tabifyDockWidget(dock2, dock3); window.show(); return app.exec(); }Steps to reproduce:
Build and run on Qt 6.8.3 or 6.11.1.
Undock one of the tabs via its float button (or drag it out of the window).
Resize the main window by dragging its edge.
The docked area keeps its old width and does not expand with the window; an empty region remains and cannot be recovered.Expected: after undock/redock, the docked area keeps filling the main window and resizes normally, as it does on Qt 5.15.2.
What I have already tried (none of these fix it on 6.8/6.11):
- resizeDocks() (both Qt::Horizontal and Qt::Vertical, on build and on topLevelChanged). Note: passing size 0 is now rejected with "all sizes need to be larger than 0".
- setFixedWidth(width()) on the docks then restoring min/max, with processEvents().
- layout()->invalidate() followed by layout()->activate(), plus updateGeometry().
- Resizing the main window programmatically by ±1 px (immediately and via QTimer::singleShot(0, ...)).
- Setting / clearing setAllowedAreas, removing setSizePolicy, toggling setDockNestingEnabled.
- Verified it is unrelated to: central widget visibility, toolbar/statusbar, OpenGL widgets, QMdiArea, high-DPI rounding policy, widget style — the bare 20-line example above reproduces it.
- Reproduces in both Qt::TopDockWidgetArea and Qt::LeftDockWidgetArea.
The only thing that actually restores the correct width is saveState() + restoreState() after the redock, but calling that from within the topLevelChanged handler makes other floating dock widgets disappear / crashes, so it is not a usable workaround as-is.
Questions:Is this a known regression in the Qt 6.x dock layout? (It resembles the long-fixed QTBUG-70571, possibly re-introduced.)
Is there a clean, supported workaround?
Should I file a bug report with this reproducer?Qt 6.8.3 and 6.11.1, Windows 11 (MSVC 2022 x64) and Qt 6.11.1 on Ubuntu 24.04 — reproduces on both platforms.
-
Please wait for Qt 6.11.2 or a new 6.8 version. Take a look into bugreports.qt.io - don't have the exact bug number at hand.
-
Please wait for Qt 6.11.2 or a new 6.8 version. Take a look into bugreports.qt.io - don't have the exact bug number at hand.
@Christian-Ehrlicher said in Qt 6.8/6.11: tabified QDockWidget freezes dock-area width after undock — regression from 5.15?:
Please wait for Qt 6.11.2 or a new 6.8 version. Take a look into bugreports.qt.io - don't have the exact bug number at hand.
Thank you for the quick responce!
I've found the ticket:
https://qt-project.atlassian.net/browse/QTBUG-147209 -
M mrFall has marked this topic as solved