How do you get the current text contents of a QComboBox?

前端 未结 4 1781
误落风尘
误落风尘 2020-12-05 06:40

Using pyqt4 and python 2.6, I am using a qcombobox to provide a list of options. I am having problems with using the selected option. I have been able to use a signal to tri

4条回答
  •  情歌与酒
    2020-12-05 07:12

    PyQt4 can be forced to use a new API in which QString is automatically converted to and from a Python object:

    import sip
    sip.setapi('QString', 2)
    

    With this API, QtCore.QString class is no longer available and self.ui.comboBox.currentText() will return a Python string or unicode object.

    See Selecting Incompatible APIs from the doc.

提交回复
热议问题