54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
#ifndef ITEMCONTROLHANDLE_H
|
|
#define ITEMCONTROLHANDLE_H
|
|
|
|
#include <QGraphicsRectItem>
|
|
#include "global.h"
|
|
|
|
const int HNDLE_SIZE = 8;
|
|
|
|
class GraphicsBaseItem;
|
|
|
|
class ItemControlHandle : public QObject,public QGraphicsItem
|
|
{
|
|
Q_OBJECT
|
|
Q_INTERFACES(QGraphicsItem)
|
|
public:
|
|
ItemControlHandle(QGraphicsItem *parent);
|
|
virtual ~ItemControlHandle();
|
|
|
|
public:
|
|
virtual int getSize();
|
|
virtual void move(double, double);
|
|
|
|
virtual void setText(QString);
|
|
virtual QString getText() const;
|
|
|
|
void setType(HandleType ht) { m_type = ht; }
|
|
HandleType getType() { return m_type; }
|
|
|
|
void setTag(int ht) { m_tag = ht; }
|
|
int getTag() { return m_tag; }
|
|
|
|
void setEnable(bool b){m_enable = b;}
|
|
bool enable(){return m_enable;}
|
|
|
|
void setIfShow(bool b){m_ifShow = b;}
|
|
bool ifShow(){return m_ifShow;}
|
|
|
|
GraphicsBaseItem* getParentPtr() const {return _parent;}
|
|
void setParent(GraphicsBaseItem* p) {_parent = p;}
|
|
protected:
|
|
|
|
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent*) override;
|
|
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent*) override;
|
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
protected:
|
|
HandleType m_type;
|
|
int m_tag;
|
|
bool m_enable;
|
|
bool m_ifShow;
|
|
GraphicsBaseItem* _parent;
|
|
};
|
|
|
|
#endif
|