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. Circular image area
Forum Updated to NodeBB v4.3 + New Features

Circular image area

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 484 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.
  • T Offline
    T Offline
    tovikonioput
    wrote on last edited by
    #1

    Hi,

    I put images in my program with the help of Pillow.
    I display the image as a QPixmap inside a QLabel, using the setPixmap() method.

    The images I display have a circular shape.
    What I want is the images to have a circluar area(?) instead of a rectangular one, so that if I put 2 images next to each other the corner of one image will not obscure the other one.

    I can`t seem to find a solution for this, I did found a simple solution in C#, here.

    Thanks.

    raven-worxR 1 Reply Last reply
    0
    • T tovikonioput

      Hi,

      I put images in my program with the help of Pillow.
      I display the image as a QPixmap inside a QLabel, using the setPixmap() method.

      The images I display have a circular shape.
      What I want is the images to have a circluar area(?) instead of a rectangular one, so that if I put 2 images next to each other the corner of one image will not obscure the other one.

      I can`t seem to find a solution for this, I did found a simple solution in C#, here.

      Thanks.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @tovikonioput
      they should be, when the images contain transparency. Is that not the case?

      you may also want to try one of those calls (on the labels):

      setAttribute( Qt::WA_TranslucentBackground, true );
      setAttribute( Qt::WA_OpaquePaintEvent, false);
      setAutoFillBackground(false);
      

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      T 1 Reply Last reply
      1
      • raven-worxR raven-worx

        @tovikonioput
        they should be, when the images contain transparency. Is that not the case?

        you may also want to try one of those calls (on the labels):

        setAttribute( Qt::WA_TranslucentBackground, true );
        setAttribute( Qt::WA_OpaquePaintEvent, false);
        setAutoFillBackground(false);
        
        T Offline
        T Offline
        tovikonioput
        wrote on last edited by
        #3

        @raven-worx the images do not contain transparency, how can I add it to them?

        Cobra91151C 1 Reply Last reply
        0
        • T tovikonioput

          @raven-worx the images do not contain transparency, how can I add it to them?

          Cobra91151C Offline
          Cobra91151C Offline
          Cobra91151
          wrote on last edited by
          #4

          @tovikonioput

          Hi! You need to reimplement the paintEvent of QLabel class to have circular image.

          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