Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.14.0 RC2
-
None
-
Windows 10 with 2 4k monitors, scaling set to 150%
Description
I have 2 4k monitors set to scale at 150% on Windows 10 and I don't think the numbers are working out right for me. Here's my code:
#include "mainwindow.h" #include <QApplication> #include <QScreen> #include <QDebug> int main(int argc, char *argv[]) { // Specific application options for high dpi screens QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); #endif QApplication a(argc, argv); int screen_idx = 1; QList<QScreen*> screens(QGuiApplication::screens()); Q_FOREACH( auto screen, screens) { const QRect screen_rect(screen->availableGeometry()); const QSize pixel_rect(screen->size()); qDebug() << "Screen #" << screen_idx << ": screen_rect: " << screen_rect << ", pixel_rect= " << pixel_rect; ++screen_idx; } MainWindow w; w.show(); return a.exec(); }
and here is the output:
Screen # 1 : screen_rect: QRect(0,0 2560x1400) , pixel_rect= QRect(0,0 2560x1440)
Screen # 2 : screen_rect: QRect(3840,0 2560x1400) , pixel_rect= QRect(3840,0 2560x1440)
Now one or both of those QRect for the sizes should be 3840x2160. The docs for geometry() in specific say:
This property holds the screen's geometry in pixels
Those are not pixels. Those are scaled pixels (2560x1.5=3840, 1440x1.5=2160). How do I get the actual number of pixels on each display?
Attachments
Issue Links
- duplicates
-
QTBUG-56555 Need clarification of QScreen::geometry() for High DPI screens
- Reported
-
QTBUG-51628 Window item's logical x and y positions are broken in non-primary Monitor when High DPI scaling is in effect on secondary monitor
- Reported