Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Round Button Jaggies
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Round Button Jaggies

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.2k 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.
  • S Offline
    S Offline
    sos1
    wrote on last edited by
    #1

    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.
    https://www.dropbox.com/s/tm3o2hv685ctdmg/Button1.jpg

    When I try to mask out the dark rectangular area around the button, here is what I get.
    https://www.dropbox.com/sh/g8l6lfdd8mxdct4/_PBEhN9hgG#lh:null-Button2.jpg

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

    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,
    James

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      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 ;-)

      Greetz, Jeroen

      1 Reply Last reply
      0
      • clogwogC Offline
        clogwogC Offline
        clogwog
        wrote on last edited by
        #3

        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..

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sos1
          wrote on last edited by
          #4

          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!

          Regards,
          James

          1 Reply Last reply
          0

          • Login

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