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. Drawing part of Pixmap onto circular region of widget.
QtWS25 Last Chance

Drawing part of Pixmap onto circular region of widget.

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 220 Views
  • 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by
    #1

    As Qt doesn't seem to support (by and large) drawing onto a non-rectangular area, how do I go about copying a portion of a Pixmap onto a circular area of my widget?

    I'm guessing that this might involve QPainterPath ...

    Thanks, David

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      It its possible using a mask/region/brush depending on what you really like.

      https://forum.qt.io/topic/87229/circle-user-avatar-issue

      In any case for plain drawing then maybe
      QRegion region (0, 0, w,h, QRegion::Ellipse);
      is what you want and then use it for clipping.

      1 Reply Last reply
      1
      • PerdrixP Offline
        PerdrixP Offline
        Perdrix
        wrote on last edited by
        #3

        QRegion region (0, 0, w,h, QRegion::Ellipse); is what you want and then use it for clipping.

        Works nicely (once I got the sums right for selecting the correct source rectangle).

        7d439e80-39c0-4282-ade2-bef8d93b8bb6-image.png

        Red arrow represents where mouse pointer was.

        David

        1 Reply Last reply
        1

        • Login

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