Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
6.6.0
-
Screens: 3, High DPI scaling: inactive
# 0 "Studio Display" Depth: 24 Primary: yes
Geometry: 2560x1440+0+0 Available: 2560x1374+0+25
Virtual geometry: 6848x1440-2560+0 Available: 6848x1415-2560+25
3 virtual siblings
Physical size: 599.3x329.514 mm Refresh: 60 Hz Power state: 0
Physical DPI: 108.5,111 Logical DPI: 72,72 Subpixel_RGB
DevicePixelRatio: 2
Primary orientation: 2 Orientation: 0 Native orientation: 0
# 1 "Built-in Retina Display" Depth: 24 Primary: no
Geometry: 1728x1117+2560+202 Available: 1728x1079+2560+240
Virtual geometry: 6848x1440-2560+0 Available: 6848x1415-2560+25
3 virtual siblings
Physical size: 344.245x222.524 mm Refresh: 120 Hz Power state: 0
Physical DPI: 127.5,127.5 Logical DPI: 72,72 Subpixel_RGB
DevicePixelRatio: 2
Primary orientation: 2 Orientation: 0 Native orientation: 0
# 2 "C27HG7x" Depth: 24 Primary: no
Geometry: 2560x1440-2560+0 Available: 2560x1415-2560+25
Virtual geometry: 6848x1440-2560+0 Available: 6848x1415-2560+25
3 virtual siblings
Physical size: 602.074x338.667 mm Refresh: 60 Hz Power state: 0
Physical DPI: 108,108 Logical DPI: 72,72 Subpixel_RGB
DevicePixelRatio: 1
Primary orientation: 2 Orientation: 0 Native orientation: 0Screens: 3, High DPI scaling: inactive # 0 "Studio Display" Depth: 24 Primary: yes Geometry: 2560x1440+0+0 Available: 2560x1374+0+25 Virtual geometry: 6848x1440-2560+0 Available: 6848x1415-2560+25 3 virtual siblings Physical size: 599.3x329.514 mm Refresh: 60 Hz Power state: 0 Physical DPI: 108.5,111 Logical DPI: 72,72 Subpixel_RGB DevicePixelRatio: 2 Primary orientation: 2 Orientation: 0 Native orientation: 0 # 1 "Built-in Retina Display" Depth: 24 Primary: no Geometry: 1728x1117+2560+202 Available: 1728x1079+2560+240 Virtual geometry: 6848x1440-2560+0 Available: 6848x1415-2560+25 3 virtual siblings Physical size: 344.245x222.524 mm Refresh: 120 Hz Power state: 0 Physical DPI: 127.5,127.5 Logical DPI: 72,72 Subpixel_RGB DevicePixelRatio: 2 Primary orientation: 2 Orientation: 0 Native orientation: 0 # 2 "C27HG7x" Depth: 24 Primary: no Geometry: 2560x1440-2560+0 Available: 2560x1415-2560+25 Virtual geometry: 6848x1440-2560+0 Available: 6848x1415-2560+25 3 virtual siblings Physical size: 602.074x338.667 mm Refresh: 60 Hz Power state: 0 Physical DPI: 108,108 Logical DPI: 72,72 Subpixel_RGB DevicePixelRatio: 1 Primary orientation: 2 Orientation: 0 Native orientation: 0
Description
Our app saves its window position and on startup restores it from within Component.onCompleted.
This worked with 6.5.3 but with 6.6.0 we have the following problem:
When the app is closed on a Monitor with lower dpi and later reopened it is scaled to 200% (or whatever the scale factor for that monitor is).
The following example replicates this behavior. It is a window with only a ToolBar in it. If the app opens on the lower dpi monitor, the toolbar is twice as large.
import QtCore import QtQuick import QtQuick.Controls ApplicationWindow { id: mainWindow visible: true width: 360 height: 320 Settings { id: windowSettings category: "Position" property int x property int y } Component.onCompleted: { restorePosition(); } function restorePosition(){ mainWindow.x = windowSettings.x; mainWindow.y = windowSettings.y; } function savePosition(){ windowSettings.x = mainWindow.x windowSettings.y = mainWindow.y } onXChanged: {Qt.callLater(savePosition)} onYChanged: {Qt.callLater(savePosition)} header: ToolBar {} }
Reproduction steps:
1. Create a new "Qt Quick Application" project in Qt Creator.
2. Paste the code above into Main.qml.
3. Run with Qt Creator on the high dpi monitor.
4. Move the app window to the low dpi monitor and close it.
5. Launch again -> App opens on last closed position but is incorrectly scaled.