Results 1 to 4 of 4

Thread: Start a thread automatic at start

  1. #1
    Join Date
    Aug 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Start a thread automatic at start

    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:n_pushButton_clicked()
    {
    mThread->start();
    mThread->Stop = false;
    ui->running->setText("Startad");
    }

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Start a thread automatic at start

    Just call on_pushButton_clicked() from the mainwindow ctor after setupUi()
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Start a thread automatic at start

    By calling mThread->start() somewhere else?
    Like after creating it?

    Cheers,
    _

  4. #4
    Join Date
    Aug 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Start a thread automatic at start

    Quote Originally Posted by Santosh Reddy View Post
    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

Similar Threads

  1. thread->start() does not work ?
    By ErrMania in forum Newbie
    Replies: 3
    Last Post: 20th November 2011, 11:08
  2. Automatic start routine after GUI started
    By enno in forum Qt Programming
    Replies: 3
    Last Post: 31st May 2010, 14:22
  3. How to start a thread (inline)
    By DiamonDogX in forum Qt Programming
    Replies: 4
    Last Post: 28th May 2009, 21:53
  4. start
    By Sandeep in forum Newbie
    Replies: 1
    Last Post: 21st May 2008, 18:42
  5. ask: how to start app within app
    By rian191 in forum Qt Programming
    Replies: 4
    Last Post: 25th February 2008, 06:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.