Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Need clarification about QGuiApplication::screens
Forum Updated to NodeBB v4.3 + New Features

Need clarification about QGuiApplication::screens

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 241 Views 2 Watching
  • 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.
  • T Offline
    T Offline
    Taytoo
    wrote on last edited by
    #1

    Came across this stackoverflow post: https://stackoverflow.com/questions/54351270/how-does-qt-enumerate-screens . The answer to that question is interesting.

    My question is if anytime primary screen changes. Do we need to call QGuiApplication::screens again to get the correct screens list with primary screen on top?

    Also, the screens() method returns a list of QScreen pointers, do they point to static objects? i.e. if I call screens() method again and again, assuming displays haven't changed, would I get same pointers? I'm writing some logic where I need to keep track of monitors as they are updated/added/removed etc so trying to get this right.

    1 Reply Last reply
    0
    • jeremy_kJ Offline
      jeremy_kJ Offline
      jeremy_k
      wrote on last edited by
      #2

      Do QGuiApplication::primaryScreenChanged(QScreen *), QGuiApplication::screenAdded(QScreen *), QGuiApplication::screenRemoved(QScreen *), and the QScreen geometry signals not work, or not meet the requirement?

      The QScreen objects aren't static in the C++ sense. They should persist between calls to enumerate the screens, as long as the detected system configuration hasn't changed.

      Asking a question about code? http://eel.is/iso-c++/testcase/

      1 Reply Last reply
      1

      • Login

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