valentina/tools/vtoolpoint.h

49 lines
2.0 KiB
C
Raw Normal View History

2013-07-17 13:38:11 +02:00
#ifndef VTOOLPOINT_H
#define VTOOLPOINT_H
2013-08-20 12:26:02 +02:00
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
2013-08-20 12:26:02 +02:00
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
2013-07-17 13:38:11 +02:00
#include <QGraphicsLineItem>
2013-08-05 10:37:56 +02:00
#include <QGraphicsEllipseItem>
2013-07-17 13:38:11 +02:00
#include "../widgets/vgraphicssimpletextitem.h"
2013-07-25 20:39:51 +02:00
#include "vabstracttool.h"
2013-08-20 12:26:02 +02:00
#pragma GCC diagnostic pop
#include "../options.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:
2013-08-28 10:55:11 +02:00
VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, Draw::Mode mode, 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-08-15 22:39:00 +02:00
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
2013-07-17 13:38:11 +02:00
protected:
qreal radius;
VGraphicsSimpleTextItem *namePoint;
2013-07-25 20:39:51 +02:00
QGraphicsLineItem *lineName;
2013-08-05 10:37:56 +02:00
virtual void RefreshGeometry();
2013-07-25 14:00:51 +02:00
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
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:
2013-08-20 12:26:02 +02:00
VToolPoint(const VToolPoint &tool);
const VToolPoint &operator=(const VToolPoint &tool);
2013-07-17 13:38:11 +02:00
QPointF LineIntersectRect(QRectF rec, QLineF line) const;
2013-07-25 14:00:51 +02:00
void LiteUpdateFromGui(qreal mx, qreal my);
void RefreshLine();
2013-08-05 10:37:56 +02:00
qint32 LineIntersectCircle(QPointF center, qreal radius, QLineF line, QPointF &p1,
QPointF &p2) const;
QPointF ClosestPoint(QLineF line, QPointF p) const;
QPointF addVector (QPointF p, QPointF p1, QPointF p2, qreal k) const;
2013-08-20 12:26:02 +02:00
2013-07-17 13:38:11 +02:00
};
#endif // VTOOLPOINT_H