Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. how to draw double border around qprogress bar ?
Forum Updated to NodeBB v4.3 + New Features

how to draw double border around qprogress bar ?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
6 Posts 5 Posters 583 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.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by
    #1

    i want make make battery indicator symbol using progress bar. i want below questions regarding that :

    1] how to draw black and white border around q progress bar ?

    Battery.png

    2] how to draw custom border like above image around progress bar ?

    3] please provide answer with example

    jsulmJ J.HilkJ 2 Replies Last reply
    -1
    • Q Qt embedded developer

      i want make make battery indicator symbol using progress bar. i want below questions regarding that :

      1] how to draw black and white border around q progress bar ?

      Battery.png

      2] how to draw custom border like above image around progress bar ?

      3] please provide answer with example

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

      @Qt-embedded-developer Sounds to me like a job for a custom (QWidget) class with its own paintEvent override

      much cleaner than fiddling with Stylesheets, Qlabels and QProgressbars to make this work

      at least in my opinion


      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.

      1 Reply Last reply
      3
      • Q Qt embedded developer

        i want make make battery indicator symbol using progress bar. i want below questions regarding that :

        1] how to draw black and white border around q progress bar ?

        Battery.png

        2] how to draw custom border like above image around progress bar ?

        3] please provide answer with example

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

        @Qt-embedded-developer said in how to draw double border around qprogress bar ?:

        please provide answer with example

        I will not provide examples, that's up to you to write the code.

        What you can do is simple: put an image (QLabel) showing this battery, over that image you put the progress bar, that's it...

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

        JonBJ Q 2 Replies Last reply
        4
        • jsulmJ jsulm

          @Qt-embedded-developer said in how to draw double border around qprogress bar ?:

          please provide answer with example

          I will not provide examples, that's up to you to write the code.

          What you can do is simple: put an image (QLabel) showing this battery, over that image you put the progress bar, that's it...

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #3

          @jsulm
          Agreed, but could we have a hint about this bit:

          over that image you put the progress bar

          Do we draw the progress into the battery image? You're not talking about "super-imposing" a QProgressBar widget over the QLabel widget, are you? (I don't know whether you can put widgets in the same place, with a z-order and transparency.)

          1 Reply Last reply
          1
          • Q Qt embedded developer

            i want make make battery indicator symbol using progress bar. i want below questions regarding that :

            1] how to draw black and white border around q progress bar ?

            Battery.png

            2] how to draw custom border like above image around progress bar ?

            3] please provide answer with example

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

            @Qt-embedded-developer Sounds to me like a job for a custom (QWidget) class with its own paintEvent override

            much cleaner than fiddling with Stylesheets, Qlabels and QProgressbars to make this work

            at least in my opinion


            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.

            1 Reply Last reply
            3
            • jsulmJ jsulm

              @Qt-embedded-developer said in how to draw double border around qprogress bar ?:

              please provide answer with example

              I will not provide examples, that's up to you to write the code.

              What you can do is simple: put an image (QLabel) showing this battery, over that image you put the progress bar, that's it...

              Q Offline
              Q Offline
              Qt embedded developer
              wrote on last edited by
              #5

              @jsulm yes that idea i already have but i want to make custom widget so if there is any reference ebook is there then please provide so i can upgrade my knowledge to make custom widget.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SimonSchroeder
                wrote on last edited by
                #6

                Just as @J-Hilk said: You create a class that derives from QWidget and then override its paintEvent method. Have a look at the documentation of Qt how to do your own painting in paintEvent. Most likely you need a member variable inside your custom class that knows the current percentage which could then be used during painting.

                1 Reply Last reply
                3

                • Login

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