How to access parents variables
Hi Folks,
I don't get it. I have a QWidget and a QThread(*parent). Now the QWidget starts the QThread(*parent). In this QThread I want to access the variables in the QWidget. Imagine the QWidget holds an iserinput like QLineEdit.
Finally I have two Headers:
#1.
Code:
#include ...
{
Q_OBJECT
public:
explicit UserInput
(QWidget *parent
= 0);
}
#2
Code:
#include ...
{
Q_OBJECT
public:
explicit algorithmus
(QWidget *parent
)
Now in the Contructor of the QWidget
Code:
....
calc = new algorithmus(this);
Finally I want to access the QLineEdit in the QWidget for the calculation in QThread:
Code:
....
return [U]this->parent()->inputLine.toInt()[/U] + 1000; //f.e.
Is this even possible?? I am a newbie :)
Re: How to access parents variables
Ignoring completely the C++ aspect of the question, you can't access widgets from within threads.
Re: How to access parents variables
ok... and is it possbile between two QWidgtes?
Re: How to access parents variables
If you use proper C++ syntax and respect scopes then yes.