Results 1 to 3 of 3

Thread: Child object not showing

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Child object not showing

    Create the instance of SM in heap. Currently you are creating in stack so its deleting immediately.
    Or you can call exec() instead of show();

    So now your code should look like this:
    Qt Code:
    1. mm::mm(QWidget *parent)
    2. : QDialog(parent)
    3. {
    4. QHBoxLayout *layout=new QHBoxLayout;
    5. QPushButton *p = new QPushButton("MM");
    6. connect(p,SIGNAL(clicked()),this,SLOT(showMM()));
    7. layout->addWidget(p);
    8. setLayout(layout);
    9. setWindowTitle("MainMenu");
    10. show();
    11. sm *s = new sm(); // This line is changed
    12. }
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to yogeshgokul for this useful post:

    BalaQT (24th September 2009)

Similar Threads

  1. Replies: 4
    Last Post: 4th January 2009, 01:14
  2. showing menu mouseclick event with opengl object
    By validator in forum Qt Programming
    Replies: 1
    Last Post: 8th March 2008, 23:25
  3. Showing QMainWindow without showing a child QWidget
    By discostu in forum Qt Programming
    Replies: 3
    Last Post: 4th March 2007, 09:03
  4. Replies: 4
    Last Post: 10th May 2006, 22:37
  5. Replies: 9
    Last Post: 9th May 2006, 19:53

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.