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. Border-Radius is not working with QProgressBar when value is 0.
Forum Update on Monday, May 27th 2025

Border-Radius is not working with QProgressBar when value is 0.

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 370 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.
  • I Offline
    I Offline
    IRADA
    wrote on 31 May 2024, 18:47 last edited by
    #1

    Hello,
    I'm using a ProgressBar for a timer but when the Width of the ProgressBar is less than the border-radius, it defaults to no border radius and shows a square.
    I tried to do it with a slider instead but that did not work either.
    Can I fix it somehow with CSS?
    Or maybe there's a workaround with a mask possibly?

    1000029318.jpg

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Markkyboy
      wrote on 1 Jun 2024, 17:56 last edited by
      #2

      Pasting some working code is always a good idea.

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

      I live by the sea, not in it.

      I 1 Reply Last reply 2 Jun 2024, 11:21
      0
      • M Markkyboy
        1 Jun 2024, 17:56

        Pasting some working code is always a good idea.

        I Offline
        I Offline
        IRADA
        wrote on 2 Jun 2024, 11:21 last edited by
        #3

        @Markkyboy my bad I didn't think it was necessary as It's a known CSS issue

        However I fixed it finally by using a Bitmap the same dimensions as the progress bar and setting it as a mask for the progress bar

        1 Reply Last reply
        0
        • I Offline
          I Offline
          IRADA
          wrote on 2 Jun 2024, 11:32 last edited by
          #4
                  bm = QBitmap(self.min10.size())
                  bm.fill(Qt.color0)
                  p = QPainter(bm)
                  p.setRenderHint(QPainter.HighQualityAntialiasing)
                  p.setPen(Qt.color1)
                  p.setBrush(Qt.color1)
                  radius = 21
                  p.drawRoundedRect(QRect(0,0,bm.width(),bm.height()),radius,radius)
                  p.end()
                  self.min10.setMask(bm)
          

          Thanks to a bug report from a decade ago

          Here is the result Screenshot 2024-06-02 165338.png

          1 Reply Last reply
          1
          • I IRADA has marked this topic as solved on 2 Jun 2024, 11:33

          1/4

          31 May 2024, 18:47

          • Login

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