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

Loader loads it's contents even when the new active property is set to false

    XMLWordPrintable

Details

    • 0db214e51ac36d5ce5499c52cf4054b81e910bbb

    Description

      New active property allows convenient syntax for conditionally loading content inside QML application. Unfortunately it doesn't work as you would expect: Loader loads it's contents even when active property is set to false. Loader source component should never be executed in the below code example, but currently it is because QSGLoader::componentComplete() always loads the sourceComponent if it has been defined.

      import QtQuick 2.0
      
      Rectangle {
          color: "blue"
          width: 100; height: 100
          Loader {
              active: false
              anchors.fill: parent
              sourceComponent: Rectangle { color: "red" }
              onLoaded: console.log("Source loaded")
          }
      }
      

      Attachments

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

        Activity

          People

            chriadam Christopher Adams (closed Nokia identity) (Inactive)
            jpetrell Joona Petrell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes