在 Qt 中,我可以通过使用
combobox->currentText()
法。
我怎样才能得到 selected value
?
我寻求帮助,但我找不到一个方法 currentData()
,我希望找到。我只能找到 combobox->currentIndex()
除了 combobox->itemData(combobox->currentIndex())
还有更聪明的方法吗?
更新: 从 Qt 5开始,这就不再需要了。 currentData()
方法已经被加入 http://doc.qt.io/qt-5/qcombobox.html#currentData-prop