D13931: [KCM] Add speaker placement test
David Rosca
noreply at phabricator.kde.org
Wed Jul 11 17:00:52 BST 2018
drosca added a comment.
In D13931#290544 <https://phabricator.kde.org/D13931#290544>, @nicolasfella wrote:
> I can get the PulseObject, that is not the problem, the problem is that I can't access the model outside of a delegate. model[index] does not work because QAbstractItemModel does not implement the {} operator.
What is `{} operator`?
> It only works with QList-based models. Therefore I introduced the get function to the model. This has the limitation that I don't have an notify signal for it. Therefore I use the notify signal of the changed property to force a reevaluate of the properties that depend on "get". It's a hacky solution, but I didn't find a better one.
Still I don't see the issue, the only problem that you would have is that your binding is on JavaScript list (`indexOf`) and when this list changes it wouldn't get re-evaluated. But it will never be the case, because channels are constant AND the other binding is on `speakersview.currentIndex` so this will take care of re-evaluating the binding when changing current device in combobox.
Anyway, you should be able to replace C++ `get` with
var index = sinkmodel.index(speakersview.currentIndex, 0);
var role = sinkmode.role("PulseObject"); // This is extension in our AbstractModel
var pulseObject = sinkmodel.data(index, role);
REPOSITORY
R115 Plasma Audio Volume Applet
REVISION DETAIL
https://phabricator.kde.org/D13931
To: nicolasfella, drosca
Cc: ngraham, #vdg, plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180711/f71394f7/attachment.html>
More information about the Plasma-devel
mailing list