Results 1 to 8 of 8

Thread: dynamically building qdialog at runtime

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: dynamically building qdialog at runtime

    Yes, you created a new set of widgets instead of reusing those you already had. Since you removed the original layout but didn't remove the widgets in it, the widgets stayed where they were and new ones were put in the newly created layout.
    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.


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

    Cremers (23rd October 2012)

  3. #2
    Join Date
    May 2012
    Posts
    57
    Thanks
    11
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: dynamically building qdialog at runtime

    LOL

    I already was wondering about those 'new QLabel' etc.

    Thanks.


    Added after 34 minutes:


    I still haven't got it right. I have created the widgets in the constructor in stead of on the stack.
    When I set the layout of box2 to a simple widget, it works, but if I set it to layout2, the program crashes badly.

    Qt Code:
    1. //----------------------------------
    2. void Edit::makeform(bool landscape)
    3. {
    4. layout1->addRow(labelname, editname);
    5. layout1->addRow(labeldate, editdate);
    6. layout1->addRow(labeltime, edittime);
    7. box1->setLayout(layout1);
    8. layout2->addRow(labeldst, editdst);
    9. box2->setLayout(layout2);
    10. vlayout->addWidget(box1);
    11. vlayout->addWidget(box2);
    12. vlayout->addWidget(buttons);
    13. setLayout(vlayout);
    14. setWindowTitle(landscape ? "landscape" : "portrait");
    15. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by Cremers; 23rd October 2012 at 20:41.

  4. #3
    Join Date
    May 2012
    Posts
    57
    Thanks
    11
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: dynamically building qdialog at runtime

    For what you are trying to do you should look at http://doc.qt.digia.com/latest/layou...iclayouts.html
    Thanks.

Similar Threads

  1. Replies: 9
    Last Post: 25th March 2011, 21:22
  2. QDialog.exec() exiting without calling QDialog::accept()
    By doggrant in forum Qt Programming
    Replies: 3
    Last Post: 2nd February 2011, 11:35
  3. Replies: 1
    Last Post: 25th September 2010, 08:20
  4. Replies: 8
    Last Post: 21st March 2010, 11:31
  5. closing a Qdialog called from a Qdialog
    By OverTheOCean in forum Qt Programming
    Replies: 3
    Last Post: 28th September 2009, 08:02

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.