Why does QT not get the number of monitor connections and home screen index after closing windows background desktop applications?

zxc0818 1 Reputation point
2023-02-28T08:11:56.96+00:00

Why does QT not get the number of monitor connections and home screen index after closing windows background desktop applications? After opening the windows background desktop application, QT can get the number of monitor connections and home screen index. What services did Microsoft shut down?

图片

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,195 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Limitless Technology 44,121 Reputation points
    2023-02-28T14:13:58.03+00:00

    Hello there,

    Got this infromation from an thread which states EnumDisplayMonitors returns monitors in the order defined in the Display Settings, while QGuiApplication::screens always shows primary screen at the first position (actually, QGuiApplication::primaryScreen simply do that: return the first element).

    Looking at the source code, in Windows Qt also uses the EnumDisplayMonitors function but basically moves the primary screen to the first position (it actually inserts in the first position the primary screen, while inserting at the end of the list any other monitor).

    So, the primary screen will be at first position, screens with an index lower than primary screen's will be shifted one position, while the rest will match the index.

    Similar discussion here https://learn.microsoft.com/en-us/answers/questions/1153873/after-skipping-the-windows-background-desktop-appl

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments

  2. Limitless Technology 44,121 Reputation points
    2023-02-28T14:14:06.4166667+00:00

    Hello there,

    Got this infromation from an thread which states EnumDisplayMonitors returns monitors in the order defined in the Display Settings, while QGuiApplication::screens always shows primary screen at the first position (actually, QGuiApplication::primaryScreen simply do that: return the first element).

    Looking at the source code, in Windows Qt also uses the EnumDisplayMonitors function but basically moves the primary screen to the first position (it actually inserts in the first position the primary screen, while inserting at the end of the list any other monitor).

    So, the primary screen will be at first position, screens with an index lower than primary screen's will be shifted one position, while the rest will match the index.

    Similar discussion here https://learn.microsoft.com/en-us/answers/questions/1153873/after-skipping-the-windows-background-desktop-appl

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments