Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to change color for inactive status of StatusIndicator?

How to change color for inactive status of StatusIndicator?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qtquick.extrasproperties
4 Posts 3 Posters 2.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RolBri
    wrote on 29 Oct 2015, 14:17 last edited by
    #1

    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 :-)

    1 Reply Last reply
    0
    • X Offline
      X Offline
      xargs1
      wrote on 29 Oct 2015, 20:38 last edited by
      #2

      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.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kofr
        wrote on 30 Oct 2015, 10:43 last edited by
        #3
        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
                   }
               }
        
        1 Reply Last reply
        1
        • R Offline
          R Offline
          RolBri
          wrote on 30 Oct 2015, 12:15 last edited by
          #4

          Thank you very much for this nice solution :-)

          1 Reply Last reply
          1

          1/4

          29 Oct 2015, 14:17

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved