My problem is similar to here.
In the above thread, Wysota says:
And that was the solution, but I have no idea how to do that.casting that listbox item to your class
In my case it would be casting a QGraphicsScene item to my subclass.
My problem is similar to here.
In the above thread, Wysota says:
And that was the solution, but I have no idea how to do that.casting that listbox item to your class
In my case it would be casting a QGraphicsScene item to my subclass.
Hi,
itemAt() returns a pointer to a QGraphicsItem. So the returned value is a (QGraphicsItem *) and not a (YourSubClass *). If the return object is your own subclass (and not some other object that is also in the graphics scene) and you want to use its specific methods, you must first cast it to your own class.
See int QGraphicsItem::type () and T qgraphicsitem_cast ( QGraphicsItem * item ) in the documentation for a possible solution. It is used in the diagramscene example with Qt.
Regards,
Marc
Ok, thanks Marc I went straight to the Docs and was able to work it out.![]()
Bookmarks