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. QML Circular slider
Qt 6.11 is out! See what's new in the release blog

QML Circular slider

Scheduled Pinned Locked Moved Solved QML and Qt Quick
14 Posts 5 Posters 7.7k Views 2 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.
  • Naveen_DN Offline
    Naveen_DN Offline
    Naveen_D
    wrote on last edited by
    #4

    Hi all, can anyone please suggest me how to customize Dial in QML ?

    Naveen_D

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #5

      Hi @Naveen_D
      Dial was added in Qt 5.7. Which Dial are you referring in Qt 5.6 ?

      157

      Naveen_DN 1 Reply Last reply
      2
      • p3c0P p3c0

        Hi @Naveen_D
        Dial was added in Qt 5.7. Which Dial are you referring in Qt 5.6 ?

        Naveen_DN Offline
        Naveen_DN Offline
        Naveen_D
        wrote on last edited by
        #6

        @p3c0 i am using Dial which is since Qt 5.5

        Naveen_D

        1 Reply Last reply
        1
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #7

          @Naveen_D Ok so you are using the labs version which is now in QtQuick Extras. So far how much were you able to customize DialStyle ?

          157

          Naveen_DN 1 Reply Last reply
          1
          • p3c0P p3c0

            @Naveen_D Ok so you are using the labs version which is now in QtQuick Extras. So far how much were you able to customize DialStyle ?

            Naveen_DN Offline
            Naveen_DN Offline
            Naveen_D
            wrote on last edited by
            #8

            @p3c0 Sir i tried with background, handle as given in the assistant, but i didn't get the output so i wanted an example how to make customizable dial using dial style. so that i can refer the example and try to make changes.

            Naveen_D

            1 Reply Last reply
            0
            • p3c0P Offline
              p3c0P Offline
              p3c0
              Moderators
              wrote on last edited by
              #9

              @Naveen_D You can try the CircularGauge's styling example.
              https://doc.qt.io/qt-5/styling-circulargauge.html#styling-circulargauge-background
              https://doc.qt.io/qt-5/styling-circulargauge.html#styling-circulargauge-foreground

              157

              Naveen_DN 1 Reply Last reply
              2
              • p3c0P p3c0

                @Naveen_D You can try the CircularGauge's styling example.
                https://doc.qt.io/qt-5/styling-circulargauge.html#styling-circulargauge-background
                https://doc.qt.io/qt-5/styling-circulargauge.html#styling-circulargauge-foreground

                Naveen_DN Offline
                Naveen_DN Offline
                Naveen_D
                wrote on last edited by
                #10

                @p3c0 i want to develop a volume type module for music player. can i develop using this ?

                Naveen_D

                1 Reply Last reply
                0
                • p3c0P Offline
                  p3c0P Offline
                  p3c0
                  Moderators
                  wrote on last edited by p3c0
                  #11

                  @Naveen_D Sure. Just try customizing them as per the given links.
                  Here's a small example according to it:

                  Dial {
                          width: 200
                          height: 200
                  
                          style: DialStyle {
                  
                              function degreesToRadians(degrees) {
                                  return degrees * (Math.PI / 180);
                              }
                  
                              background: Canvas {
                                  onPaint: {
                                      var ctx = getContext("2d");
                                      ctx.reset();
                  
                                      ctx.beginPath();
                                      ctx.strokeStyle = "#e34c22";
                                      ctx.lineWidth = outerRadius * 0.02;
                  
                                      ctx.arc(outerRadius, outerRadius, outerRadius - ctx.lineWidth / 2,
                                          degreesToRadians(valueToAngle(80) - 90), degreesToRadians(valueToAngle(100) - 90));
                                      ctx.stroke();
                                  }
                              }
                  
                              handle: Rectangle {
                                  width: outerRadius * 0.3
                                  height: outerRadius * 0.3
                                  radius: width/2.0
                                  color: "green"
                              }
                  
                              handleInset: outerRadius * 0.25
                  
                          }
                      }
                  

                  157

                  Naveen_DN 1 Reply Last reply
                  3
                  • p3c0P p3c0

                    @Naveen_D Sure. Just try customizing them as per the given links.
                    Here's a small example according to it:

                    Dial {
                            width: 200
                            height: 200
                    
                            style: DialStyle {
                    
                                function degreesToRadians(degrees) {
                                    return degrees * (Math.PI / 180);
                                }
                    
                                background: Canvas {
                                    onPaint: {
                                        var ctx = getContext("2d");
                                        ctx.reset();
                    
                                        ctx.beginPath();
                                        ctx.strokeStyle = "#e34c22";
                                        ctx.lineWidth = outerRadius * 0.02;
                    
                                        ctx.arc(outerRadius, outerRadius, outerRadius - ctx.lineWidth / 2,
                                            degreesToRadians(valueToAngle(80) - 90), degreesToRadians(valueToAngle(100) - 90));
                                        ctx.stroke();
                                    }
                                }
                    
                                handle: Rectangle {
                                    width: outerRadius * 0.3
                                    height: outerRadius * 0.3
                                    radius: width/2.0
                                    color: "green"
                                }
                    
                                handleInset: outerRadius * 0.25
                    
                            }
                        }
                    
                    Naveen_DN Offline
                    Naveen_DN Offline
                    Naveen_D
                    wrote on last edited by
                    #12

                    @p3c0 Thank you so much for your help. Now i got an idea.

                    Naveen_D

                    R 1 Reply Last reply
                    1
                    • Naveen_DN Naveen_D

                      @p3c0 Thank you so much for your help. Now i got an idea.

                      R Offline
                      R Offline
                      Ratataplam
                      wrote on last edited by
                      #13

                      @Naveen_D Can you share your solution if possible? Thanks in advance

                      MarkkyboyM 1 Reply Last reply
                      0
                      • R Ratataplam

                        @Naveen_D Can you share your solution if possible? Thanks in advance

                        MarkkyboyM Offline
                        MarkkyboyM Offline
                        Markkyboy
                        wrote on last edited by
                        #14

                        @Ratataplam - You can glean much info from this github account. I have used this for purposes of creating speedometers;

                        https://github.com/arunpkqt/CircularSlider

                        Don't just sit there standing around, pick up a shovel and sweep up!

                        I live by the sea, not in it.

                        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