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. SemiCircular Gauge in qml

SemiCircular Gauge in qml

Scheduled Pinned Locked Moved Solved QML and Qt Quick
10 Posts 4 Posters 2.4k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I want to represent a semi-circular gauge like this:
    0_1551865976453_SemicircleNGauge.png

    I found it in:
    https://doc.qt.io/qt-5/qml-qtquick-controls-styles-circulargaugestyle.html
    but there isn't the code..Can you help me?

    jsulmJ 1 Reply Last reply
    0
    • ? A Former User

      I want to represent a semi-circular gauge like this:
      0_1551865976453_SemicircleNGauge.png

      I found it in:
      https://doc.qt.io/qt-5/qml-qtquick-controls-styles-circulargaugestyle.html
      but there isn't the code..Can you help me?

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @vale88 I'm not sure I understand your question. What code do you mean and what help do you need? In the link you posted there is code. You just need to play a bit with the parameters.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Y Offline
        Y Offline
        Yaswanth
        wrote on last edited by
        #3

        You can achieve with this simple code,

            CircularGauge {
                anchors.centerIn: parent
                style: CircularGaugeStyle
                {
                    minimumValueAngle : -90
                    maximumValueAngle  : 90
                    needle:Rectangle
                    {
                        width: outerRadius * 0.02
                        height: outerRadius * 0.7
                        color: "Light Blue"
                    }
        
                    tickmarkLabel:Text
                    {
                        color:"Black"
                        text : styleData.value
                    }
                }
            }
        
        ? 1 Reply Last reply
        2
        • Y Yaswanth

          You can achieve with this simple code,

              CircularGauge {
                  anchors.centerIn: parent
                  style: CircularGaugeStyle
                  {
                      minimumValueAngle : -90
                      maximumValueAngle  : 90
                      needle:Rectangle
                      {
                          width: outerRadius * 0.02
                          height: outerRadius * 0.7
                          color: "Light Blue"
                      }
          
                      tickmarkLabel:Text
                      {
                          color:"Black"
                          text : styleData.value
                      }
                  }
              }
          
          ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          @Yaswanth thanks, I have an other question..and if I want to draw this?
          0_1551886510572_Cattura.PNG

          Y 1 Reply Last reply
          0
          • ? A Former User

            @Yaswanth thanks, I have an other question..and if I want to draw this?
            0_1551886510572_Cattura.PNG

            Y Offline
            Y Offline
            Yaswanth
            wrote on last edited by
            #5

            @vale88
            Set minimumValue & maximumValue to the CircularGauge and implement your own delegates for needle and foreground.

                CircularGauge {
                    anchors.centerIn: parent
                    minimumValue : -30
                    maximumValue : 30
                    style: CircularGaugeStyle
                    {
                        minimumValueAngle : -90
                        maximumValueAngle  : 90
            
                        needle:Item
                        {
            //                Rectangle
            //                {
            //                    width: outerRadius * 0.02
            //                    height: outerRadius * 0.7
            //                    color: "Light Blue"
            //                }
                        }
                        foreground: Item
                        {
            //                Rectangle {
            //                    width: outerRadius * 0.2
            //                    height: width
            //                    radius: width / 2
            //                    color: "#e5e5e5"
            //                    anchors.centerIn: parent
            //                }
                        }
            
                        tickmarkLabel:Text
                        {
                            color:"Black"
                            text : styleData.value
                        }
                    }
                }
            

            As @jsulm already mentioned, please explore the properties in the CircularGuage control. Please explain what is the difficulty you are facing.

            ? 1 Reply Last reply
            2
            • Y Yaswanth

              @vale88
              Set minimumValue & maximumValue to the CircularGauge and implement your own delegates for needle and foreground.

                  CircularGauge {
                      anchors.centerIn: parent
                      minimumValue : -30
                      maximumValue : 30
                      style: CircularGaugeStyle
                      {
                          minimumValueAngle : -90
                          maximumValueAngle  : 90
              
                          needle:Item
                          {
              //                Rectangle
              //                {
              //                    width: outerRadius * 0.02
              //                    height: outerRadius * 0.7
              //                    color: "Light Blue"
              //                }
                          }
                          foreground: Item
                          {
              //                Rectangle {
              //                    width: outerRadius * 0.2
              //                    height: width
              //                    radius: width / 2
              //                    color: "#e5e5e5"
              //                    anchors.centerIn: parent
              //                }
                          }
              
                          tickmarkLabel:Text
                          {
                              color:"Black"
                              text : styleData.value
                          }
                      }
                  }
              

              As @jsulm already mentioned, please explore the properties in the CircularGuage control. Please explain what is the difficulty you are facing.

              ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              @Yaswanth I have difficulty to connect my dial on mainWindow and circularGauge of Qml..I wrote : /ui->qml->setContextProperty("yourObject",ui->dial);

              but it doesn't write setContextProperty

              Pablo J. RoginaP 1 Reply Last reply
              0
              • ? A Former User

                @Yaswanth I have difficulty to connect my dial on mainWindow and circularGauge of Qml..I wrote : /ui->qml->setContextProperty("yourObject",ui->dial);

                but it doesn't write setContextProperty

                Pablo J. RoginaP Offline
                Pablo J. RoginaP Offline
                Pablo J. Rogina
                wrote on last edited by
                #7

                @vale88 said in SemiCircular Gauge in qml:

                mainWindow and circularGauge of Qml..I wrote : /ui->qml->setContextProperty("yourObject",ui->dial);

                Are you trying to use both QML and C++ objects at the same time for showing the dial? If so, it's a quite arrangement.

                Usually, you go with QML for the display and C++ for the backend providing the value that the dial should show...

                Upvote the answer(s) that helped you solve the issue
                Use "Topic Tools" button to mark your post as Solved
                Add screenshots via postimage.org
                Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                ? 1 Reply Last reply
                0
                • Pablo J. RoginaP Pablo J. Rogina

                  @vale88 said in SemiCircular Gauge in qml:

                  mainWindow and circularGauge of Qml..I wrote : /ui->qml->setContextProperty("yourObject",ui->dial);

                  Are you trying to use both QML and C++ objects at the same time for showing the dial? If so, it's a quite arrangement.

                  Usually, you go with QML for the display and C++ for the backend providing the value that the dial should show...

                  ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #8

                  @Pablo-J.-Rogina I don't know how to write the connect

                  Pablo J. RoginaP 1 Reply Last reply
                  0
                  • ? A Former User

                    @Pablo-J.-Rogina I don't know how to write the connect

                    Pablo J. RoginaP Offline
                    Pablo J. RoginaP Offline
                    Pablo J. Rogina
                    wrote on last edited by
                    #9

                    @vale88 Life is a learning path... and documentation is your friend.

                    Upvote the answer(s) that helped you solve the issue
                    Use "Topic Tools" button to mark your post as Solved
                    Add screenshots via postimage.org
                    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                    ? 1 Reply Last reply
                    1
                    • Pablo J. RoginaP Pablo J. Rogina

                      @vale88 Life is a learning path... and documentation is your friend.

                      ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #10

                      @Pablo-J.-Rogina I solved..there is documentation but it isn't enough

                      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