Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-136715

Resizing an undocked QDockWidget from the top-right causes the vertical resize direction to invert.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P2: Important
    • None
    • 6.9.0
    • Widgets: Layout
    • None
    • Linux/Wayland

    Description

      As first reported in QTBUG-108675?focusedId=862917&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-862917, the vertical resize direction of an undocked {QDockWidget (at least, under kwin-wayland-6.3.5-1), when resized from its top-right corner, is inverted.

      Reproduction

      #include <QApplication>
      #include <QMainWindow>
      #include <QDockWidget>
      #include <QLabel>
      #include <Qt>
      
      class MinimalDockApp : public QMainWindow {
      public:
          MinimalDockApp(QWidget *parent = nullptr) : QMainWindow(parent) {
              setWindowTitle("Minimal QDockWidget App");
              setGeometry(100, 100, 400, 300); // x, y, width, height
      
              // Optional: central widget
              // setCentralWidget(new QLabel("Central Widget (Optional)"));
      
              // Create a QDockWidget
              QDockWidget *dockWidget = new QDockWidget("My Dock", this);
              dockWidget->setFeatures(
                  QDockWidget::DockWidgetClosable |
                  QDockWidget::DockWidgetMovable |
                  QDockWidget::DockWidgetFloatable
              );
      
              // Content for the dock
              QLabel *dockContent = new QLabel("Hello from Dock!");
              dockContent->setAlignment(Qt::AlignCenter);
      
              dockWidget->setWidget(dockContent);
      
              // Add dock widget to the main window
              addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
          }
      };
      
      int main(int argc, char *argv[]) {
          QApplication app(argc, argv);
          MinimalDockApp window;
          window.show();
          return app.exec();
      }
      

      I'm not familiar with QMake, so I customised a template, but it worked:

      Unable to find source-code formatter for language: pro. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      # The name of your project
      TEMPLATE = app
      TARGET = minimaldockapp
      
      # The version of Qt to use — explicitly targeting Qt 6
      CONFIG += qt warn_on c++17
      
      # Specify required Qt modules
      QT += widgets
      
      # Include paths – make sure qmake can find your Qt 6 headers
      INCLUDEPATH += /usr/include/qt6
      INCLUDEPATH += /usr/include/qt6/QtWidgets
      INCLUDEPATH += /usr/include/qt6/QtCore
      
      # If you have Qt 6 in a non-standard lib directory, add it like this:
      # QMAKE_LIBDIR += /usr/lib/qt6
      
      # Source files
      SOURCES += main.cpp
      
      # If you had separate header files or UI forms, you would list them:
      # HEADERS += myclass.h
      # FORMS += form.ui
      
      # Optionally, enforce C++17 explicitly
      QMAKE_CXXFLAGS += -std=c++17
      

      Attachments

        1. non-reproduction_in_leap.webm
          255 kB
          ROKE BEEDELL
        2. reproducible_cpp_sample.zip
          16 kB
          ROKE BEEDELL
        3. reproducible_python_sample.py
          1 kB
          ROKE BEEDELL
        4. reproduction_in_cpp.webm
          904 kB
          ROKE BEEDELL
        5. reproduction_in_pyqt6.webm
          775 kB
          ROKE BEEDELL
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            axelspoerl Axel Spoerl
            beedellrokejulianlockhart ROKE BEEDELL
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes