valentina/tools/vtoolpoint.h

40 lines
1.6 KiB
C
Raw Normal View History

2013-07-17 13:38:11 +02:00
#ifndef VTOOLPOINT_H
#define VTOOLPOINT_H
#include <QGraphicsEllipseItem>
#include <QGraphicsLineItem>
#include "../widgets/vgraphicssimpletextitem.h"
2013-07-25 14:00:51 +02:00
#include "../options.h"
2013-07-25 20:39:51 +02:00
#include "vabstracttool.h"
2013-07-17 13:38:11 +02:00
2013-07-25 20:39:51 +02:00
class VToolPoint: public VAbstractTool, public QGraphicsEllipseItem
2013-07-17 13:38:11 +02:00
{
Q_OBJECT
public:
VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0);
2013-07-25 14:00:51 +02:00
virtual ~VToolPoint();
2013-07-17 13:38:11 +02:00
public slots:
void NameChangePosition(const QPointF pos);
virtual void ChangedActivDraw(const QString newName);
2013-07-28 00:18:06 +02:00
virtual void FullUpdateFromGui(int result) = 0;
2013-07-17 13:38:11 +02:00
protected:
qreal radius;
VGraphicsSimpleTextItem *namePoint;
2013-07-25 20:39:51 +02:00
QGraphicsLineItem *lineName;
2013-07-25 14:00:51 +02:00
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
2013-07-31 13:34:39 +02:00
virtual void RefreshGeometry();
2013-07-28 00:18:06 +02:00
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
2013-07-17 13:38:11 +02:00
private:
qint32 LineIntersectCircle(QPointF center, qreal radius, QLineF line, QPointF &p1,
QPointF &p2) const;
QPointF LineIntersectRect(QRectF rec, QLineF line) const;
QPointF ClosestPoint(QLineF line, QPointF p) const;
QPointF add_vector (QPointF p, QPointF p1, QPointF p2, qreal k) const;
2013-07-25 14:00:51 +02:00
void LiteUpdateFromGui(qreal mx, qreal my);
void RefreshLine();
2013-07-17 13:38:11 +02:00
};
#endif // VTOOLPOINT_H