Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. it there any way to not delete the child widget inside a QDialog while close the dialog?
Qt 6.11 is out! See what's new in the release blog

it there any way to not delete the child widget inside a QDialog while close the dialog?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.4k Views 1 Watching
  • 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.
  • O Offline
    O Offline
    opengpu2
    wrote on last edited by
    #1

    it there any way to not delete the child widget inside a QDialog while close the dialog?
    i reuse a QWidget, and use setWidget() to set this widget into a QDialog.. then i call dialog.exec(), when i click cancel or close button of the dialog, the QWidget's deconstructor will also be called..but i donot want to delete the QWidget....
    is there any way to do this?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Misty River
      wrote on last edited by
      #2

      When a parent is destroyed the childs are automatically destroyed too. If you want to keep your widget don't destroy your dialog.. but I really don't understand why you would want to do this.. instead of destroying your dialog call hide() on it or something by catching the signals... you should just create a new one for your other use..

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved