简体   繁体   中英

QComboBox.setPlaceholderText() not working

I am currently trying to make some changes to a GUI application, which uses qtpy extensively. For a certain condition, the text for a combo box is to be set to a certain value.

For this I used self.colormapComboBox.setPlaceholderText("RGB") , where colormapComboBox is an object of the class qtpy.QtWidgets.QComboBox . Documentation referred: this

It results in the error:

AttributeError: 'QComboBox' object has no attribute 'setPlaceholderText'

What can be done to solve this?

First make your comboBox editable. Then you need to use this line of code. self.colormapComboBox.lineEdit().setPlaceholderText("RGB")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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