In slot connected to QComboBox::currentIndexChanged(int) call QComboBox::itemData method.
In slot connected to QComboBox::currentIndexChanged(int) call QComboBox::itemData method.
Thanks everyone.
But I want seperation between my application class and gui class, so I dont want to call any Qt functions from my application class. The bottom line is I dont know how to intercept the signal currentIndexChanged in order to convert my Qstring to an integer. Do I need to implement a new signal?
Thanks
In that case you could connect the currentIndexChanged signal to a slot in your GUI class, convert the QString to an int and call the method from your application class. Of course, instead of calling the method directly you could also define and emit a custom signal which you connect to the slot from your application class. You can find an example in the Qt documentation.
The question is, why don't you want any Qt code in your application class? If that class has a slot, you have Qt code already in there.
dbrmik (9th January 2009)
Why dont u try as rexi said - convert QString to int in your slot ?
Still if u want a slot in ur application class with int parameter, then have a look at using QSignalMapper, though this will be lengthy way !
Thanks Rexi, a custom slot in my GUI class to perform the conversion QString to int , then emit the signal to my application class
Thanks
Bookmarks