我有一个ImageItem类继承了QGraphicsItem,我这个类由QGraphicsRectItem,QGraphicsPixmapItem,QGraphicsTextItem组成的。
在这个类中我定义了Type = UserType + 3,但是在执行下面代码时:
QList<QGraphicsItem *> startItems = items(line->line().p1());
现在我的问题是:
1.为什么startItems.first()->type() = 3(3是QGraphicsRectItem的type的值),而不是我定义的 UserType + 3。
2.怎么样才得得到我想要的结果,即startItems.first()->type() =UserType + 3。