How to change color for inactive status of StatusIndicator?
Solved
QML and Qt Quick
-
wrote on 29 Oct 2015, 14:17 last edited by
Hi,
I am completely new to QML.I would like to change the color for the inactive status of a StatusIndicator to red:
import QtQuick 2.2 import QtQuick.Extras 1.4 StatusIndicator { anchors.centerIn: parent color: "green" //Status active //color2: "red" //Status inactive }
How can I do this?
Thank you very much :-) -
wrote on 29 Oct 2015, 20:38 last edited by
I think you'll have to write a Style to do that. You can probably just take the existing Style from the source and tweak it. Look for StatusIndicatorStyle.qml in your installation.
-
wrote on 30 Oct 2015, 10:43 last edited by
StatusIndicator { id: statusI active: true property bool rlyActive anchors.centerIn: parent color: rlyActive ? "green" : "red" //Status active //color2: "red" //Status inactive MouseArea { anchors.fill: parent onClicked: statusI.rlyActive = !statusI.rlyActive } }
-
wrote on 30 Oct 2015, 12:15 last edited by
Thank you very much for this nice solution :-)
3/4