PDA

View Full Version : using QCheckBox->text() from QThread



yodasoda
17th September 2010, 23:26
I know it is not possible to do GUI operations from a QThread but I was wondering if it is possible to read the text of something like a QComboBox or a QRadioButton or QLineEdit etc from the QThread in question.

tbscope
18th September 2010, 06:36
No! Do not do that.

There are a couple of things you can do to get that information in your thread.
1. Create a settings file that you open from within the object in your thread.
2. Pass the settings to the object in your thread before starting the thread.
3. Use signals and slots between your ui and the object in your thread.

wysota
18th September 2010, 07:49
4. Have a simple variable (QString) somewhere that holds the value and read from this variable (remember about protecting it with a mutex if the value of the variable may be changing).