Important: Please read the Qt Code of Conduct -

[SOLVED] Round Button Jaggies

  • I am trying to use a round button on a screen with a background image but I am getting jagged edges from the mask. How can I minimise or eliminate these?

    Here is the original button with its clear background, on the screen background.

    When I try to mask out the dark rectangular area around the button, here is what I get.

    Here is the code I used.
    @ QRect rect1 = new QRect(10,10,110,110);
    region1 = new QRegion(*rect1,QRegion::Ellipse);

    The jagged edges around the button are considerable and I'd like to know how to get rid of them.

    BTW, how come the button on the first image (which is on a transparent background) still shades over the rectangular area around the button, and just doesn't let the screen background come through correctly. It seems that the background partially comes through but not entirely.

    Thanks and regards,

  • Hi,
    Might it not be easier to use the stylesheets on the pushButton. There might be "rounding" parameters for the pushButton corners. Increase that and you will get a oval ;-)

  • the "rounding" stylesheet parameter : @border-radius: 20px@ but i think you might also need to set
    @background :rgba(0, 0, 0, 0) ;@ which sets it transparent so you can still see the background image..

  • Thanks All.

    Actually, it was as easy as setting "background: transparent" for the pushbutton in the stylesheet file!

    But, to find the answer is difficult!


Log in to reply