Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Creating new widgets/windows

    General and Desktop
    2
    3
    1203
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      Kewal last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • L
        lgeyer last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • K
          Kewal last edited by

          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)

          1 Reply Last reply Reply Quote 0
          • First post
            Last post