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

qmllint: unqualified access to properties and ids outside the delegate

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Fixed
    • Affects Version/s: 6.2.3
    • Fix Version/s: None
    • Component/s: QML: Tooling
    • Labels:
      None
    • Platform/s:
      Linux/X11

      Description

      When I run qmlint it catches an error when trying to access a property or id outside of a delegate.

      For the modelData I added the required property.
      But it is not possible to set a required property for the id "page". Any object I try to access from outside results in "unqualified"

       

      import QtQuick
      import QtQuick.Controls
      
      import Rask.BluScan
      import App
      
      Page {
          id: page
      
          required property StackView stackView
          required property BluetoothController bluetoothController
      
          ListView {
              id: listViewDevices
      
              anchors.fill: parent
              property string test
      
              model: page.bluetoothController.devices
              delegate: ItemDevice {
                  required property BluetoothDevice modelData
                  device: modelData
      
      	    // When trying to access the id page the following error appears: DeviceDiscoveryPage.qml:24:24: Unqualified access
                  onClicked: page.stackView.push(Qt.resolvedUrl("DevicePage.qml"), {
                                                     "device": modelData,
                                                     "stackView": page.stackView
                                                 })
              }
          }
      
          footer: FooterBar {
              width: parent.width
              height: startDiscoveryButton.height + 10
      
              Button {
                  id: startDiscoveryButton
                  enabled: !page.bluetoothController.discovering
                  text: page.bluetoothController.discovering ? "Discovering..." : "Start discovery"
                  icon.name: enabled ? "bluetooth" : "bluetooth-searching"
                  highlighted: true
      
                  anchors.centerIn: parent
                  onClicked: page.bluetoothController.startDiscovering()
              }
          }
      }
      

       

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              qtqmlteam Qt Qml Team User
              Reporter:
              marssola Mauro Marssola
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes