You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a QApplication with AA_EnableHighDpiScaling scaling of icons etc works fine for different screen resolutions, but the viewer area created via SoQtExaminerViewer does not scale correctly. In fact it is blank on high res screens.
This can largely be fixed by changing part of the definition of SoQtGLWidget::setGLSize() as follows:
i.e. moving the line of code that does the scaling of glSize to after the call of setGeometry.
I also found it necessary to add
#define QT_CLEAN_NAMESPACE 1
before the includes in SoQtGLWidgetP.h
These changes work for simple test cases and our much more complex code.
There still remains an issue with dragging the viewer from one screen to another with a different resolution. In this case the viewing area is not resized correctly in that what it contains disappears from view. As a workaround this can be corrected by maximizing and un-maximizing the program panel.
The text was updated successfully, but these errors were encountered:
Here is a minimal example (C++ and CMake) to visualize this issue. In order to test this in a non-HiDPI screen, the environment variable QT_SCALE_FACTOR can be used, e.g., on Windows with set QT_SCALE_FACTOR=2 before running the example.
With set QT_SCALE_FACTOR=1, the result is as expected:
With set QT_SCALE_FACTOR=1.5, the window size does not match:
With set QT_SCALE_FACTOR=2, the screen appears completely black:
The patch in roboticslibrary/soqt@72c6207 solves these issues, but there are additional issues with multiple screens of different DPI factors that can be tested via QT_SCREEN_SCALE_FACTORS, e.g., set QT_SCREEN_SCALE_FACTORS=1;1.5.
Original report by Jonathan Le Vallois (Bitbucket: JLeVallois, GitHub: JLeVallois).
Attachments: SoQtGLWidget.cpp | SoQtGLWidgetP.h
When using a QApplication with AA_EnableHighDpiScaling scaling of icons etc works fine for different screen resolutions, but the viewer area created via SoQtExaminerViewer does not scale correctly. In fact it is blank on high res screens.
This can largely be fixed by changing part of the definition of SoQtGLWidget::setGLSize() as follows:
if (PRIVATE(this)->currentglwidget) {
int frame = this->isBorder() ? PRIVATE(this)->borderthickness : 0;
PRIVATE(this)->currentglwidget->setGeometry(QRect(frame, frame, PRIVATE(this)->glSize[0], PRIVATE(this)->glSize[1]));
#if QT_VERSION >= 0x050000
PRIVATE(this)->glSize = PRIVATE(this)->glSizeUnscaled * PRIVATE(this)->currentglwidget->devicePixelRatio();
#endif
}
i.e. moving the line of code that does the scaling of glSize to after the call of setGeometry.
I also found it necessary to add
#define QT_CLEAN_NAMESPACE 1
before the includes in SoQtGLWidgetP.h
These changes work for simple test cases and our much more complex code.
There still remains an issue with dragging the viewer from one screen to another with a different resolution. In this case the viewing area is not resized correctly in that what it contains disappears from view. As a workaround this can be corrected by maximizing and un-maximizing the program panel.
The text was updated successfully, but these errors were encountered: