且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Qt4 OpenGL应用程序中启用HiDPI(Retina)支持?

更新时间:2022-02-15 02:15:51

Qt5启用HiDPI用于OpenGL上下文,但不启用小部件和QGraphicsItems.

Qt5 enables HiDPI for the OpenGL context, but not for widgets and QGraphicsItems.

根据此错误,支持在QGLWidget上呈现窗口小部件和QGraphicsItems在HiDPI中尚不支持;它们将以标准分辨率渲染并调整大小.

According to this bug, support for rendering widgets and QGraphicsItems on a QGLWidget in HiDPI is not yet supported; they will render at standard res and be resized.

如果QGraphicsView具有普通的QWidget支持,它将在HiDPI中呈现.如果可以在不使用OpenGL的情况下使用QGraphicsItems达到期望的效果,那么在改进HiDPI支持之前,这可能是更可取的.

QGraphicsView will render in HiDPI if it has an ordinary QWidget to back it. If it is possible to achieve the desired effect using QGraphicsItems without OpenGL, this may be preferable until HiDPI support is improved.