I have created a button

QComboBox cb_codChastotDiap1 

Created by clicking the mouse in the form editor. But I have changed the conditions for this button, I need to add one element, despite the fact that it will be called only in one (4 elements) of two (3 elements). And for this, my question sounds so is it possible to finish by hand in the code, to cb_codChastotDiap1 another index ??

I would like to add the code and rebuild it in Qt Creator.

P.S. I am inconvenient to rewrite the code because the whole program is assembled in the form editor. Yes, and they ask me to make one amendment. I would not like to recompile the entire program. Well, just a scientific interest, and is it possible so)) in general, there is a setCurrentIndex slot in QComboBox, so everything is quite possible, I will try to implement it.

  • one
    and how do you want to add that would not rebuild the entire program? exe something to modify? or form stored in a separate file? - KoVadim
  • just add code and rebuild - timob256

1 answer 1

What was asked at all? The essence of the issue is generally unclear.

I need to add one element, while it will be called only in one (4 elements) of two (3 elements)

I'll try punching: if you want to add another item to QComboBox, use

 void addItem(const QString & text, const QVariant & userData = QVariant()) 

in your case

 cb_codChastotDiap1.addItem("Новый элемент"); 
  • Thank you, Honorable Sir, you helped me a lot. - timob256 pm
  • one
    It's time for psychics to battle) Please describe the problem more clearly - Roman Novoselov