Reset custom property value.
-
Hello,
I have a Button & Text. The Button has a toggle property when we click on it, acts like a toggle & displays the whole text message and off displays just one line with ...
My question is, is there any way to reset this value to controller.toggle if needed?
Switching back and forth to this qml component just takes the last value of toggle instead of resetting it to controller's value.Initially, I tried to set checkable to be true and used checked: controller.toggle and it worked but problem is screen reader reads it as checkbox instead of a button
Text { id: textbox maximumLineCount: toggleBtn.toggle ? 2 : 1 elide: Text.ElideRight wrapMode: Text.WordWrap textFormat: Text.StyledText text: controller.messageText } Button { id: toggleBtn property bool toggle: controller.toggle height: 24 width: 24 focus: visible visible: textBox.truncated || toggle iconName: toggle ? "arrow-up" : "arrow-down" onClicked: { toggle = !toggle; controller.onExpand(toggle); } }