D23391: Clean up not needed Q_INVOKABLE

Kai Uwe Broulik noreply at phabricator.kde.org
Sat Aug 31 08:55:20 BST 2019


broulik accepted this revision.
broulik added a comment.
This revision is now accepted and ready to land.


  Lovely!

INLINE COMMENTS

> main.qml:97
>      Component.onCompleted: {
> -        currentBattery = kcm.batteries.get(0)
> -        currentVendor = kcm.batteries.vendor(0)
> -        currentProduct = kcm.batteries.product(0)
> -        currentUdi = kcm.batteries.udi(0)
> +        currentBattery = kcm.batteries.data(kcm.batteries.index(0, 0), BatteryModel.BatteryRole)
> +        currentVendor = kcm.batteries.data(kcm.batteries.index(0, 0), BatteryModel.VendorRole)

You could probably move that into a `function initCurrent()` or similar and call it in both this and the change handler

You can also probably cache the `index` in a variable to only query it once

REPOSITORY
  R102 KInfoCenter

BRANCH
  clean-up

REVISION DETAIL
  https://phabricator.kde.org/D23391

To: meven, broulik
Cc: plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20190831/cc77e8d6/attachment-0001.html>


More information about the Plasma-devel mailing list