Hello,
This might be a c++ question rather than qt.
I have written a custom class which inherits from QGraphicsPolygonItem and have populated a scene with this kind of object. Now I wish to know when one of them is selected, so I 've connected the scene's selectionChanged() signal to a custom slot. In that slot function, the scene's selectedItems() will give me a QList<QGraphicsItem*>, ie a list of the items selected. However, I want a qlist of my custom class.
From what I read on casting base class to derived, dynamic_cast could only work if QGraphicsItem was polymorphic. Trying static_cast instead caused a seg fault. Am I right to assume that the QList returned by selectedItems() contains what I want and it is a matter of casting? Should I be approaching this in an entirely different manner? (although I do not want to turn my custom class into a QObject to use its signals)
Any advice or ideas would be appreciated.
Bookmarks