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

Qt Sensors: qmllint warnings on runtime selected interfaces

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • 6.6
    • dev
    • Sensors
    • None
    • All

    Description

      The "QtSensors" Quick library provides access to the sensors data with:

      // sensorsquick/qmlsensor_p.h
      Q_PROPERTY(QmlSensorReading* reading READ reading NOTIFY readingChanged BINDABLE bindableReading) 

      Whereas the actual Sensors provides: Qml<Sensor>Reading during runtime by overriding the createReading function. For example:

      // sensorsquick/qmlmagnetometer_p.h
      QmlSensorReading *createReading() const override;
      ...
      QmlSensorReading *QmlMagnetometer::createReading() const
      {
          return new QmlMagnetometerReading(m_sensor);
      }
      

      If you would run qmllint on a minimal example like so:

      import QtSensors
      
      Magnetometer {
          property real mx
          property real my
          onReadingChanged: {
              mx = reading.x
              my = ((reading as MagnetometerReading).y)
          }
      } 
      
      // Produces:
      // Warning ~: Member "x" not found on type "QmlSensorReading" [missing property]
      //        mx = reading.x

      Using some magic to read into my resolves the warning. It is quite inconvenient, and its syntax is not easily understandable.

      Discussed in: https://codereview.qt-project.org/c/qt/qtsensors/+/472100

      Attachments

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

        Activity

          People

            cnn Qt Core & Network
            dennisoberst Dennis Oberst
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes