You may need to call setVisible(true). IIRC, changing window flags makes the 
widget invisible.

-John Weeks

> On Oct 11, 2017, at 2:36 PM, René J.V. Bertin <rjvber...@gmail.com> wrote:
> 
> Hi,
> 
> Dock widgets are very useful, but there are cases where I'd like to be able 
> to detach them to a regular window, because
> 
> - regular windows stay visible when the application focus changes
> - regular windows can do stacking
> - regular windows can be put (partly) off the screen
> 
> The latter 2 are practical when using a smaller screen size, all three are 
> useful for, say, a documentation browser.
> 
> How can one achieve this? I see that QDockWidget::setFloating(true) 
> ultimately just sets the Qt::Tool window flag, so I tried unsetting that. At 
> the moment, I have
> 
>    connect(this, &QDockWidget::topLevelChanged, this, [this] (bool floating) {
>            if (floating) {
>                setTitleBarWidget(0);
>                setWindowFlags(Qt::Window);
>                updateGeometry();
>                activateWindow();
>                raise();
>            }
>        } );
> 
> which probably has a number of redundant calls, doesn't handle the case when 
> a QDockWidget is created in "floating" mode and also isn't reliable.
> 
> Most of the time, the window simply disappears when the above lambda is 
> triggered. In addition, under X11 the window will have the regular titlebar 
> provided by the WM but looks as if there's a regular window with the floating 
> dock window inside, tiny titlebar included.
> 
> What am I missing here?
> 
> Thanks,
> René
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to