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] Why might ItemClipsChildrenToShape fail?

[Solved] Why might ItemClipsChildrenToShape fail?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.0k 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.
  • A Offline
    A Offline
    Asperamanca
    wrote on last edited by
    #1

    I use the flag QGraphicsItem::ItemClipsChildrenToShape a lot. I now have a situation where the flag simply is ignored, and I don't know why.
    Here is what I checked so far, did I miss anything?

    • The child I want clipped is indeed an (indirect) child of the item with ItemClipsChildrentoShape set
    • The flag is still set right before I start painting
    • The shape of the item is correct, and would clip where I want it to be clipped

    I stepped through the drawItems code a bit, and noticed I never entered the ifs related to this kind of clipping. It looks a though the flag is considered "false" although I have set it to true, and the flags() return it as true.

    I'd post code, but it's multiple files and I would first have to find out what causes the behavior (because a simple example will work as expected). If you have any suggestions about something specific I should post, please let me know.

    EDIT:
    Solved. I shot my own foot.
    All that ItemClipsChildrenToShape does is to set the clipping region of the painter prior to calling paint. If I then replace the clipping e.g. by calling setClipRect, all that is lost.

    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