Results 1 to 2 of 2

Thread: Open a QMainWindow Object in QDialog Object

  1. #1
    Join Date
    Jun 2008
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Open a QMainWindow Object in QDialog Object

    I wanna open QMainWindow Object in QDialog Object:
    in the login in dialog,as u see:
    main dialog is a QDialog Object called frmlogin:
    after close the main dialog,the QMainWindow called frmMain will appear.

    this is the simply source,
    Qt Code:
    1. this->close(); // close the main dialog
    2. frmMain mainwindow(this);
    3. mainwindow.show(); //show the QMainWindow
    To copy to clipboard, switch view to plain text mode 

    as u see,The mainwindow never appear.How can i do to let it work well?


    thank for u all.
    Last edited by jpn; 13th June 2008 at 20:50. Reason: missing [code] tags

  2. #2
    Join Date
    Dec 2007
    Posts
    129
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Open a QMainWindow Object in QDialog Object

    in your qdialog
    Qt Code:
    1. connect (your_close_signal(maybe close button)), SIGNAL (clicked()),this , SLOT (show_frmmain()));
    2.  
    3. void yourdialog::show_frmmain()
    4. {
    5. frmMain *calfrm = new frmMain;
    6. calfrm->show();
    7. }
    To copy to clipboard, switch view to plain text mode 

    this is only one of many possible answers try to explore!
    Last edited by jpn; 13th June 2008 at 20:50. Reason: missing [code] tags

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

    tpf80 (2nd September 2008)

Similar Threads

  1. QMainWindow child of a QDialog
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 16th January 2008, 07: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.