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

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.15.1
    • Documentation, PySide
    • 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

            kleint Friedemann Kleint
            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