Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QDockWidget showFullscreen not working on Ubuntu (gnome)

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.

like image 455
xam Avatar asked Apr 12 '13 16:04

xam


1 Answers

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.

like image 139
Henry Avatar answered Sep 17 '22 03:09

Henry