Important: Please read the Qt Code of Conduct -

QSS border-width transition with rounded corners

  • Currently I'm trying to make a QPushButton that only has a border at bottom side and rounded corners on all sides. When using Qt Style Sheets, the transition in the corners is somewhat messed up:

    Current result with QSS

    button->setStyleSheet("QPushButton { background: #2196f3; border: none; border-radius: 16px; color: white; font: 12pt;"
                          "border-bottom: solid; border-bottom-color: #136de0; border-bottom-width: 9px;}"

    But what I want is this:


    I archieved this by using QGraphicsDropShadowEffect. However, I assume setting the style once – with pseudo-states – is faster than changing the shadow effect on hover/press/release. Plus, I want to use a real shadow and I can only set one QGraphicsEffect at once.

    After reading CSS Border Spec, I thought, I could get also this effect with Qt Style Sheets. How do have to change my first code to archieve this?

  • Lifetime Qt Champion


    Looks like it could be a painting bug in with the style used to render the stylesheet.

    Are you customising anything else on your UI ?

  • @SGaist No I am using standard QMainWindow under Win7.

  • Lifetime Qt Champion

    Looks like a rendering problem of the style used to render widget modified by a stylesheet.

Log in to reply