Creating new widgets/windows



  • My application is having many subwindows/widgets and upon clicking a button the new screen/widget gets created.
    I am creating a new screen dynamically everytime, and I just wanted to know if thats the proper way and closing the screens would delete the object.
    Is there a way of managing the screen creation in a better way.



  • What is a "screen", a top-level widget?

    Widgets are deleted automatically when closed if the Qt::WA_DeleteOnClose attribute is set (or when their parent is deleted).

    If you just want to hide a widget and re-show it later on use QWidget::hide() and QWidget::show() instead.



  • I was considering should we create and delete it everytime or just show and hide. Probably the answer would be 'Depends' based on the scenario. All my previous applications (Non - QT) were behaving in the creation and deletion way. I am bit confused if I need to use the show and hide,. what I need to be doing if the widgets are too big (in terms of memory)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.