Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1411

"del view" in PySide2 QML applications should not be necessary

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Out of scope
    • Affects Version/s: 5.15.1
    • Fix Version/s: None
    • Component/s: Documentation, PySide
    • Labels:
      None

      Description

      There is a lot of QML code examples with `del view`, for example https://doc.qt.io/qtforpython/tutorials/qmlapp/qmlapplication.html or https://code.qt.io/cgit/pyside/pyside-setup.git/tree/examples/declarative/extending/chapter2-methods/methods.py#n103 

      I don't understand the reason for this at all. The comment "Deleting the view before it goes out of scope is required to make sure all child QML instances are destroyed in the correct order." is more confusing than helping. As far as I understand the Python garbage collector, letting the variable going out of scope is actually the same as using the `del` statement. I tried a few examples (under Windows) commenting out the `del view` and nothing (bad) happens at exit.

      Is this really required for PySide2 QML applications? If yes, I would recommend getting rid of this requirement. `del` should only be used in the rarest cases (in Python) and should not be required for a default application.

      If this is not required (anymore) please clean up the code examples.

        Attachments

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

          Activity

            People

            Assignee:
            kleint Friedemann Kleint
            Reporter:
            schlamar schlamar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes