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

Arc gauge

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
17 Posts 6 Posters 3.4k Views 4 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.
  • M Mark81

    @raven-worx said in Arc gauge:

    Those 2 sentences are a contradiction no?

    At all.
    The pictures are generated, say, with Photoshop changing their color. So if I use them I'm sure they can overlap perfectly each other. On the other hand, if I manually draw both scales, I'm also sure they fit together but it would be harder to reproduce all the graphics effects (and the graphic guy cannot update the images himself - as he requires).

    What I meant with my sentences is it would not work if you use a mix the two approaches - as I thought (wrongly) you suggested before.

    So you want a solution which automagically does everything you need with least effort?

    Uh? I don't understand this question.
    If you see the "QtQuick control extras example" you can find how the CircularGauge is made. For the needle they used a png that rotates according to the requested value. Of course they can draw the needle by hand too, but as said this approach has several
    drawbacks. I don't think its a matter of "doing something automagically" but just to understand how to use the QML tools.

    J.HilkJ Offline
    J.HilkJ Offline
    J.Hilk
    Moderators
    wrote on last edited by
    #7

    @Mark81 I think, this will get complicated quite quickly, if you want to do it in pure qml & canvas.

    I would suggest looking into subclassing QQuickPaintedItem that way you can just partially draw the 2nd image, depending on your gauge value.


    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


    Q: What's that?
    A: It's blue light.
    Q: What does it do?
    A: It turns blue.

    M 1 Reply Last reply
    1
    • M Mark81

      @raven-worx said in Arc gauge:

      If you want to work with images (and all it's problems, like blurring etc) the only thing you need is the Image element and probably some effects or masks.

      Yep, and this is the only thing I don't know how to do in this case. Hence my question :-)

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #8

      @Mark81 said in Arc gauge:

      Yep, and this is the only thing I don't know how to do in this case. Hence my question :-)

      assuming your images are identical in size:

      Image {
         source: "qrc/background.png"
      
         Image {
             source: "qrc:/foreground.png"
         }
      }
      

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      M 1 Reply Last reply
      0
      • J.HilkJ J.Hilk

        @Mark81 I think, this will get complicated quite quickly, if you want to do it in pure qml & canvas.

        I would suggest looking into subclassing QQuickPaintedItem that way you can just partially draw the 2nd image, depending on your gauge value.

        M Offline
        M Offline
        Mark81
        wrote on last edited by
        #9

        @J.Hilk said in Arc gauge:
        that way you can just partially draw the 2nd image, depending on your gauge value.

        Interesting. Following your approach could not be even easier to draw the colored scale into a Shape element with clip property true. The shape will be a trapezoid with an inclined side starting from the center of the gauges (bound to the value property).

        I would try it when I understand why "module "QtQuick.Shapes" version 1.12 is not installed" on my system!

        1 Reply Last reply
        0
        • raven-worxR raven-worx

          @Mark81 said in Arc gauge:

          Yep, and this is the only thing I don't know how to do in this case. Hence my question :-)

          assuming your images are identical in size:

          Image {
             source: "qrc/background.png"
          
             Image {
                 source: "qrc:/foreground.png"
             }
          }
          
          M Offline
          M Offline
          Mark81
          wrote on last edited by
          #10

          @raven-worx this does nothing but paints one image one on top of the other....

          raven-worxR 1 Reply Last reply
          0
          • M Mark81

            @raven-worx this does nothing but paints one image one on top of the other....

            raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #11

            @Mark81 said in Arc gauge:

            @raven-worx this does nothing but paints one image one on top of the other....

            i thought you get a separate image for each possible value.

            If you want to keep going the QML-only way take a look at OpacityMask
            Again for the mask shape you can use a Canvas element drawing an arc to cover the unneeded sectors.

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            M 1 Reply Last reply
            3
            • raven-worxR raven-worx

              @Mark81 said in Arc gauge:

              @raven-worx this does nothing but paints one image one on top of the other....

              i thought you get a separate image for each possible value.

              If you want to keep going the QML-only way take a look at OpacityMask
              Again for the mask shape you can use a Canvas element drawing an arc to cover the unneeded sectors.

              M Offline
              M Offline
              Mark81
              wrote on last edited by
              #12

              @raven-worx said in Arc gauge:

              If you want to keep going the QML-only way take a look at OpacityMask
              Again for the mask shape you can use a Canvas element drawing an arc to cover the unneeded sectors.

              Got it. This is a good advice. I'm going to try it and I'll report back the result.
              Thanks for the patience!

              1 Reply Last reply
              0
              • MarkkyboyM Offline
                MarkkyboyM Offline
                Markkyboy
                wrote on last edited by
                #13

                Hi Mark81 - did you achieve your goal?, I realise this question is around 5 years old, but I'm curious to know if you found/created a solution?

                I have created similar software using CircularSlider/Progress (https://github.com/arunpkio/CircularSlider) with a Repeater, including using Canvas for added circular effects.

                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
                • JKSHJ Offline
                  JKSHJ Offline
                  JKSH
                  Moderators
                  wrote on last edited by JKSH
                  #14

                  Qt 6.8 has just what the doctor ordered (see https://www.youtube.com/watch?v=iXLoC06CKOc):

                  Demo of Qt Quick Effect Maker

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  MarkkyboyM 1 Reply Last reply
                  3
                  • JKSHJ JKSH

                    Qt 6.8 has just what the doctor ordered (see https://www.youtube.com/watch?v=iXLoC06CKOc):

                    Demo of Qt Quick Effect Maker

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

                    @JKSH - Nice!, going to play with that later. Have already developed something similar under Qt 5.6. Not as posh as this one though!

                    Next step, new PC, tablet, monitors and an upgrade to QT6!

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

                    I live by the sea, not in it.

                    Pl45m4P 1 Reply Last reply
                    0
                    • MarkkyboyM Markkyboy

                      @JKSH - Nice!, going to play with that later. Have already developed something similar under Qt 5.6. Not as posh as this one though!

                      Next step, new PC, tablet, monitors and an upgrade to QT6!

                      Pl45m4P Offline
                      Pl45m4P Offline
                      Pl45m4
                      wrote on last edited by
                      #16

                      @Markkyboy said in Arc gauge:

                      Nice!, going to play with that later.

                      Note: 6.8 is still in Beta phase. Final release will be around the end of Sept. with a probably more stable version 6.8.1 even later.


                      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                      ~E. W. Dijkstra

                      MarkkyboyM 1 Reply Last reply
                      1
                      • Pl45m4P Pl45m4

                        @Markkyboy said in Arc gauge:

                        Nice!, going to play with that later.

                        Note: 6.8 is still in Beta phase. Final release will be around the end of Sept. with a probably more stable version 6.8.1 even later.

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

                        @Pl45m4 - thanks for the info. By the time I've bought new electronica, it'll likely be available.

                        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