I am using Windows 10 and Qt 5.15.1. When I move my QML application window from a low DPI screen (100% scale) to a high DPI (125% scale) screen, the window scales up (resizes) to use more pixels, as expected. This makes the window appear to be the same physical size on both screens.
However the items in the window do not scale -- they stay the same number of pixels. So all the items appear to be physically smaller on the high DPI screen.
How do I get the items to scale (to the same physical size) when I move the window between screens with different DPIs? I want this to occur with all items, like text, buttons, rectangles, etc.
My QML is:
import QtQuick 2.12
import QtQuick.Controls 2.12
ApplicationWindow {
visible: true
width: 240
height: 60
Text {
text: "Hello World"
font.pointSize: 14
}
}
My Python is:
QtCore.QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
QtCore.QCoreApplication.setAttribute(Qt.AA_UseOpenGLES)
app = QtWidgets.QApplication([])
engine = QtQml.QQmlEngine()
context = QtQml.QQmlContext(engine.rootContext())
designer = QtQml.QQmlComponent(engine, 'main.qml')
designer.create(context)
app.exec_()

