QElectroTech  0.8-dev
qetgraphicshandleritem.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 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 <QGraphicsItem>
22 #include <QPen>
23 
36 class QetGraphicsHandlerItem : public QGraphicsItem
37 {
38  public:
39  QetGraphicsHandlerItem(qreal size = 10);
40  QRectF boundingRect() const override;
41 
42  enum { Type = UserType + 1200};
43  int type() const override {return Type;}
44 
45  void setColor(QColor color);
46 
47  protected:
48  void paint(QPainter *painter,
49  const QStyleOptionGraphicsItem *option,
50  QWidget *widget) override;
51 
52  private:
55  qreal m_size;
56  QColor m_color;
57  QPen m_pen;
58 
59  public:
60  static QVector<QetGraphicsHandlerItem *> handlerForPoint(
61  const QVector<QPointF> &points, int size = 10);
62 };
63 
64 #endif // QETGRAPHICSHANDLERITEM_H
QetGraphicsHandlerItem::Type
@ Type
Definition: qetgraphicshandleritem.h:42
QetGraphicsHandlerItem::m_br
QRectF m_br
Definition: qetgraphicshandleritem.h:54
QetGraphicsHandlerItem::boundingRect
QRectF boundingRect() const override
QetGraphicsHandlerItem::boundingRect.
Definition: qetgraphicshandleritem.cpp:40
QetGraphicsHandlerItem::m_size
qreal m_size
Definition: qetgraphicshandleritem.h:55
QetGraphicsHandlerItem::QetGraphicsHandlerItem
QetGraphicsHandlerItem(qreal size=10)
QetGraphicsHandlerItem::QetGraphicsHandlerItem.
Definition: qetgraphicshandleritem.cpp:27
QetGraphicsHandlerItem::m_pen
QPen m_pen
Definition: qetgraphicshandleritem.h:57
QetGraphicsHandlerItem::m_color
QColor m_color
Definition: qetgraphicshandleritem.h:56
QetGraphicsHandlerItem::type
int type() const override
Definition: qetgraphicshandleritem.h:43
qetgraphicshandleritem.h
QetGraphicsHandlerItem
The QetGraphicsHandlerItem class This graphics item represents a point, destined to be used as an han...
Definition: qetgraphicshandleritem.h:37
QetGraphicsHandlerItem::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
QetGraphicsHandlerItem::paint.
Definition: qetgraphicshandleritem.cpp:60
QetGraphicsHandlerItem::setColor
void setColor(QColor color)
QetGraphicsHandlerItem::setColor.
Definition: qetgraphicshandleritem.cpp:48
QetGraphicsHandlerItem::m_handler_rect
QRectF m_handler_rect
Definition: qetgraphicshandleritem.h:53
QetGraphicsHandlerItem::handlerForPoint
static QVector< QetGraphicsHandlerItem * > handlerForPoint(const QVector< QPointF > &points, int size=10)
QetGraphicsHandlerItem::handlerForPoint.
Definition: qetgraphicshandleritem.cpp:87