[Interest] QDockWidgets: how to get regular windows in detached (floating) mode?

Vadim Peretokin vperetokin at gmail.com
Thu Oct 12 11:06:52 CEST 2017


Rene, with the thing you're making - would it then be possible to achieve
browser-like behaviour of being able to drag tabs out into their own
windows? With those windows movable to other monitors as well?

On Thu, Oct 12, 2017 at 11:05 AM René J. V. Bertin <rjvbertin at gmail.com>
wrote:

> 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.
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20171012/e5816748/attachment.html>


More information about the Interest mailing list