You made the widget floating, but not floating.
dockWidget->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
And you can also have a movable frameless window, controlling the mouse, dragging yourself through mousePressEvent
, mouseReleaseEvent
and mouseMoveEvent
.
How to hide now useless float button
Based on the QDockWidget
source code, the "float" button is not displayed if there is a title bar widget:
dockWidget->setTitleBarWidget(new QLabel("Dock Widget", dockWidget));
Or, since it has a name (which is not documented), you can hide it explicitly:
QAbstractButton * floatButton = dockWidget->findChild<QAbstractButton*>("qt_dockwidget_floatbutton"); if(floatButton) floatButton->hide();
source share