Important: Please read the Qt Code of Conduct -

A question about QComboBox::setCurrentIndex

  • I used the Designer to add a QComboBox widget to the window and then use the property editor to edit the text property.
    Then, I compiled the project.
    Strange thing is, there's an error:
    @/home/cecaadmin/Configure_xml/build-Configure_xml-Desktop-Debug/ui_topmodule_start.h:229: error: 'class QComboBox' has no member named 'setCurrentText'
    comboBox->setCurrentText(QApplication::translate("topModule_start", "1ns/1ps", 0, QApplication::UnicodeUTF8));
    Means there's now method to set the combobox's current index??
    I don't know how to figure this. How to set the currentindex of the combobox in Qt designer?

    Some help please~~~thank you!

  • Moderators

    There is no "text" property for the combo box. What did you set exactly?
    The proper way would be to set the "currentIndex" property.

  • Yeah, you are right.
    I've figured out the question by modify the xml file.


Log in to reply