[Interest] QDockWidgets: how to get regular windows in detached (floating) mode?
René J. V. Bertin
rjvbertin at gmail.com
Thu Oct 12 11:04:46 CEST 2017
John Weeks wrote:
> You may need to call setVisible(true). IIRC, changing window flags makes the
> widget invisible.
You appear to be right, thanks.
Now I'm just left with how to restore state correctly after starting the
application anew. After unfloating the window with
static void unfloat(QDockWidget* that, bool floating)
{
if (floating && that) {
that->setTitleBarWidget(0);
// remove unwanted flags
Qt::WindowFlags flags = that->windowFlags() & ~(Qt::Tool|
Qt::FramelessWindowHint|Qt::X11BypassWindowManagerHint);
// set wanted flags
that->setWindowFlags(flags | Qt::Window);
that->updateGeometry();
that->setVisible(true);
}
}
I'm stuck with a window that just shows whatever was behind it when it was first
created.
Maybe I should un-unfloat the window before exiting, or simply dock it.
R.
More information about the Interest
mailing list