I want to have a dock floating by default, I mean floating at application launch time, letting the user the possibility to dock it in any area, rather than having it docked at the beginning and offering the possibility to make it floating.
If I write:
dock->setFloating(true);
dock->setWidget(w);
QDockWidget *dock = new QDockWidget;
dock->setFloating(true);
dock->setWidget(w);
To copy to clipboard, switch view to plain text mode
the widget does not appear.
If I write:
dock->setFloating(true);
dock->setWidget(w);
dock->show();
QDockWidget *dock = new QDockWidget;
dock->setFloating(true);
dock->setWidget(w);
dock->show();
To copy to clipboard, switch view to plain text mode
it appears but can no longer be grabbed and moved anywhere.
Any idea?
Added after 34 minutes:
Solution: it is necessary to dock the widget first and then to undock it by making it floating:
dock->setWidget(w);
this->addDockWidget(Qt::TopDockWidgetArea, dock);
dock->setFloating(true);
QDockWidget *dock = new QDockWidget;
dock->setWidget(w);
this->addDockWidget(Qt::TopDockWidgetArea, dock);
dock->setFloating(true);
To copy to clipboard, switch view to plain text mode
Bookmarks