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 pass Analog value in QML

How to pass Analog value in QML

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 161 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.
  • Z Offline
    Z Offline
    Zapata_Matata
    wrote on last edited by SGaist
    #1
    import QtQuick 2.4
    import QtGraphicalEffects 1.0
    
    Rectangle {
        color: "transparent"
    
                  SpeedNeedle {
                      id: speedoNeedle
    
                           anchors.verticalCenterOffset: 0
                           anchors.centerIn: parent
    
                           focus: true
                           Keys.onPressed: {
                                    if (event.key == Qt.Key_Space && !event.isAutoRepeat) {
                                        speedoNeedle.value = 100
                                        kWNeedle.value = 0
                                        drive()
                                    }
                           }
                           Keys.onReleased: {
                                   if (event.key == Qt.Key_Space && !event.isAutoRepeat) {
                                       speedoNeedle.value = 0
                                       kWNeedle.value = 100
                                   }}}
    
                  KWNeedle {
                      id: kWNeedle
                      anchors.verticalCenterOffset: 0
                      anchors.centerIn: parent
                      value: 100
                  }
    
    
                  InnerRing    {
                    id: innerring
                    speed: (Math.round(speedoNeedle.currentValue, 0) + 360) * 0.68
                  }
    
                  //Letter: P R N D
                  Grid {
                      anchors.horizontalCenter: parent.horizontalCenter
                      y: parent.height - 65
                      columns: 4
                       Rectangle { color: "transparent"; width: 25; height: 25
                          Text {
                              id: letterP
                              text: " P "
                               font.family: "Eurostile"; font.pixelSize: 36
                              color: "white"
                              anchors.centerIn: parent
                          } }
                        Rectangle { color: "transparent"; width: 25; height: 25
                          Text {
                              text: " R "
                               font.family: "Eurostile"; font.pixelSize: 18
                              color: "darkgray"
                              anchors.centerIn: parent
                          }}
                        Rectangle { color: "transparent"; width: 25; height: 25
                              Text {
                                  text: " N "
                                   font.family: "Eurostile"; font.pixelSize: 18
                                  color: "darkgray"
                                  anchors.centerIn: parent
                              }}
                        Rectangle { color: "transparent"; width: 25; height: 25
                          Text {
                              id: letterD
                              text: " D "
                              font.family: "Eurostile"; font.pixelSize: 18
                              color: "darkgray"
                              anchors.centerIn: parent
                          }}
                  }
    
                  function drive() {
                      letterD.font.bold = true
                      letterD.color = "white"
                      letterD.font.pixelSize = 36
                      letterP.font.bold = false
                      letterP.color = "darkgray"
                      letterP.font.pixelSize = 18
                  }
    
    
     }
    

    This beautiful project is done by Alex [and i wanted to use this in my Motorcycle as a Speedo for general testing (Not Replacing my Analog Speedo)
    So Right now I have a working LCD+RASP 4 and Alex Build Project on Which I would Like to Communicate it with GPIO and Analog . I would be please if someone would spare their time to help me out.

    1 Reply Last reply
    0

    • Login

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