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

Authored by crossi on Oct 24 2019, 12:01 PM.

Details

Reviewers
ervin
mart
bport
Group Reviewers
Plasma
Test Plan

Inside Configure Icons and Toolbars popup menu, change some value in combobox, hit apply, then defaults, values inside combobx should be restored

Diff Detail

Repository
R119 Plasma Desktop
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 18171
Build 18189: arc lint + arc unit
crossi created this revision.Oct 24 2019, 12:01 PM
Restricted Application added a project: Plasma. · View Herald TranscriptOct 24 2019, 12:01 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
crossi requested review of this revision.Oct 24 2019, 12:01 PM
ervin requested changes to this revision.Oct 25 2019, 1:26 PM
ervin added inline comments.
kcms/style/package/contents/ui/EffectSettingsPopup.qml
77

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()
This revision now requires changes to proceed.Oct 25 2019, 1:26 PM

Hm I think qqc2-desktop-style breaks the binding on currentIndex, otherwise this would not be neccessary...

ervin added a comment.Oct 25 2019, 2:06 PM

Hm I think qqc2-desktop-style breaks the binding on currentIndex, otherwise this would not be neccessary...

Good point... What about fixing that? AFAICT it won't be pretty though. :-)

AFAICT it won't be pretty though. :-)

I think it's pretty straightforward
1.) the delegate must not explicitly set a currentIndex because Qt does it for us, see D18299
2.) the wheel handler must be changed to call decrementCurrentIndex() and incrementCurrentIndex() (hopefully they wrap...) instead of changing the index manually, so it doesn't break the binding.

ervin added a comment.Oct 25 2019, 2:18 PM

AFAICT it won't be pretty though. :-)

I think it's pretty straightforward
1.) the delegate must not explicitly set a currentIndex because Qt does it for us, see D18299
2.) the wheel handler must be changed to call decrementCurrentIndex() and incrementCurrentIndex() (hopefully they wrap...) instead of changing the index manually, so it doesn't break the binding.

Ah somehow I thought we had a third more "clever" case of currentIndex moving. Then indeed if that's just those two we should be fine.

crossi updated this revision to Diff 68748.EditedOct 25 2019, 2:25 PM

refactor code inside a function

Ah somehow I thought we had a third more "clever" case of currentIndex moving.

Heh, yea, there's also some more elaborate "change index while moving the mouse" going on :(
So best hack would be to have a c++ thing that sets the property without going through QML's binding system :D

ervin added a comment.Oct 25 2019, 2:40 PM

Ah somehow I thought we had a third more "clever" case of currentIndex moving.

Heh, yea, there's also some more elaborate "change index while moving the mouse" going on :(
So best hack would be to have a c++ thing that sets the property without going through QML's binding system :D

So we're back on the "but it's not going to be pretty" department. ;-)

ervin added a comment.Oct 25 2019, 2:42 PM

Style wise, functions come before children objects. Other than that looks good to me.

Through Kai comments, the question also becomes, wouldn't it be better to fix the root cause? It's likely we'll encounter that ComboBox breakage at other places.

crossi updated this revision to Diff 68755.Oct 25 2019, 3:01 PM

qml style

ervin added a comment.Oct 30 2019, 2:03 PM

Once we got D25000 completed, please remember to abandon that one.

crossi abandoned this revision.EditedOct 31 2019, 9:58 AM

Fixed by D25000