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?
Forum Updated to NodeBB v4.3 + New Features

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.4k Views 1 Watching
  • 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 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 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 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 last edited by
          #4

          Thank you very much for this nice solution :-)

          1 Reply Last reply
          1

          • Login

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