Files
HPPA/HPPA/imagerSimulatioin.h
2026-04-02 10:34:57 +08:00

34 lines
942 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef IMAGER_SIMULATIOIN
#define IMAGER_SIMULATIOIN
#include <QGraphicsItem>
class imagerSimulatioin :public QObject,public QGraphicsItem
{
Q_OBJECT
Q_INTERFACES(QGraphicsItem)
public:
imagerSimulatioin(QGraphicsItem *parent = Q_NULLPTR);
~imagerSimulatioin();
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void setPos(qreal x, qreal y);
//在QGraphicsScene中限制图元的拖动范围https://www.cnblogs.com/sfy5848/p/6611824.html
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);//当拖动item时不停会的绘制消除拖动重影
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);//当放开鼠标时发射此时图元在scene中的坐标
protected:
private:
int m_width;
int m_height;
signals :
void leftMouseButtonPressed(int, int);
};
#endif