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. What is styleData in Dashboard example?

What is styleData in Dashboard example?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 276 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.
  • H Offline
    H Offline
    HolyHigh
    wrote on last edited by
    #1

    hi, everyone. I am new to QML, and learn QML through its example.
    When I look through the Dashboard example, I find there is a variate named StyleData which I can not find its declaration.

    //dashboard.qml line 140
    style: IconGaugeStyle {
     id: tempGaugeStyle
    
     icon: "qrc:/images/temperature-icon.png"
     maxWarningColor: Qt.rgba(0.5, 0, 0, 1)
     tickmarkLabel: Text {
        color: "white"
        visible: styleData.value === 0 || styleData.value === 1
        font.pixelSize: tempGaugeStyle.toPixels(0.225)
        text: styleData.value === 0 ? "C" : (styleData.value === 1 ? "H" : "")
      }
    ......
    }
    

    When i change the code into the follwo, it doesn`t work well .

    text: test1(styleData.value)
    function test1(datas){
                        if(datas===0) return "E"
                        else if(datas===0.25) return "M"
                        else if(datas===1) return "F"
                    }
    

    the gauge will not show these letters.
    So, I want to ask what is the styleData and What should I do to use it.

    MarkkyboyM 1 Reply Last reply
    0
    • H HolyHigh

      hi, everyone. I am new to QML, and learn QML through its example.
      When I look through the Dashboard example, I find there is a variate named StyleData which I can not find its declaration.

      //dashboard.qml line 140
      style: IconGaugeStyle {
       id: tempGaugeStyle
      
       icon: "qrc:/images/temperature-icon.png"
       maxWarningColor: Qt.rgba(0.5, 0, 0, 1)
       tickmarkLabel: Text {
          color: "white"
          visible: styleData.value === 0 || styleData.value === 1
          font.pixelSize: tempGaugeStyle.toPixels(0.225)
          text: styleData.value === 0 ? "C" : (styleData.value === 1 ? "H" : "")
        }
      ......
      }
      

      When i change the code into the follwo, it doesn`t work well .

      text: test1(styleData.value)
      function test1(datas){
                          if(datas===0) return "E"
                          else if(datas===0.25) return "M"
                          else if(datas===1) return "F"
                      }
      

      the gauge will not show these letters.
      So, I want to ask what is the styleData and What should I do to use it.

      MarkkyboyM Offline
      MarkkyboyM Offline
      Markkyboy
      wrote on last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • H HolyHigh has marked this topic as solved on

      • Login

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