0

I want to put my qml window at center of my primary screen. and as figure shown I have 3 monitor which my primary screen is the middle one.

The problem is x and y properties in qml window are not relative to screen but global. So I cannot use what suggested in here which is result in window apear on both none primary screen and non center.

I'm looking into some variable contains each screen position in x and y, although just do centering is much more better :)

My Monitor Configuration

Community
  • 1
  • 1
Pazel1374
  • 218
  • 3
  • 14
  • 1
    If your main screen is the central one you could use the Screen.desktopAvailableWidth / 2 as a center. – Sommerwild Mar 21 '16 at 09:49
  • Unfortunately your solution has two weakness. first, as you seen my right monitor resolution is not the same as the left, second, it only solve the problem in x direction not y. considering each monitor position – Pazel1374 Mar 21 '16 at 11:21
  • 1
    Well you can detect all your screens size from c++ with QWidget *QDesktopWidget::screen(int screen = -1) Then with the coord x you will know in what window you are so you can center the panel in that particular screen using his concret height – Sommerwild Mar 21 '16 at 11:44
  • yes that's some good answer, I also used xrender tool to get offset https://paste.kde.org/pgcnzif2f. look like there isn't better solution out there – Pazel1374 Mar 24 '16 at 07:59

0 Answers0