kaszewczyk
9th November 2009, 08:29
Hello, my problem is:
for example i have a class
class FooClass{
public:
FooClass();
~FooClass();
private:
QTextEdit* text;
};
FooClass::FooClass(){
text = new QTextEdit;
}
and now i want to make thread where i can put something in my FooClass::text fild
class FooThread : public QThread{
public:
void setTextEdit(QTextEdit* __p);
protected:
void run()
private:
QTextEdirt* textPointer;
};
void FooThread::setTextEdit(QTextEdit* __p){
this->textPointer = __p
}
void FooThread::run(){
this->textPointer->insertPlainText("Hello from QThred");
}
my aim is to enter ""Hello from QThred" string into FooClass TextEdit
FooClass::FooClass(){
text = new QTextEdit;
FooThread *thread = new FooThread;
thread->setTextEdit(this->text);
thread->start();
}
but when i do it like this i get runtime error :/
for example i have a class
class FooClass{
public:
FooClass();
~FooClass();
private:
QTextEdit* text;
};
FooClass::FooClass(){
text = new QTextEdit;
}
and now i want to make thread where i can put something in my FooClass::text fild
class FooThread : public QThread{
public:
void setTextEdit(QTextEdit* __p);
protected:
void run()
private:
QTextEdirt* textPointer;
};
void FooThread::setTextEdit(QTextEdit* __p){
this->textPointer = __p
}
void FooThread::run(){
this->textPointer->insertPlainText("Hello from QThred");
}
my aim is to enter ""Hello from QThred" string into FooClass TextEdit
FooClass::FooClass(){
text = new QTextEdit;
FooThread *thread = new FooThread;
thread->setTextEdit(this->text);
thread->start();
}
but when i do it like this i get runtime error :/