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

Undocked dockwidget does not include window frame with setGeometry

    XMLWordPrintable

Details

    Description

      It would be nice if the undocked dockwidget would work with the setGeometry() function.

      Currently it seems that the frame size is included when getting/setting the size of the undocked QDockWidget.

      This makes it difficult to layout and resize widget on the screen because the size of the frame of the QDockWidget must be compensated for.

      Reproducible with the following example:
      #include <QtGui>
      #include <QDebug>

      // Shows two windows that are not the same size

      // Expected two windows that were in the same position and size
      // The dockwidget is smaller thant the QWidget.

      int main(int argc, char *argv[])
      {
      QApplication app(argc, argv);

      QMainWindow w;
      w.setCentralWidget(new QTextEdit(0));
      QDockWidget dw(&w);

      dw.setWidget(new QWidget);
      dw.setFloating(true);

      dw.setGeometry ( 60, 60, 150, 150 );

      qDebug() << dw.frameGeometry().height();
      qDebug() << dw.frameGeometry().width();

      QWidget w2;
      w2.show();

      w2.setGeometry ( 60, 60, 150, 150 );

      qDebug() << dw.frameGeometry().height();
      qDebug() << dw.frameGeometry().width();

      w.show();
      dw.show();

      return app.exec();
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vfm Thierry Bastian (closed Nokia identity) (Inactive)
            admin Administrator
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes