7

i'm trying to put a floated (undocked) QDockWidget into full screen mode. On Windows everything seems straight forward. For example i connect the topLevelChanged() signal of a dockwidget (dw) to a custom slot floatingChanged()

connect(dw, SIGNAL(topLevelChanged(bool)), this, SLOT(floatingChanged(bool)));

inside the slot i check: if dw is floating and call dw->showFullscreen().

void MainWindow::floatingChanged(bool floating)
{
    if( floating )
    {
        QDockWidget* dw = static_cast<QDockWidget*>(QObject::sender());
        dw->showFullScreen();
    }
}

in windows the undocked (floating) QDockWidget switches directly into full screen mode after undocking. But under linux (ubuntu 12.04, gnome-shell 3.4.1) this does not work (qt 4.8.0). The dock widget just stays in normal mode.

I can't figure out how to switch a (floating) QDockWidget into fullscreen mode. Any solutions on this are very welcome. In fact the different OS's are acting different on this purpose.

I already searched the web without success, so this is my first post here. Please forgive me for spelling errors i'am not native english speaker, thanx ;)

p.s. I gonna try osx-lions behaviour too. By the way: To try it out just implement the above shown floatingChanged() slot in the MainWindow of the Qt example http://qt-project.org/doc/qt-5.0/qtwidgets/mainwindows-mainwindow.html and connect it with any of the existing dockwidgets or inside the MainWindow::createDockWidget() method.

xam
  • 155
  • 1
  • 8
  • On osx-lion with qt 4.8.2 behaves different as well. The dock widget is simply shown maximized after calling dw->showFullScreen(). This means the title bar is/was shown; Win XP had a real full screen behaviour, where the title bar was absence as well - that is what i require from a full screen mode. – xam Apr 12 '13 at 20:17
  • I found a kind of work around using style sheets. I explained it in the Qt-Center forum: [link](http://www.qtcentre.org/threads/54178-QDockWidget-showFullScreen%28%29-only-works-on-Windows). Any more hints are very welcome... – xam Apr 22 '13 at 23:09
  • Does [this minimal example](http://ideone.com/RIvk4C) behave like you described on your setup? It seems to work as expected on mine. – brunocodutra Sep 25 '13 at 02:40

1 Answers1

2

Calling this function showFullScreen() only affects windows.

Full-screen mode works fine under Windows, but has certain problems under X. These problems are due to limitations of the ICCCM protocol that specifies the communication between X11 clients and the window manager. ICCCM simply does not understand the concept of non-decorated full-screen windows. Therefore, the best we can do is to request a borderless window and place and resize it to fill the entire screen. Depending on the window manager, this may or may not work. The borderless window is requested using MOTIF hints, which are at least partially supported by virtually all modern window managers. An alternative would be to bypass the window manager entirely and create a window with the Qt::X11BypassWindowManagerHint flag. This has other severe problems though, like totally broken keyboard focus and very strange effects on desktop changes or when the user raises other windows. X11 window managers that follow modern post-ICCCM specifications support full-screen mode properly.

Henry
  • 36
  • 2