[Solved] How to get comboBox data instead of index with registerfield
I'm making a GUI app with a QWizard and QWizardPages structure.
In the first page I have a combobox (cb_info1) with some items:
Then I register it using: registerField("Info_combo", cb_info);
And finally in page2, I want to show which option was selected(if A, B or C) showing the info on a label:
If option A was selected, myLabel should show (or at least is want I am trying to): A
But instead of that it shows '0' which I suppose its the index of the item selected of the Combobox.
How can I make that the label shows "A" instead of the index ? I saw there is a itemtext property but u have to pass the index which I don't know or I don't see how to do it.
IIRC, you can use the currentText property when registring your field. Then you should get the text rather that the index.
That is something I've already tried but I just get errors cause I don't know how to put it really... I'm trying with registerField("Info_combo", cb_info, cb_info->currentText()) but there is no way to make it work
registerField("info_combo", m_ui->cb_info, "currentText", "currentTextChanged");
Yeah!!! It worked Andre, thank you so much! I was trying to put currentText and currentTextChanged as if they were functions, not Strings.
Technically, they are not strings, but const char* :)
Glad you got it to work.
It is time IMHO that these signatures also get a more modern twin taking a function pointer instead.