Showing Output from external QThread on Local QTextEdit object (Qt 4, SuSe Linux 10)
I have a Gui app that contains a QTextEdit object. From this app I start a separate QThread. What is the best way, if possible, for the QThread to print messages to the QTextEdit on the main Gui app.
Any help is greatly appreciated.
Thanks in advanced.
Re: Showing Output from external QThread on Local QTextEdit object (Qt 4, SuSe Linux 10)
Make your thread emit a signal with the text to be appended to the text edit and connect it to QTextEdit::append() slot.
Re: Showing Output from external QThread on Local QTextEdit object (Qt 4, SuSe Linux 10)
Make sure you use a queued connection.
Re: Showing Output from external QThread on Local QTextEdit object (Qt 4, SuSe Linux
Thanks for the help guys. This really gives me an idea and how to get this done. I'll post how it went.
Thanks again
Re: Showing Output from external QThread on Local QTextEdit object (Qt 4, SuSe Linux
I was able to make this work by connecting the signal inside my thread to the textEdit box.
eg:
GUI APP:
thread = new mythread();
connect(thread, SIGNAL(mysignal(QString)), textEdit, SLOT(append(QString)), Qt::QueuedConnection);
THREAD:
mythread::send(QString str)
{
emit mysignal(str);
}
thanks for the help.