Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Create only outside path using QPainterPathStroker



  • I have a triangle outline. I need to implement a logic where some QGraphicsItem lying outside the triangle within some range is allowed to rotate. QPainterPathStroker draws a path inside and outside the boundary of triangle. Is there any way to just construct the outside path?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    AFAIK, you can't do with default items. You'll have build it yourself to add support for only painting the outline.



  • Thanks for the quick reply..
    I also tried using QPainterPath .conatins API to identify if a given point lies within the closed shape but no success. Can you guide as how to figure out if a given point just lies within the shape() or say the opposite that a given point lies outside or on the shape() ?


  • Lifetime Qt Champion

    Take a look at the sources of QPainterPathStroker. That should give you a good overview on how to do it.


Log in to reply