#include "MyCustomGraphicsItem.h" #include #include CMyCustomGraphicsItem::CMyCustomGraphicsItem(QObject *parent) : QObject(parent) { } void CMyCustomGraphicsItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { QGraphicsItem::mouseDoubleClickEvent(event); qDebug() << "mouseDoubleClickEvent" << event->scenePos() <pos()), QTransform()); QMessageBox msgBox; // 生成对象 msgBox.setText("This is Rect."); // 设置文本 int ret = msgBox.exec(); // 执行 emit doubleclick(event); } void CMyCustomGraphicsItem::wheelEvent(QGraphicsSceneWheelEvent *event) { // if(event->delta() > 0){ // } }