error: ‘class QComboBox’ has no member named ‘setCurrentText’;
error: ‘class QComboBox’ has no member named ‘setCurrentText’;
我遇到过这样的错误,
error: ‘class QComboBox’ has no member named ‘setCurrentText’; did you mean ‘currentText’?
x_cn_num->setCurrentText(QApplication::translate("MainWindow", "0", 0, QApplication::UnicodeUTF8));
^~~~~~~~~~~~~~
然而,我检查了official documentation,"setCurrentText"正是QComboBox的兼容成员。
如果你知道真正的原因和解决方法,请给我一些线索。
您正在尝试使用 Qt 3.0 函数。您应该使用文档中链接的替代函数(在本例中为 setItemText
),或者如果您真的想使用旧函数,则需要将 QT_DISABLE_DEPRECATED_BEFORE
定义为 0
.
我遇到过这样的错误,
error: ‘class QComboBox’ has no member named ‘setCurrentText’; did you mean ‘currentText’?
x_cn_num->setCurrentText(QApplication::translate("MainWindow", "0", 0, QApplication::UnicodeUTF8));
^~~~~~~~~~~~~~
然而,我检查了official documentation,"setCurrentText"正是QComboBox的兼容成员。
如果你知道真正的原因和解决方法,请给我一些线索。
您正在尝试使用 Qt 3.0 函数。您应该使用文档中链接的替代函数(在本例中为 setItemText
),或者如果您真的想使用旧函数,则需要将 QT_DISABLE_DEPRECATED_BEFORE
定义为 0
.