Results 1 to 3 of 3

Thread: (GUI) how to run code on program startup

  1. #1
    Join Date
    May 2011
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows Symbian S60

    Default (GUI) how to run code on program startup

    hi,
    how can i make a piec of code to run when the GUI application starts?
    i see no onStart signal or something like that in Qt.

    thanks in advance.

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: (GUI) how to run code on program startup

    I guess it depends what are you trying to do, you can just call a function (code you want to run) from main before you start the event-loop (if your code doesn't need the event loop, or signal-slot, or other things that need the event loop), or you can call some function from the constructor of your main window and i guess there might be many other ways.

  3. The following user says thank you to Zlatomir for this useful post:

    qtierer (9th May 2011)

  4. #3
    Join Date
    May 2011
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows Symbian S60

    Default Re: (GUI) how to run code on program startup

    thanks,
    i put my code into
    MainWindow::MainWindow(QWidget *parent) :

    and it worked like i wanted.

Similar Threads

  1. Program exited with code 03
    By Fallen_ in forum Qt Programming
    Replies: 1
    Last Post: 9th October 2010, 23:09
  2. program crashing randomly code -1073741819
    By feraudyh in forum General Programming
    Replies: 6
    Last Post: 21st September 2010, 17:07
  3. Replies: 8
    Last Post: 28th January 2010, 06:45
  4. How to resize a QDockWidget when startup the program?
    By heavenstar_x in forum Qt Programming
    Replies: 6
    Last Post: 26th October 2007, 12:58
  5. QToolBar go away! On startup anyway.
    By bitChanger in forum Qt Programming
    Replies: 1
    Last Post: 10th February 2006, 18:22

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.