简体   繁体   English

PySide / PyQt中缺少QPainter.drawStaticText

[英]QPainter.drawStaticText missing from PySide/PyQt

According to Qt's documentation QPainter has a drawStaticText method that was added in version 4.7. 根据Qt的文档, QPainter具有在4.7版中添加的drawStaticText方法。 However I can't use it in PySide or PyQt4, even though their respective Qt versions are newer. 但是,即使它们各自的Qt版本较新,我也不能在PySide或PyQt4中使用它。

PySide.QtCore.__version__ is 4.8.5 PySide.QtCore.__version__是4.8.5

PyQt4.QtCore.PYQT_VERSION_STR is 4.10.3 PyQt4.QtCore.PYQT_VERSION_STR为4.10.3

PyQt4.QtCore.QT_VERSION_STR is 4.8.5 as well PyQt4.QtCore.QT_VERSION_STR is 4.8.5

Is it just not supported or am I missing something? 只是不被支持还是我缺少什么?

EDIT 编辑

I was mistaken, the method is available in PyQt but not in PySide. 我错了,该方法在PyQt中可用,但在PySide中不可用。

Support for Qt-4.7 was added in PyQt-4.8 (the versions don't necessarily stay in sync any more). 在PyQt-4.8中添加了对Qt-4.7的支持(版本不必再保持同步)。 A check of the PyQt-4.8 source code shows that drawStaticText was there from the start, and it's also there in PyQt-4.8.5. 对PyQt-4.8源代码的检查显示,从一开始就存在drawStaticText ,并且在PyQt-4.8.5中也存在。 I don't have access to a PyQt-4.8.x build at the moment, but drawStaticText is definitely usable in PyQt-4.9.5 and later versions. 我目前无法访问PyQt-4.8.x 版本 ,但是drawStaticText在PyQt-4.9.5和更高版本中绝对可用。

But the question might be not so much what version of PyQt you're using, but what version of Qt was it built against? 但是问题不仅仅在于您使用的是哪个版本的PyQt,而是针对哪个版本的Qt? IOW, what does the following reveal? IOW,以下内容揭示了什么?

    PyQt4.QtCore.QT_VERSION_STR

EDIT : 编辑

It seems that QPainter.drawStaticText is not included in PySide (as of version 1.2.1), which is corroborated by their documentation . 似乎QPainter.drawStaticText不包含在PySide中(从1.2.1版开始), 其文档证实了这一点。 If you want to see if anything can be done about this, I would suggest you ask on the PySide mailing list . 如果您想查看是否可以采取任何措施,建议您在PySide邮件列表中询问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM