PDA

View Full Version : Start a thread automatic at start



ralphot
10th July 2013, 10:38
I have an application with start and stop buttons for the thread.
How can I make the thread start without pushing the start button?
I want the application to startup at boot time.


void Dialog::on_pushButton_clicked()
{
mThread->start();
mThread->Stop = false;
ui->running->setText("Startad");
}

Santosh Reddy
10th July 2013, 14:03
Just call on_pushButton_clicked() from the mainwindow ctor after setupUi()

anda_skoa
10th July 2013, 14:05
By calling mThread->start() somewhere else?
Like after creating it?

Cheers,
_

ralphot
10th July 2013, 16:54
Just call on_pushButton_clicked() from the mainwindow ctor after setupUi()

So simple, I'm so glad for experts. Thanks a lot!

Ralph in Sweden