D24916: KCM style : fix combobox that weren't updated after user made change

Kevin Ottens noreply at phabricator.kde.org
Fri Oct 25 14:26:49 BST 2019


ervin requested changes to this revision.
ervin added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> EffectSettingsPopup.qml:72
> +                onMainToolBarStyleChanged: {
> +                    mainToolBarStyleCombo.currentIndex = mainToolBarStyleCombo.model.findIndex(function (item) {
> +                        return item.value === kcm.mainToolBarStyle

To de-duplicate a bit, because now that's 4 times (almost) the same piece of code. What about having a function resetIndex() declared in that combo and another one in the other combobox which would do the currentIndex + findIndex dance.

This way in both the code would become in both cases:

  currentIndex: resetIndex()
  ...
      onFooStyleChanged: fooStyleCombo.resetIndex()

REPOSITORY
  R119 Plasma Desktop

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

To: crossi, #plasma, ervin, mart, bport
Cc: plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20191025/a22d6664/attachment.html>


More information about the Plasma-devel mailing list