PDA

View Full Version : Start a thread automatic at start



ralphot
10th July 2013, 09: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, 13:03
Just call on_pushButton_clicked() from the mainwindow ctor after setupUi()

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

Cheers,
_

ralphot
10th July 2013, 15: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