Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-84090

Unable To setGeometry when programmatically moving frameless QMainWindow between Screens with different DPI

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.12.4
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Win 10
    • Platform/s:
      Windows

      Description

      Bug: 

      • Strong and permanent flickering when draging frameless window between monitors with different dpis

      Fixture

      • two Monitors, one left, one right where you can move windows from one monitor to the other 
      • left monitor: normal dpi with 100% scaling
      • right monitor: high dpi with 150% scaling

      Used Application attributes

      • AA_EnableHighDpiScaling

      Application specs

      • Frameless QMainWindow with central widget
      • Central widgte has a close button and a drag label
      • drag label uses event filter to move the windows around
      • event filter reacts on Mouse press/move/release events
      • event filter moves main window

      Reproduction steps (move via event filter)

      • build application (see attached source)
      • Click and hold on Label ("Grab me and move me around") on the most right side
      • drag window slowly on the left monitor

      Result

      1. a strong flickering occurs while the window is permamently repositioned till it reachs the left monitor
      2. we get permamently errors from QWindowsWindow::setGeometry till the left monitor is reached

      Variations

      use QWidget instead of QMainWindow and move via event filter

      • comment line 79 in Application.cpp
      • uncomment line 80 in Application.cpp
      • build
      • Click and hold on Label ("Grab me and move me around") on the most right side
      • drag window slowly on the left monitor

      Result

      • a strong flickering occurs while the window is permamently repositioned till it reachs the right monitor
      • we get permamently errors from QWindowsWindow::setGeometry till the left monitor is reached

      Disabled FramelessWindowHint and move via event filter

      • comment line 77 in Application.cpp
      • uncomment line 79 in Application.cpp
      • comment line 80 in Application.cpp
      • build
      • Click and hold on Label ("Grab me and move me around") on the most right side
      • drag window slowly on the left monitor

      Result

      • no flickering, but wrong position while transition from right to left monitor
      • we get permamently error from QWindowsWindow::setGeometry till the left monitor is reached

      Disable AA_EnableHighDpiScaling, Enabled or Disabled FramelessWindowHint and via event filter

      • comment line 7 main.cpp
      • un/comment line 77 in Application.cpp
      • uncomment line 79 in Application.cpp
      • comment line 80 in Application.cpp
      • build
      • Click and hold on Label ("Grab me and move me around") on the most right side
      • drag window slowly on the left monitor

      Result

      • no flickering
      • one error from QWindowsWindow::setGeometry

      Move with Titlebar

      • comment line 77 in Application.cpp
      • uncomment line 79 in Application.cpp
      • comment line 80 in Application.cpp
      • build
      • Click and hold on Titlebar on the most right side
      • drag window slowly on the left monitor

      Result

      • correct positioning
      • no errors

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              kleint Friedemann Kleint
              Reporter:
              peterkruttke Peter Kruttke
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes