Solved how to set the item in Combo Box that will appear when the dialog is executed
-
In my program i have 2 classes named CargaDialog and MainWindow.
The CargaDialog, as its own name say, is a dialog. Inside this Dialog i have a Combo Box, and the items of this combo box are added from outside of de CargaDialog class and inside the MainWindow class.
My problem is that i can add the items in the combo box, but i don't know how to set which item will appear in the "preview" when the Dialog is executed.
How can i do it?
-
Hi,
Add a method to your dialog to set which item the combobox should show.
-
Hi,
But how can i set this?how can i construct this method?
-
@frnklu20
you would usually call the setCurrentIndex(int index) or setCurrentText(const QString &text) function of the combobox.
This will show the item with the index or the item with the text in the box at the top of the combobox. -
@frnklu20 said in how to set the item in Combo Box that will appear when the dialog is executed:
how can i construct this method?
Like any other method in C++.
What exactly is the problem?