View Single Post
Venemo's Avatar
Posts: 1,296 | Thanked: 1,773 times | Joined on Aug 2009 @ Budapest, Hungary
#18
Originally Posted by D-Iivil View Post
Okay, I got the apply -button to launch the script. Still haven't figured out how to get the text string from drop down menus to be put as variables.
After that it should be pretty much done.

I found this, but don't know what to do with it
http://doc.qt.nokia.com/4.6/qcombobox.html#activated-2
Well then, step-by-step:
  • Create a private variable of type QString in your header file in your class
    Code:
    QString myString;
  • In your constructor, set a default value to this variable.
    Code:
    myString = "mydefaultstuff"
  • In the designer, right click the combobox, click "go to slot...", and select the slot you've found in the doc
  • in the generated method, assign your variable - set its value to the one that is returned by the slot
    Code:
    myString = text;
  • In your button's clicked(), use the value of this variable.

Note that there should be some function which returns the current item in the combo box - using that in your clicked() should eliminate the need of introducing the variable.