3

I'm porting a Qt 4.8.x program to Qt 5.3. It works fine under Qt 4.8 when my Ubuntu 12.04 X11 server is running Xinerama mode with Nvidia hardware.

I previously used QtDesktopWidget to retrieve multiple screens and their geometry (I have five connected displays). Under Qt 5.3 in Xinerama mode, QDesktopWidget::screenCount() only returns 1 screen, which is the union of all five. Under Qt 4.8, it would properly return the 5 screens with their correct geometry.

I next tried running my X server with Xinerama disabled with Qt 5.3. Now, I can correctly get the right screenCount with QDesktopWidget and QApplication:screens() returns a proper list of Screen * I can access.

However, whenever I try to open a window in one of these screens, using QWindow::setScreen, the window always opens up in the primary screen, no matter which screen I set in the constructor of QWindow or using QWindow::setScreen.

When I try open my Qt application in the other screen using X11 arguments like: myapp --display :0.2, this works fine.

However, I need to do this programmatically as I have different content for each display. Has anyone succeed in opening windows in other screens with Qt5 either with or without Xinerama mode turned on? I would prefer not to use Xinerama at QDesktopWidget seems to be built on libxcb only.

Regards, Victor

  • I think that's not possible, as Qt will just use the display set in DISPLAY (which I guess it's `:0.0` in your case), and is unable to cope with multiple X displays. I would be way more interested in debugging why Xinerama doesn't work as expected in Qt 5. Are you getting only one screen from `QApplication::screens()`? Is that screen reporting any virtual siblings? – peppe Jul 08 '14 at 18:48
  • Thanks for the reply - I was able to confirm a few more things. First, in non-Xinerama mode, I was able to use QDesktopWidget to open up windows in the other screens, but OpenGL (I'm using a QGLWidget parented to the widget corresponding to the screen using QDesktopWidget::screen(i), where i is the screen number.) only shows up on the primary screen. For screens on the video card, I can create a larger virtual desktop and OpenGL will render on the screen shared with the primary screen. However, if I run any screens on separate X servers, OpenGL only displays on the primary ones. – digitalmonkey Jul 09 '14 at 05:40
  • Thanks for the tip on virtual siblings, I'll try it out. – digitalmonkey Jul 09 '14 at 05:48
  • It looks like calling in XInerama, QAaplication::screens only returns the one screen (Virtual desktop). Calling virtualSiblings on that QScreen only results in a single sibling as opposed to multiple siblings that would be expected. In addition, calling QDesktopWidget->isVirtualDesktop() returns false, which is also not expected. – digitalmonkey Jul 09 '14 at 14:45
  • May I suggest you file a bug report (or check if one is already reported)? – peppe Jul 09 '14 at 14:47
  • I filed a report with Qt tech support last week. we'll see if they can fix it soon. (I have Enterprise support) – digitalmonkey Jul 18 '14 at 06:39

0 Answers0