D25000: Do not assign combobox currentIndex as it breaks binding.

Kevin Ottens noreply at phabricator.kde.org
Wed Oct 30 17:57:26 GMT 2019


ervin added inline comments.

INLINE COMMENTS

> davidedmundson wrote in kpropertywriter_p.h:26
> Throwing out another option
> 
>   class KPropertyWriter : public QObject, public QQmlPropertyValueSource
>   {
>       Q_INVOKABLE bool writeProperty(QVariant value);
>   }
>   
>   writeProperty(QVariant) {
>     object()->setProperty(name(), value());
>     // we can't use property().write() as that'll break the binding
>   }
>   
>   
>   PropertyWriter on currentIndex {
>      id: controlRootWriter
>   }
> 
> Though it's basically the same thing, so don't feel you have to, just wanted to share the suggestion as it reduces two properties.

Didn't think about that one, clever trick indeed. :-)

That being said I think it'd be more work in the end, indeed setTarget is pure virtual in there, and also I'm not sure that calling write() on QQmlProperty doesn't break bindings.

REPOSITORY
  R858 Qt Quick Controls 2: Desktop Style

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

To: crossi, #plasma, ervin, mart, bport, broulik
Cc: davidedmundson, 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/20191030/c1a7e3ba/attachment.html>


More information about the Plasma-devel mailing list