Results 1 to 2 of 2

Thread: two forms in main one after the other one?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Location
    Texas
    Posts
    15
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default two forms in main one after the other one?

    what do i do so when newForm1 closes the other one (newForm2) shows...

    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "newForm1.h"
    3. #include "newForm2.h"
    4.  
    5. int main( int argc, char *argv[] )
    6. {
    7. QApplication app( argc, argv );
    8.  
    9. newForm1 n;
    10. n.show();
    11.  
    12. newForm2 w;
    13. w.show();
    14.  
    15. return app.exec();
    16. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: two forms in main one after the other one?

    Reimplement closeEvent() in newForm1, emit custom "closed()" signal there and connect it to "show()" slot in newForm2 (don't call "show()" on newForm2 instance in that case).
    Another way, make newForm1 derived from QDialog, and use exec() instead of show().

Similar Threads

  1. More than one forms
    By NewLegend in forum Qt Programming
    Replies: 16
    Last Post: 15th September 2010, 00:32
  2. Multiple Forms and vertical layout in forms
    By eva2002 in forum Qt Programming
    Replies: 0
    Last Post: 13th January 2010, 05:05
  3. Replies: 11
    Last Post: 11th August 2008, 09:14
  4. Layouting "Windows.Forms" like Qt forms
    By Boron in forum Qt Tools
    Replies: 1
    Last Post: 29th April 2008, 22:01
  5. Replies: 15
    Last Post: 23rd March 2007, 16:16

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.