简体   繁体   English

“ QTextEdit”对象没有属性“ setPlaceholderText”

[英]'QTextEdit' object has no attribute 'setPlaceholderText'

I know that this question has been asked before , but there only PySide was referred as alternative. 我知道以前曾有人问过这个问题 ,但是只有PySide被称为替代方案。 I kind of want it to work using PyQt4 . 我有点希望它可以使用PyQt4来工作。

The problem is simple: I am using QtDesigner to create a .ui file. 问题很简单:我正在使用QtDesigner创建.ui文件。 In the QtDesigner preview the PlaceholderText in my QTextEdit works just fine. 在QtDesigner预览中,我的QTextEditPlaceholderText工作正常。 In my python program however I get this error: 在我的python程序中,但是出现此错误:

'QTextEdit' object has no attribute 'setPlaceholderText'

which is not true, at least according to the Qt Documentation . 至少根据Qt文档 ,这是不正确的。 The feature was added in version 5.2 and I am using 5.6 . 该功能已在5.2版中添加,并且我正在使用5.6 PyQt4 s version is 4.11.4 (up to date). PyQt4的版本是4.11.4 (最新)。 My python version is 3.4 . 我的python版本是3.4 Any idea why it is not working? 知道为什么它不起作用吗?

Edit: I am open to alternatives involving using another object instead of QTextEdit , but I do not want to switch to PySide . 编辑:我愿意接受涉及使用另一个对象而不是QTextEdit替代方法,但是我不想切换到PySide

您使用的PyQt4尚未针对Qt5构建 ,因此它无法访问Qt5中添加的任何功能。

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

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