Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt 6.8/6.11: tabified QDockWidget freezes dock-area width after undock — regression from 5.15?
Qt 6.11 is out! See what's new in the release blog

Qt 6.8/6.11: tabified QDockWidget freezes dock-area width after undock — regression from 5.15?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 510 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mrFall
    wrote last edited by
    #1

    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):

    1. 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".
    2. setFixedWidth(width()) on the docks then restoring min/max, with processEvents().
    3. layout()->invalidate() followed by layout()->activate(), plus updateGeometry().
    4. Resizing the main window programmatically by ±1 px (immediately and via QTimer::singleShot(0, ...)).
    5. Setting / clearing setAllowedAreas, removing setSizePolicy, toggling setDockNestingEnabled.
    6. 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.
    7. 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.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote last edited by
      #2

      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.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      M 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        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.

        M Offline
        M Offline
        mrFall
        wrote last edited by
        #3

        @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

        1 Reply Last reply
        0
        • M mrFall has marked this topic as solved

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved