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

QtObject properties not recognized by compiler

    XMLWordPrintable

Details

    Description

       Using constructs like

      import QtQuick
      
      Window {
          width: 640
          height: 480
          visible: true
          title: "Girl, you know it's " + root.active
      
          QtObject {
              id: root
              readonly property bool active: error.isActive
      
              readonly property QtObject error: QtObject {
                  property bool isActive: true
              }
          }
      }

      results in

      Warning: main.qml:11:46: Property "isActive" not found on type "QObject"
              readonly property bool active: error.isActive
                                                   ^^^^^^^^
      Error: main.qml:11:46: Could not compile binding for active: Cannot load property isActive from QObject of (component in /home/prcs1076/tmp/build-undefined-Desktop_Qt_6_4_1_GCC_64bit-Debug/main.qml)::error with type QObject.
              readonly property bool active: error.isActive
                                                   ^^^^^^^^

      . While it works, it's unclear what type to use in the property definition to make the error disappear.

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            cajus Cajus Pollmeier
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes