ngraham added inline comments.

INLINE COMMENTS

> niccolove wrote in FullRepresentation.qml:31
> I though that was done by
> 
>   toolbar.visible = (state == "DevicesState" || state == "NoDevicesState");
> 
> At the end of the file. If you try to use the widget standalone, you will 
> notice that it does disappear. Problem is, system tray doesn't notice. I 
> can't understand why it doesn't read the ".visible" property.

It's because the binding is broken.

In QML, there are two ways to change a property: with a binding, or 
imperatively.

A binding uses a colon, and looks like this: `visible: (state == "DevicesState" 
|| state == "NoDevicesState")` You want to use binding as much as possible 
because the property being bound (`visible`) will auto-update when the 
condition changes.

Imparative code uses an equals sign: `toolbar.visible = (state == 
"DevicesState" || state == "NoDevicesState");`

This breaks any existing bindings, which means you become responsible for 
manually updating the property in question `toolbar.visible` whenever you want 
it to change. Theoretically that's taken care of by `onStateChanged:` but for 
some reason it doesn't seem to be working. Perhaps there's a state not 
accounted for there? In general I don't like using explicit `State`s though. I 
find that it leads to messy, imperative code.

REPOSITORY
  R97 Bluedevil

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

To: niccolove, #plasma, ngraham
Cc: ngraham, plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, 
jraleigh, zachus, fbampaloukas, ragreen, ZrenBot, himcesjf, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart

Reply via email to