3500/MyCustomGraphicsItem.cpp

30 lines
737 B
C++
Raw Normal View History

2023-04-14 19:30:30 +08:00
#include "MyCustomGraphicsItem.h"
#include <QDebug>
#include <QMessageBox>
CMyCustomGraphicsItem::CMyCustomGraphicsItem(QObject *parent) : QObject(parent)
{
}
void CMyCustomGraphicsItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
QGraphicsItem::mouseDoubleClickEvent(event);
qDebug() << "mouseDoubleClickEvent" << event->scenePos() <<endl;
//QGraphicsItem *item = scene.itemAt(mapToScene(event->pos()), QTransform());
2023-04-17 17:40:26 +08:00
// QMessageBox msgBox; // 生成对象
// msgBox.setText("This is Rect."); // 设置文本
// int ret = msgBox.exec(); // 执行
2023-04-14 19:30:30 +08:00
2023-04-17 17:40:26 +08:00
// emit doubleclick(event);
2023-04-14 19:30:30 +08:00
}
void CMyCustomGraphicsItem::wheelEvent(QGraphicsSceneWheelEvent *event)
{
// if(event->delta() > 0){
// }
}