Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-10934

QStackedWidget::removeWidget documentation is confusing

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 4.7.0
    • 4.7.0
    • Documentation
    • None
    • RHEL 5.5
    • 3f6d48ad326fd261153cec1b9eab1da00a144066

    Description

      The documentation of QStackedWidget::removeWidget is quite confusing:

      "Note: The ownership of widget remains the same. The widget is not deleted, but simply removed from the widget's stacked layout, causing it to be hidden."

      But, QStackedWidget::addWidget says:

      "Appends the given widget to the QStackedWidget and returns the index position. Ownership of widget is passed on to the QStackedWidget."

      This suggests that ownership of the widget remains with the QStackedWidget after removal - and that it's impossible to free the memory, since the widget is just hidden. Actually, ownership transfers back to the application and it's up to it to 'delete' the widget to free the memory.

      The documentation should make it clear ownership transfers back to the application.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              gbk Martin Smith (Qt)
              brucec Bruce Cran
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes