C++ 自定义QGraphicsPolygonItem dragLeaveEvent未执行
我有一个名为CustomGPolygon的QGraphicsPolygonItem的自定义版本 在customgpolygon.h中,我声明了函数C++ 自定义QGraphicsPolygonItem dragLeaveEvent未执行,c++,qt,C++,Qt,我有一个名为CustomGPolygon的QGraphicsPolygonItem的自定义版本 在customgpolygon.h中,我声明了函数void dragleavevent(qgraphicscendragdropevent*事件) customgpolygon.cpp中的函数如下所示 void CustomGPolygon::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) { event->setAccepted(t
void dragleavevent(qgraphicscendragdropevent*事件)代码>
customgpolygon.cpp中的函数如下所示
void CustomGPolygon::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
{
event->setAccepted(true);
qDebug() << "hi";
}
void CustomGPolygon::dragLeaveEvent(QGraphicsSCeneDragDropropEvent*事件)
{
事件->设置已接受(true);
qDebug()您必须在某个地方为CustomGPolygon的对象设置标志项可编辑
():
您必须在某个地方为CustomGPolygon的对象设置标志ItemIsMovable
():
void setFlag(QGraphicsItem::ItemIsMovable, true);