Fullscreen over multiple screens (Qt 5.6)
-
@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).
-
@VRonin said:
@JohanL Looking around it looks like setting the geometry and then calling
showFullScreen()
worked in Qt4I'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.
-
@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
-
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.
-
@JohanL said in Fullscreen over multiple screens (Qt 5.6):
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!
I know this topic is quite old, but since it's the best match I found, I'll provide a solution anyway. It works on Linux with X11 and xfwm4. The code is PyQt5, but porting it to C++ should be trivial.
a = QApplication(sys.argv) widget = QLabel(None) widget.setWindowFlags(Qt.WindowStaysOnTopHint) # optional widget.show() # The order is important. You have to show it BEFORE setting the size. # Negative coordinates are necessary because with (0,0) xfwm will place # the window on the current desktop and below the task bar. taskBarSize = 32 allScreens = QApplication.desktop().geometry() widgetSize = allScreens.adjusted(-10, -taskBarSize, 10, taskBarSize) widget.setGeometry(widgetSize) # Now widget should span all screens and cover the task bar a.exec()
-
@fritzw This didn't work for me I also had to add a flag for bypassing window manager, and worked fine if I set the geometry before widget.show() also didn't had to adjust the geometry for the taskbar(tested for KDE only)
pyqt5 code:a = QApplication(sys.argv) widget = QLabel(None) widget.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.X11BypassWindowManagementHint) allScreens = QApplication.desktop().geometry() self.setGeometry(allScreens) widget.show() a.exec()