Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.6.2
-
None
-
Windows 10 Pro, HiDPI display laptop (Dell XPS13 3200x1800)
Ubuntu 16.04, HiDPI display laptop (Dell XPS15)
-
d7bb44dba4e894c14e500d29aaa889c6b7df01db
Description
On Windows 10 with a HiDPI display, when the scaling factor is greater than 100%, the graphics items in a graphics view, when the viewport is a QGLWidget, are painted in the lower left quadrant.
On Windows 10, to change the scaling factor: right click on the desktop, select "Display settings", change the slide from 100% to 200% for "Change the size of text, apps, and other items:"
This problem does not occur on Mac with a retina display. It happens on Linux too ( Dell XPS15 ) with QT_SCALE_FACTOR=2 QT_AUTO_SCREEN_SCALE_FACTOR=0. Note that you don't even need a 4k display on Linux to see this, just passing these environment variables is enough to show the issue.
The attached minimal example (main.cxx) set Qt::AA_EnableHighDpiScaling to true, opens a QMainWindow where the central widget is a QGraphicsView. The QGraphicScene attached to the QGraphicsView consists of a single QPushButton with a long text.
The viewport of the QGraphicsView can be chosen to be: the default (nothing set explicitly), a QGLWidget or a
QOpenGLWidget. The choice is done by commenting out macros at the beginning of the file.
When the scaling is 100%, all viewport options render the QPushButton correctly. However, when the scaling is 200%, when the viewport is a QGLWidget only the lower left quadrant is rendered. The problematic screenshot is qglwidget_200percent.png.
I attached screenshots for each viewport mode (default, QGLWidget, QOpenGLWidget) and each scaling factor (100%, 200%).
Using QOpenGLWidget in my application is not an opinion as it relies on GLEW (as far I know and I experimented, QOpenGLWidget and GLEW are not compatible).
Attachments
For Gerrit Dashboard: QTBUG-59956 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
201525,2 | Make high-dpi QGLWidget work cross platform | 5.9 | qt/qtbase | Status: MERGED | +2 | 0 |