[Interest] QGraphicsView selection not honoring QGraphicsItem::shape?

Patrick Stinson patrickkidd at gmail.com
Mon Jun 26 07:29:37 CEST 2017


Cool, thanks for digging into it a little more.

Thanks for the tip on stroking the path for shape(), though I already do that as demonstrated in qgraphicsitemc.cpp - I just removed it from the example code I posted here :)

Here is a video of it still not working but with your debug code:

https://www.screencast.com/t/j8JaAcL08O


here is the output of qDebug() << item.pos() << item.boundingRect() << item.shape():

PyQt5.QtCore.QPointF() PyQt5.QtCore.QRectF(-213.0724192881762, -83.55902694078242, 295.58581163557005, 66.7981150101399) <PyQt5.QtGui.QPainterPath object at 0x10f878058>

I have confirmed shape().contains(boundingRect().center()) == false

I wonder if the problem is that my item has no pos()? I am just drawing it in relation to the two items that it is connected to. Geeze, if so I wonder how that would work when you can drag either of the two items it connects to and it just remains in the middle. I guess just listen for their movements and do the math to move this item to the center of where it would be drawn…

P.S. gammaray looks amazing.

-P

> On Jun 25, 2017, at 8:17 PM, Christian Gagneraud <chgans at gmail.com> wrote:
> 
>  painter.drawPath(boundingRect())

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170625/ee9d53ad/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1403 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170625/ee9d53ad/attachment.bin>


More information about the Interest mailing list