本文介绍了如何在Qt4 OpenGL应用程序中启用HiDPI(Retina)支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将QGraphicsScene与QGraphicsView一起使用,如本文档中所述;我打算最终在我的OpenGL渲染场景上覆盖Qt小部件.

I am using a QGraphicsScene with a QGraphicsView, as described in this document; I intend to eventually overlay Qt widgets on top of my OpenGL rendered scene.

当我启动一个按照上面的教程建模的虚拟应用程序时,渲染的视图被大量像素化-HiDPI根本无法工作.根据此文档,我已手动添加:

When I launch a dummy application modeled after the tutorial above, the rendered view is heavily pixelated-- HiDPI isn't working at all. Per this document, I've manually added:

<key>NSHighResolutionCapable</key>
<string>True</string>

到应用程序的Info.plist文件,仍然无效. (似乎无论如何这应该默认为true,所以也许这并不奇怪).

to the application's Info.plist file, still with no effect. (It seems this is supposed to default to true anyway, so maybe that's not surprising).

除上述内容外,我还没有找到使HiDPI工作所需的条件.我没有使用QtCreator,我的Qt安装是macports的qt4-mac.我想念什么?

Beyond the above, I haven't found what's needed to get HiDPI working. I am not using QtCreator, and my Qt install is macports' qt4-mac. What am I missing?

推荐答案

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.

这篇关于如何在Qt4 OpenGL应用程序中启用HiDPI(Retina)支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 18:38