Good test, I set it up and it ran like I expected it to (fast and good.) But then I started to change things. What I have is a thread, right, so the way my thread sends the message back is threw and signal and a slot.
I placed within my thread the for loop and had it send back the message back via emit and it gave the display. So, would it be in the emit or would it be within the thread?
My thread is very simple thread.
// with in the basic run I have
for(int x = 0; x < 1000; x++)
{
send(tr("I want more lines\nthis is another line %1").arg(x));
}
// where send is a function
{
emit send_msg(msg);
}
// with in the basic run I have
for(int x = 0; x < 1000; x++)
{
send(tr("I want more lines\nthis is another line %1").arg(x));
}
// where send is a function
void my_thread::send(QString msg)
{
emit send_msg(msg);
}
To copy to clipboard, switch view to plain text mode
now my connect on my gui looks like this
connect(mp_thread,
SIGNAL(send_msg
(QString)),
this,
// and my funciton
void my_gui
::append_output(QString out_msg
) {
output_text->append(out_msg);
output_text->setTextCursor(cursor);
}
connect(mp_thread, SIGNAL(send_msg(QString)), this,
SLOT(append_output(QString)));
// and my funciton
void my_gui::append_output(QString out_msg)
{
output_text->append(out_msg);
QTextCursor cursor(output_text->textCursor());
cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
output_text->setTextCursor(cursor);
QApplication::processEvents();
}
To copy to clipboard, switch view to plain text mode
Bookmarks