Important: Please read the Qt Code of Conduct -

QPainterPath::contains - Docs too brief

  • @bool QPainterPath::contains ( const QRectF & rectangle ) const

    Returns true if the given rectangle is inside the path, otherwise returns false.@

    Does it mean completely contained? Partially contained? All corners contained? All lines contained?

  • Moderators

    Judging from other places (QRectF), it's probably something like "more or less completely contained". It's usually hard to say for sure when dealing with floating point numbers.

  • Ok, I know about the limitations concerning whether edges are included or not.
    But for example, if I have a painter path in form of a pac man (circle with open triangular mouth), and a rectangle which is completely inside the pac man's bounding rectangle, but partially visible in the mouth - is that rectangle considered "contained"?

  • Moderators

    That is a quite specific use case. You can test, and maybe update the documentation with your findings (or file a bug report for that).

  • It's just an example to illustrate that the word "contained" alone is not as clear as one would hope.
    I wouldn't dare to update the documentation based on some trial and error. The docs need to describe how the method is expected to perform (and any deviation from that is then a good basis for a bug report).

Log in to reply