Fullscreen over multiple screens (Qt 5.6)



  • I am building a QtQuick application that should mostly run in fullscreen mode, and in some cases using multiple monitors. However, I am unable to get the application to resize to fullscreen over multiple monitors.

    I am currently developing and testing under X11 on Ubuntu 14.04.

    I have been experimenting with setting the geometry of the main window to that of the virtual desktop, and the window actually reports back the correct geometry, but it still only shows up on the primary screen.

    Here is a snippet of what I have been trying.

    int main(int argc, char *argv[])
    {
      QGuiApplication app(argc, argv);
      auto const screen(QGuiApplication::primaryScreen());
    
      QQmlApplicationEngine engine;
      QQmlComponent component(&engine, QUrl(QStringLiteral("qrc:/main.qml")));
    
      auto object = component.create();
      auto window = qobject_cast<QQuickWindow*>(object);
    
      window->setGeometry(screen->availableVirtualGeometry());
    
      return app.exec();
    }
    

    The "window" is a QML ApplicationWindow that has no width och height set initially.

    When running my experiment on a two-screen setup, the application comes up "fullscreen" on one of the screens (seems somewhat random which one, and it is not really fullscreen, as there are still e.g. a window manager menu bar at the top of the screen). However, when logging out the window geometry, it reports back a geometry that would actually cover both the physical screens, i.e. the geometry seems to get set correctly.

    Any ideas and/or pointers?

    Cheers,

    /johan


  • Moderators

    @JohanL Hi, and welcome to the Qt forum! What's your desktop environment? Unity?



  • have you tried window->showFullScreen() instead of setting the geometry?



  • @Wieland said:

    @JohanL Hi, and welcome to the Qt forum! What's your desktop environment? Unity?

    Thank you!

    Yes, sorry, I should have mentioned, it's Unity.



  • @VRonin said:

    have you tried window->showFullScreen() instead of setting the geometry?

    Yes, I didn't mention that in my original post, but I did try that as well. That actually gives the behavior I really want from the perspective of removing everything but my application from the screen, including any window borders, menu bars, etc, but it still only shows my application on one of my screens.

    I should also mention that things works as expected if I manually resize the window (by dragging at the window borders) to cover the whole screen (or as close as you can get by doing this manually).



  • @JohanL said:

    @Wieland said:

    @JohanL Hi, and welcome to the Qt forum! What's your desktop environment? Unity?

    Thank you!

    Yes, sorry, I should have mentioned, it's Unity.

    Not being an expert in X11 and window managers, I still suspect there might be a connection to window manager behavior. For Unity for example, window maximation (by pressing the little maximize button) also only expands the window on the current screen).



  • @JohanL Looking around it looks like setting the geometry and then calling showFullScreen() worked in Qt4



  • @VRonin said:

    @JohanL Looking around it looks like setting the geometry and then calling showFullScreen() worked in Qt4

    I've now tested this as well, and it does not seem to work either (I tried it both ways, first setting the geometry and then fullscreen, and the other way around). I also failed to mention in my original post that I am on Qt 5.6.

    I also switched to GNOME, running whatever it is you get by default when installing on Ubuntu 14.04, but same result there, the application only starts in fullscreen on one of the physical screens.



  • what i'd do then is setting the geometry and then calling

    window->setFlags(
    (window->flags() & ~Qt::WindowTitleHint) 
    | Qt::FramelessWindowHint
    );
    

    This should simulate the apparence of a "full screen" window



  • @VRonin said:

    what i'd do then is setting the geometry and then calling

    window->setFlags(
    (window->flags() & ~Qt::WindowTitleHint) 
    | Qt::FramelessWindowHint
    );
    

    This should simulate the apparence of a "full screen" window

    Yes, this likely works to get the apparence of full screen, except I do not think it will actually make the window cover e.g. the top bar of Ubuntu's Unity desktop.

    Anyway, I still haven't figured out how to solve the original question of getting my main window to span two (or more) physical screens on startup. I'll continue to dig around, but any additional ideas would be highly appreciated!

    Cheers,

    /johan


  • Qt Champions 2016

    @JohanL

    Yes, this likely works to get the apparence of full screen, except I do not think it will actually make the window cover e.g. the top bar of Ubuntu's Unity desktop.

    Bear in mind some, or I'd say most, window managers explicitly prohibit that, it can be changed manually from the WM's configuration though (at least KDE allows it, and I think Gnome does as well).

    I'll continue to dig around, but any additional ideas would be highly appreciated!

    What I'd try is to get the geometry of each screen, union the regions and ultimately set the widget/window's geometry manually.

    Kind regards.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.