D23152: [energy kcm] Display Vendor and model
Kai Uwe Broulik
noreply at phabricator.kde.org
Fri Aug 23 14:16:21 BST 2019
broulik added inline comments.
INLINE COMMENTS
> batterymodel.h:47
> Q_INVOKABLE Solid::Battery *get(int index) const;
> + Q_INVOKABLE QString vendor(int index) const;
> + Q_INVOKABLE QString product(int index) const;
As a cleanup measure (before or after, but separate of this patch), can you remove those separate invokables
1. Add `Q_ENUM(Roles)`
2. `qmlRegisterUncreatableType` the `BatteryModel`
3. from QML use `data()` which is invokable since Qt 5.5 (after this code was written iirc):
kcm.batteries.data(kcm.batteries.index(0, 0), BatteryModel.VendorRole)
> main.qml:432
> + if (modelData.source) {
> + if (modelData.source == "vendor") {
> + value = currentVendor;
Can you make this more generic, e.g.
value = root["current" + uppercasefirst(modelData.source)]
REPOSITORY
R102 KInfoCenter
BRANCH
arcpatch-D23152
REVISION DETAIL
https://phabricator.kde.org/D23152
To: meven, broulik, ngraham
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/20190823/202e9f1a/attachment-0001.html>
More information about the Plasma-devel
mailing list