Results 1 to 10 of 10

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

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

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



    Hi everyone ..

    Iam a absolute Beginner in QT..

    i am trying to create window that has only text and one push button when you press it, you will get another window that has menu for program ..

    but Unfortunately, i didn't know how can i create new window and connect it with main window!

    so, i need to helping you


  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

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

    Take a look at QMessageBox
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    Abeer (16th May 2010)

  4. #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??

    You want something like a splash screen before open the main window of your application?

  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
    You want something like a splash screen before open the main window of your application?
    No, i don't
    it is not important..

    i just need to know how can open window from main window and so on..

  6. #5
    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.

  7. #6
    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..

  8. #7
    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 

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

    Abeer (16th May 2010)

  10. #8
    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.

  11. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

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

    Quote Originally Posted by Abeer View Post
    i just need to know how can open window from main window and so on..
    http://www.qtcentre.org/faq.php?faq=...esigner_2forms
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  12. The following user says thank you to wysota for this useful post:

    Abeer (16th May 2010)

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

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

    thanks for all..
    i created second window from my main window and now i will add to it menu and other things..


    i am grateful

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.