Results 1 to 10 of 10

Thread: how to create window that opened when close main window??

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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 create window that opened when close main window??

    When main window close, event loop terminate, then you can open second main window.

  2. #2
    Join Date
    May 2010
    Posts
    20
    Thanks
    7
    Qt products
    Qt4

    Default Re: how to create window that opened when close main window??

    Quote Originally Posted by fatjuicymole View Post
    When main window close, event loop terminate, then you can open second main window.
    ok, but i didn't know how can connect second main window with first main window..
    clearly,i don't know how can deal with code of window classes exactly!

    maybe i need to see some examples..
    Unfortunately,i can't find it..

    thanks..

  3. #3
    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: how to create window that opened when close main window??

    Do you need something like this?
    Qt Code:
    1. #include <QtGui>
    2. int main (int argc, char** argv) {
    3. QApplication ap(argc, argv);
    4.  
    5. QWidget *window1 = new QWidget(0);
    6. QWidget *window2 = new QWidget(0);
    7.  
    8. QPushButton *button = new QPushButton("Open second Window", window1);
    9.  
    10. window1->show();
    11.  
    12. QObject::connect(button, SIGNAL(clicked()), window2, SLOT(show()));
    13.  
    14. return ap.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 

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

    Abeer (16th May 2010)

  5. #4
    Join Date
    May 2010
    Posts
    20
    Thanks
    7
    Qt products
    Qt4

    Default Re: how to create window that opened when close main window??

    Quote Originally Posted by Zlatomir View Post
    Do you need something like this?
    Qt Code:
    1. #include <QtGui>
    2. int main (int argc, char** argv) {
    3. QApplication ap(argc, argv);
    4.  
    5. QWidget *window1 = new QWidget(0);
    6. QWidget *window2 = new QWidget(0);
    7.  
    8. QPushButton *button = new QPushButton("Open second Window", window1);
    9.  
    10. window1->show();
    11.  
    12. QObject::connect(button, SIGNAL(clicked()), window2, SLOT(show()));
    13.  
    14. return ap.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 
    yes yes like this...
    thanks a lot
    thanks a lot Zlatomir

    i will try to do that in my application
    and try to add menu and a lot of things in second window

    i am grateful for you..
    Last edited by Abeer; 16th May 2010 at 15:12.

Similar Threads

  1. Replies: 1
    Last Post: 19th April 2010, 07:19
  2. close window signal
    By jano_alex_es in forum Newbie
    Replies: 5
    Last Post: 22nd May 2009, 10:10
  3. How to close parent window from child window?
    By montylee in forum Qt Programming
    Replies: 5
    Last Post: 14th October 2008, 11:40
  4. Replies: 11
    Last Post: 11th August 2008, 09:14
  5. Replies: 15
    Last Post: 23rd March 2007, 16:16

Tags for this Thread

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.