Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
None
-
5.5.1
-
None
-
Windows 7
Description
If you call setContentsMargins on a dock widget, the default title bar remains left aligned and at the fixed width, leaving unusually awkward spacing to the left. If the dockwidget is floating, this is a non-issue, with margins added as expected.
Simple example:
#include <QtWidgets\QApplication> #include <QtWidgets\QMainWindow> #include <QtWidgets\QDockWidget> int main(int argc, char *argv[]) { QApplication app(argc, argv); app.setApplicationName("Dock Margins Example"); QMainWindow mainWin; // setup widgets QDockWidget exampleDock(&mainWin); QWidget dockContents; dockContents.setStyleSheet(QStringLiteral("background: #FFFFFF;")); // contents colouring exampleDock.setWidget(&dockContents); mainWin.addDockWidget(Qt::LeftDockWidgetArea, &exampleDock); exampleDock.setWindowTitle("Example Dock"); exampleDock.setContentsMargins(30, 30, 30, 30); mainWin.show(); return app.exec(); }
Additionally, the top margin in the dock widget is ignored while docked (its set as the same as title's height), but is as-expected while floating.
It may be related to QTBUG-2104, however it is unclear how to retrieve and re-arrange the default title bar.
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-51359 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
299085,1 | Take content margins into account when calculating QDockWidget layout | dev | qt/qtbase | Status: NEW | 0 | 0 |