QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
qetgraphicshandleritem.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 The QElectroTech Team
3 This file is part of QElectroTech.
4
5 QElectroTech is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9
10 QElectroTech is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef QETGRAPHICSHANDLERITEM_H
19#define QETGRAPHICSHANDLERITEM_H
20
21#include <QGraphicsObject>
22#include <QPen>
23
36class QetGraphicsHandlerItem : public QGraphicsObject
37{
38 Q_OBJECT
39
40 Q_PROPERTY(qreal currentSize READ currentSize WRITE setCurrentSize)
41
42 public:
43 QetGraphicsHandlerItem(qreal size = 10);
44 void setSize(qreal size);
45 QRectF boundingRect() const override;
46
47 enum { Type = UserType + 1200};
48 int type() const override {return Type;}
49
50 void setColor(QColor color);
51
52
53 protected:
54 void paint(QPainter *painter,
55 const QStyleOptionGraphicsItem *option,
56 QWidget *widget) override;
57 void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
58 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
59
60 qreal currentSize() const {return m_current_size;}
61 void setCurrentSize(qreal size);
62
63
64
65 private:
70 QColor m_color;
71 QPen m_pen;
72
73 public:
74 static QVector<QetGraphicsHandlerItem *> handlerForPoint(
75 const QVector<QPointF> &points, int size = 10);
76};
77
78#endif // QETGRAPHICSHANDLERITEM_H
The QetGraphicsHandlerItem class This graphics item represents a point, destined to be used as an han...
Definition qetgraphicshandleritem.h:37
static QVector< QetGraphicsHandlerItem * > handlerForPoint(const QVector< QPointF > &points, int size=10)
QetGraphicsHandlerItem::handlerForPoint.
Definition qetgraphicshandleritem.cpp:127
qreal currentSize() const
Definition qetgraphicshandleritem.h:60
qreal m_original_size
Definition qetgraphicshandleritem.h:69
@ Type
Definition qetgraphicshandleritem.h:47
QRectF m_br
Definition qetgraphicshandleritem.h:67
qreal currentSize
Definition qetgraphicshandleritem.h:40
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override
Definition qetgraphicshandleritem.cpp:89
void setCurrentSize(qreal size)
Definition qetgraphicshandleritem.cpp:113
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
QetGraphicsHandlerItem::paint.
Definition qetgraphicshandleritem.cpp:68
qreal m_current_size
Definition qetgraphicshandleritem.h:68
void setColor(QColor color)
QetGraphicsHandlerItem::setColor.
Definition qetgraphicshandleritem.cpp:56
void setSize(qreal size)
Definition qetgraphicshandleritem.cpp:35
QRectF m_handler_rect
Definition qetgraphicshandleritem.h:66
int type() const override
Definition qetgraphicshandleritem.h:48
QColor m_color
Definition qetgraphicshandleritem.h:70
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override
Definition qetgraphicshandleritem.cpp:101
QPen m_pen
Definition qetgraphicshandleritem.h:71
QRectF boundingRect() const override
QetGraphicsHandlerItem::boundingRect.
Definition qetgraphicshandleritem.cpp:47