3
我遵循此示例Key/Value pyqt QComboBox,使用下面的代码将ID值存储到组合框项目。PyQt4.QtCore.QVariant对象而不是字符串?
self.combox_widget.addItem('Apples', 'Green')
indx = self.combox_widget.currentIndex()
print self.combox_widget.itemData(indx)
不过,我得到<PyQt4.QtCore.QVariant object at 0x02AC1A70>
上试图检索数据值(“绿色”在上面的例子)。我在这里错过了什么?
谢谢,工作:) – Stacked