Results 1 to 3 of 3

Thread: how to restart the MainWindow?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Posts
    10
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question how to restart the MainWindow?

    Hi everybody,

    You know in main function of a default GUI application, a new object of kind MainWindow be created.
    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication a(argc, argv);
    4. // make a new MainWindow object :
    5. MainWindow w;
    6. w.show();
    7. return a.exec();
    8. }
    To copy to clipboard, switch view to plain text mode 


    I am looking for a way to restart the the MainWindow, "controlled inside of MainWindow object".
    for a example if I click on a bottun on ui, the window would restart and start from the begining...

    Can you help me?

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to restart the MainWindow?

    You could have MainWindow on the heap, have the buttons terminating the event loop and then delete and recreate the MainWindow object inside your main function, but I'm not sure why you would want to.

    The purpose of this is ?

  3. #3
    Join Date
    Apr 2010
    Posts
    10
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to restart the MainWindow?

    Quote Originally Posted by fatjuicymole View Post
    You could have MainWindow on the heap, have the buttons terminating the event loop and then delete and recreate the MainWindow object inside your main function,
    Thanks !
    Would you explain more? (if possible with simple code)


    but I'm not sure why you would want to.

    The purpose of this is ?
    I want to restart it, because there are several processes iin my application that I think they slacken the program.
    Last edited by d@nyal; 3rd May 2010 at 03:55.

Similar Threads

  1. QTime restart
    By jhowland in forum Qt Programming
    Replies: 1
    Last Post: 8th October 2008, 20:18
  2. Replies: 1
    Last Post: 10th August 2008, 18:55
  3. MainWindow
    By amagdy.ibrahim in forum Newbie
    Replies: 6
    Last Post: 14th June 2008, 14:12
  4. How to restart an application?
    By xylosper in forum Qt Programming
    Replies: 2
    Last Post: 12th August 2007, 13:04
  5. Restart QApplication
    By Svaths in forum Qt for Embedded and Mobile
    Replies: 5
    Last Post: 8th February 2007, 11:54

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
  •  
Qt is a trademark of The Qt Company.