Search code examples
pythonuser-interfaceqtpy

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?


Solution

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