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

QSensor::active handling is buggy.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.2.0 Alpha
    • 5.12.6
    • Sensors
    • None
    • All

    Description

      void QSensor::setActive(bool active)
      {
          if (active == isActive())
              return;
          if (active)
              QTimer::singleShot(0, this, SLOT(start())); // delay ensures all properties have been set if using QML
          else
              stop();
      }
      
      Screen { // an Item with visible: false as default
      	id: proxScreen
      	onVisibleChanged: {
      		console.log("proxScreen.visible: "+ visible)
      	}
      
      	ProximitySensor { //F09
      		id: proximity
      		active:proxScreen.visible
      		onActiveChanged: {
      			console.log("proximity.active: "+ active)
      		}
      	}
      }
      

      Allows multiple queued starts/stops:

      qml: proxScreen.visible: false
      qml: proximity.active: false
      qml: proximity.active: false
      

      Looking at the QSensor::stop() code it is less clear how I can get multiple false activations, but even more puzzling, is why I get multiple false actives. The bound property (proxScreen.visible) only changed once. (But regardless the true or false I get double active changes)

      Attachments

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

        Activity

          People

            vuokko Juha Vuolle
            jasonapk Jason Hihn
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes