python - Qt 在 QGraphicsView 中显示文本不失真,即使在 IgnoreAspectRatio View 中也是如此

标签 python qt qgraphicsview

有没有办法以某种方式放置QGraphicsTextItem,以便文本始终显示不变形并且对于用户而言大小相同?

想象一个放大和缩小的场景,但有一些用点和一些文本标记的点。如果文本是场景的一部分,它会随场景一起缩放,并且大多数时候将无法读取。

最佳答案

您需要为文本项设置QGraphicsItem::ItemIgnoresTransformations标志。请参阅文档:

This flag is useful for keeping text label items horizontal and unscaled, so they will still be readable if the view is transformed.

关于python - Qt 在 QGraphicsView 中显示文本不失真,即使在 IgnoreAspectRatio View 中也是如此,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25408726/

相关文章:

python - 如何从 numpy.dot(A, A_inv) 得到单位矩阵

python - 使用 django-rest-interface

python - 使用过滤后的行创建新的数据框

Qt Creator 部署到远程 Linux 目标

c++ - Qt编译错误: C2280: attempting to reference a deleted function

python - 如何将图像放入QGraphicsView的滚动条区域?

python - 如何列出静态链接的 python 版本中可用的所有 openssl 密码?

c++ - Qt - 这些代码片段是什么意思

c++ - 找到绘制的线的交点

qt - 在带有 QGLWidget 视口(viewport)的 QGraphicsView 上具有透明背景的小部件