Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to write custom singnal and slots for custom QGraphicsPolygonItem?
-
how to write custom singnal and slots for custom QGraphicsPolygonItem?
i found that QGraphicsPolygonItem is not inherited from QObejct...
and i tried add Q_OBJECT for my class, and compiled wrong...
-
You can inherit QGraphicsPolygonItem from QObject yourself
-
As jalomic suggested inherit you custom QGraphicsPolygonItem from both classes QObject and QGraphicsPolygonItem
Please note that QObject must be first in the inheritance chain. Otherwise moc will not recognize it.
@
class MyGPI : public QObject, public QGraphicsPolygonItem
{
Q_OBJECT
public:
...
}
@