← Back to team overview

ubuntu-sdk-bugs team mailing list archive

[Bug 1646080] Re: Mir-backed InputDeviceModel’s count property is not updated timely

 

** Changed in: qtsystems-opensource-src (Ubuntu)
   Importance: Undecided => High

** Changed in: qtsystems-opensource-src (Ubuntu)
       Status: New => In Progress

-- 
You received this bug notification because you are a member of Ubuntu
SDK bug tracking, which is subscribed to qtsystems-opensource-src in
Ubuntu.
https://bugs.launchpad.net/bugs/1646080

Title:
  Mir-backed InputDeviceModel’s count property is not updated timely

Status in qtsystems-opensource-src package in Ubuntu:
  In Progress

Bug description:
  I’m trying to use InputDeviceModel from QML with the following
  example:

  import QtQuick 2.4
  import QtSystemInfo 5.5
  Item {
    InputDeviceModel {
      id: idm
      filter: InputInfo.Mouse
      onCountChanged: console.log("mice model count:", devices, count)
      onAdded: console.log("added mouse:", inputDevice, count)
      onRemoved: console.log("removed mouse:", deviceId, count)
    }
    readonly property bool hasMouse: idm.count > 0
    onHasMouseChanged: console.log("has mouse:", hasMouse)
  }

  When I launch the example with qmlscene on my arale with no mouse
  connected, I’m not seeing any output (expected).

  Then I connect a bluetooth keyboard/mouse combo, and I’m seeing the following:
    mice model count: 1 0
    added mouse: QInputDevice(0x17f6298) 1
    (note how 'hasMouse', which supposedly was initially false, hasn’t been updated)

  Then I disconnect the combo, and I’m seeing the following:
    mice model count: 0 1
    has mouse: true
    removed mouse: 15 0

  Then I connect it again, and I’m seeing the following:
    mice model count: 1 0
    has mouse: false
    added mouse: QInputDevice(0x18ee508) 1

  It appears the countChanged property is emitted before a device is
  added to/removed from the model, and thus the row count hasn’t
  actually been updated yet. So any property binding that relies on
  'count' will have an incorrect value.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/qtsystems-opensource-src/+bug/1646080/+subscriptions


References