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

QSensor::active handling is buggy.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.12.6
    • Fix Version/s: 6.2.0 Alpha
    • Component/s: Sensors
    • Labels:
      None
    • Platform/s:
      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

        For Gerrit Dashboard: QTBUG-80755
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            vuokko Juha Vuolle
            Reporter:
            jasonapk Jason Hihn
            PM Owner:
            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