30 lines
729 B
C++
30 lines
729 B
C++
#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());
|
|
|
|
QMessageBox msgBox; // 生成对象
|
|
msgBox.setText("This is Rect."); // 设置文本
|
|
int ret = msgBox.exec(); // 执行
|
|
|
|
emit doubleclick(event);
|
|
}
|
|
|
|
void CMyCustomGraphicsItem::wheelEvent(QGraphicsSceneWheelEvent *event)
|
|
{
|
|
// if(event->delta() > 0){
|
|
|
|
// }
|
|
}
|