Important: Please read the Qt Code of Conduct -

Qt5: Does QScreen::virtualSiblings() guarantee the order of screens (needed to detect current screen)?

  • Hello,

    According to Qt5.0.0 documentation, screen returned by QWindow::screen() "does not change when the window is moved around virtual screen". That means, if QWindow is created on Display1 and then moved to Display2 - there is no way of telling it inside QWindow.

    The QScreen class provides list of its virtual siblings, however documentation does not specify in what order these siblings are. Can I rely that top-left screen will be at [0] and bottom-right at [count()-1]? If so, I can take QWindow::position() and sum screens' dimensions until I find the current one (in usual case there are only two displays, but systems with more than two are not unthinkable of).

    And this all is needed so call to showFullScreen() will expand the window onto current screen, not initial (primary?). Thus QWindow::setScreen() has to be called first with proper screen.

    I reported and in connection with this issue.

Log in to reply