Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QProgressBar - Chunk round corners instead of rectangular



  • Hey All,

    I currently am having trouble with an issue with QProgressbar. I have created a progressbar that has rounded corners, but the QProgressBar:: Chunk can't seem to round off at the edges...
    Attached below is my code and a picture for all to see!

    QProgressBar {
        border: 2px solid grey;
        border-radius: 10px;
        text-align: center;
    }
    
    QProgressBar::chunk {
        background-color: #00FF7F;
        width: 10px;
        margin: 0.5px;
        border-bottom-right-radius: 10px;
        border-bottom-left-radius: 10px;
    }
    

    0_1532109943343_progressbar.PNG

    So, if you take a look at that photo, you can clearly see at the edges the chunk are overlapping the rounded corners. I tried the border-bottom-right-radius and left, I was reading this on stackoverflow, and it didn't help so I'm thinking my issue might be something else.

    If anyone can help me in the right direction with this, I would be very appreciative!

    Thanks all,
    Derek


  • Moderators

    What if you just add a margin to your QProgressBar, try like 4 pixels. Should keep the chunks inside.



  • Hey @ambershark ,

    I apologize for the late reply! But yes, I just tried this and it works!!! Thank you so much for your time and help!!

    Derek


Log in to reply