Change bounds of a node to circular/triangular shape

20 views
Skip to first unread message

Patrick Singh

unread,
Jan 29, 2020, 6:38:25 PM1/29/20
to pyqtgraph
Hello there,

I am currently working on introducing different kind of nodes to the flowchart. For now, I can insert nodes in rectangular, triangular, and oval shape. Nevertheless, the nodes hitboxes did not change and keep on being rectangular. I have already tried to change the self.bounds attribute accordingally, though I think that it is enforced being rectangular. Thanks in advance for any hints.

Best regards
Patrick Singh

Patrick

unread,
Jan 29, 2020, 9:56:26 PM1/29/20
to pyqtgraph
Hi,

I'm not completely familiar with the working of the flowchart, but believe it is still based on GraphicsItem/GraphicsScene like the rest of pyqtgraph. The trick then is that it is all based off Qt's QGraphicsItem/QGraphicsScene etc. So, looking at http://www.pyqtgraph.org/documentation/_modules/pyqtgraph/GraphicsScene/GraphicsScene.html#GraphicsScene I think the event hit boxes come from calling the shape() method inherited from QGraphicsItem (https://doc.qt.io/qt-5/qgraphicsitem.html#shape),  which by default just returns the bounding rectangle.
So you could try looking at the examples in the Qt documents about how to return something different from the shape() method and override it in your custom Node/NodeGraphicsItem.

Hope that helps,

Patrick
Reply all
Reply to author
Forward
0 new messages