Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Using Screen with multiple monitors
Forum Update on Monday, May 27th 2025

Using Screen with multiple monitors

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 309 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bob64
    wrote on 13 Mar 2024, 10:26 last edited by Bob64
    #1

    My (desktop) application uses Settings so that the main window geometry is persisted. I am trying to fix an issue whereby my application can start up "off screen" if the user's hardware changed between runs. (And, because it is off screen, it is then difficult for the user to manipulate it to move back on screen.)

    What I would like to do is to detect in Component.onCompleted of my ApplicationWindow that the initial geometry is outside the available screen bounds, over all monitors, and adjust it if necessary. I thought I could use Screen to provide the information for this but it seems like Screen only provides the height and width of one of my monitors. In fact it seems to refer to the one I have on the right. It seems that if I close my application while the main window is positioned in the left hand monitor, it saves the geometry with a negative x value. I can see that this is restored correctly but the problem is that I need to be able to check this programmatically.

    Is there any way I can access information that allows me to tell whether a particular main window geometry will be visible on the available monitors?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bob64
      wrote on 13 Mar 2024, 11:36 last edited by
      #2

      I noticed this in Screen doc:

      Note that the Screen type is not valid at Component.onCompleted, because the Item or Window has not been displayed on a screen by this time.

      so perhaps the approach I was planning would not work anyway, even if I could get the information out of Screen.

      I am wondering if instead I could make use of the information provided by QGuiApplication::screens(). I will look into this, but any tips would still be appreciated.

      1 Reply Last reply
      0

      2/2

      13 Mar 2024, 11:36

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved