blackliteon
11th April 2006, 18:11
Hi all!
Just want to write to the textarea of main application with threads.
Implemeth Thread class:
#include <QTextEdit>
#include <QThread>
class Worker : public QThread
{
Q_OBJECT
public:
void run();
void connectTextOutput(QTextEdit *te);
Worker();
~Worker();
private:
QTextEdit *text;
QString q;
};
and realization:
void Worker::run()
{
text->insertPlainText(q + "AND time is come true\n");
q += "22";
exec();
}
void Worker::connectTextOutput(QTextEdit *te)
{
text = te;
}
And in Main application constructor:
w = new Worker();
w->connectTextOutput(ui.textLog);
w->start();
So...
A get one string writed to text area.
Threat not workedd..
Whats wrong ?
Just want to write to the textarea of main application with threads.
Implemeth Thread class:
#include <QTextEdit>
#include <QThread>
class Worker : public QThread
{
Q_OBJECT
public:
void run();
void connectTextOutput(QTextEdit *te);
Worker();
~Worker();
private:
QTextEdit *text;
QString q;
};
and realization:
void Worker::run()
{
text->insertPlainText(q + "AND time is come true\n");
q += "22";
exec();
}
void Worker::connectTextOutput(QTextEdit *te)
{
text = te;
}
And in Main application constructor:
w = new Worker();
w->connectTextOutput(ui.textLog);
w->start();
So...
A get one string writed to text area.
Threat not workedd..
Whats wrong ?