Need clarification about QGuiApplication::screens
-
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.
-
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.