QElectroTech  0.8-dev
qetgraphicshandlerutility.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 QETGRAPHICSHANDLERUTILITY_H
19 #define QETGRAPHICSHANDLERUTILITY_H
20 
21 #include <QRectF>
22 #include <QLineF>
23 #include <QColor>
24 #include <QPolygonF>
25 
26 class QPainter;
27 
35 {
36  public:
37  static QVector <QPointF> pointsForRect (const QRectF &rect);
38  static QVector <QPointF> pointsForLine (const QLineF &line);
39  static QVector <QPointF> pointsForArc (const QRectF &rect, qreal start_angle, qreal span_angle);
40  static QRectF rectForPosAtIndex (const QRectF &old_rect, const QPointF &pos, int index);
41  static QRectF mirrorRectForPosAtIndex (const QRectF &old_rect, const QPointF &pos, int index);
42  static QLineF lineForPosAtIndex (const QLineF &old_line, const QPointF &pos, int index);
43  static QPolygonF polygonForInsertPoint(const QPolygonF &old_polygon, bool closed, const QPointF &pos);
44  static QVector <QPointF> pointForRadiusRect (const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize);
45  static qreal radiusForPosAtIndex (const QRectF &rect, const QPointF &pos, int index, Qt::SizeMode mode = Qt::AbsoluteSize);
46  static qreal percentageInRange(qreal min, qreal max, qreal value);
47 };
48 
49 #endif // QETGRAPHICSHANDLERUTILITY_H
qetgraphicshandlerutility.h
QetGraphicsHandlerUtility::pointForRadiusRect
static QVector< QPointF > pointForRadiusRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize)
QetGraphicsHandlerUtility::pointForRadiusRect.
Definition: qetgraphicshandlerutility.cpp:276
QetGraphicsHandlerUtility::lineForPosAtIndex
static QLineF lineForPosAtIndex(const QLineF &old_line, const QPointF &pos, int index)
QetGraphicsHandlerUtility::lineForPosAtIndex Return a line after modification of pos at index index o...
Definition: qetgraphicshandlerutility.cpp:198
QetGraphicsHandlerUtility::radiusForPosAtIndex
static qreal radiusForPosAtIndex(const QRectF &rect, const QPointF &pos, int index, Qt::SizeMode mode=Qt::AbsoluteSize)
QetGraphicsHandlerUtility::radiusForPosAtIndex.
Definition: qetgraphicshandlerutility.cpp:316
QetGraphicsHandlerUtility::mirrorRectForPosAtIndex
static QRectF mirrorRectForPosAtIndex(const QRectF &old_rect, const QPointF &pos, int index)
QetGraphicsHandlerUtility::mirrorRectForPosAtIndex Return a rectangle after modification of the point...
Definition: qetgraphicshandlerutility.cpp:139
QetGraphicsHandlerUtility::pointsForArc
static QVector< QPointF > pointsForArc(const QRectF &rect, qreal start_angle, qreal span_angle)
QetGraphicsHandlerUtility::pointsForArc Return the points for the given arc. The first value in the v...
Definition: qetgraphicshandlerutility.cpp:79
QetGraphicsHandlerUtility::pointsForRect
static QVector< QPointF > pointsForRect(const QRectF &rect)
QetGraphicsHandlerUtility::pointsForRect Return the keys points of the rectangle, stored in a vector....
Definition: qetgraphicshandlerutility.cpp:36
QetGraphicsHandlerUtility::rectForPosAtIndex
static QRectF rectForPosAtIndex(const QRectF &old_rect, const QPointF &pos, int index)
QetGraphicsHandlerUtility::rectForPosAtIndex Return a rectangle after modification of the point 'pos'...
Definition: qetgraphicshandlerutility.cpp:106
QetGraphicsHandlerUtility::percentageInRange
static qreal percentageInRange(qreal min, qreal max, qreal value)
Definition: qetgraphicshandlerutility.cpp:382
QetGraphicsHandlerUtility::pointsForLine
static QVector< QPointF > pointsForLine(const QLineF &line)
QetGraphicsHandlerUtility::pointsForLine The point that define a line in a QVector....
Definition: qetgraphicshandlerutility.cpp:65
QetGraphicsHandlerUtility::polygonForInsertPoint
static QPolygonF polygonForInsertPoint(const QPolygonF &old_polygon, bool closed, const QPointF &pos)
QetGraphicsHandlerUtility::polygonForInsertPoint.
Definition: qetgraphicshandlerutility.cpp:213
QetGraphicsHandlerUtility
The QetGraphicsHandlerUtility class This class provide some methods to create and use handler for mod...
Definition: qetgraphicshandlerutility.h:35
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206