-
Notifications
You must be signed in to change notification settings - Fork 19
Description
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.