QElectroTech  0.70
Static Public Member Functions | List of all members
QetGraphicsHandlerUtility Class Reference

The QetGraphicsHandlerUtility class This class provide some methods to create and use handler for modify graphics shape like line rectangle etc... They also provide some conveniance static method. More...

#include <qetgraphicshandlerutility.h>

Static Public Member Functions

static QVector< QPointF > pointsForRect (const QRectF &rect)
 QetGraphicsHandlerUtility::pointsForRect Return the keys points of the rectangle, stored in a vector. The points in the vector are stored like this :


0—1—2 | | 3 4 | | 5—6—7


More...
 
static QVector< QPointF > pointsForLine (const QLineF &line)
 QetGraphicsHandlerUtility::pointsForLine The point that define a line in a QVector. there is two points. More...
 
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 vector is the start point, the second the end point. More...
 
static QRectF rectForPosAtIndex (const QRectF &old_rect, const QPointF &pos, int index)
 QetGraphicsHandlerUtility::rectForPosAtIndex Return a rectangle after modification of the point '' at index '' of original rectangle ''. More...
 
static QRectF mirrorRectForPosAtIndex (const QRectF &old_rect, const QPointF &pos, int index)
 QetGraphicsHandlerUtility::mirrorRectForPosAtIndex Return a rectangle after modification of the point '' at index '' of original rectangle ''. the opposite edge is modified inversely (like a mirror) More...
 
static QLineF lineForPosAtIndex (const QLineF &old_line, const QPointF &pos, int index)
 QetGraphicsHandlerUtility::lineForPosAtIndex Return a line after modification of at index of . More...
 
static QPolygonF polygonForInsertPoint (const QPolygonF &old_polygon, bool closed, const QPointF &pos)
 QetGraphicsHandlerUtility::polygonForInsertPoint. More...
 
static QVector< QPointF > pointForRadiusRect (const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize)
 QetGraphicsHandlerUtility::pointForRadiusRect. More...
 
static qreal radiusForPosAtIndex (const QRectF &rect, const QPointF &pos, int index, Qt::SizeMode mode=Qt::AbsoluteSize)
 QetGraphicsHandlerUtility::radiusForPosAtIndex. More...
 
static qreal percentageInRange (qreal min, qreal max, qreal value)
 

Detailed Description

The QetGraphicsHandlerUtility class This class provide some methods to create and use handler for modify graphics shape like line rectangle etc... They also provide some conveniance static method.

Definition at line 34 of file qetgraphicshandlerutility.h.

Member Function Documentation

◆ lineForPosAtIndex()

QLineF QetGraphicsHandlerUtility::lineForPosAtIndex ( const QLineF &  old_line,
const QPointF &  pos,
int  index 
)
static

QetGraphicsHandlerUtility::lineForPosAtIndex Return a line after modification of at index of .

Parameters
old_line
pos
index
Returns

Definition at line 182 of file qetgraphicshandlerutility.cpp.

◆ mirrorRectForPosAtIndex()

QRectF QetGraphicsHandlerUtility::mirrorRectForPosAtIndex ( const QRectF &  old_rect,
const QPointF &  pos,
int  index 
)
static

QetGraphicsHandlerUtility::mirrorRectForPosAtIndex Return a rectangle after modification of the point '' at index '' of original rectangle ''. the opposite edge is modified inversely (like a mirror)

Parameters
old_rect: the rectangle befor modification
pos: the new position of a key point
index: the index of the key point to modifie see QetGraphicsHandlerUtility::pointsForRect to know the index of each keys points of a rectangle)
Returns
: the rectangle with modification. If index is lower than 0 or higher than 7, this method return old_rect.

Definition at line 126 of file qetgraphicshandlerutility.cpp.

Referenced by PartEllipse::handlerMouseMoveEvent(), PartArc::handlerMouseMoveEvent(), PartRectangle::handlerMouseMoveEvent(), and QetShapeItem::handlerMouseMoveEvent().

◆ percentageInRange()

qreal QetGraphicsHandlerUtility::percentageInRange ( qreal  min,
qreal  max,
qreal  value 
)
static

Definition at line 359 of file qetgraphicshandlerutility.cpp.

Referenced by radiusForPosAtIndex().

◆ pointForRadiusRect()

QVector< QPointF > QetGraphicsHandlerUtility::pointForRadiusRect ( const QRectF &  rect,
qreal  xRadius,
qreal  yRadius,
Qt::SizeMode  mode = Qt::AbsoluteSize 
)
static

QetGraphicsHandlerUtility::pointForRadiusRect.

Parameters
rectthe rectangle.
xRadius: x radius
yRadius: y radius
mode: absolute or relative size: NOTE this argument is not used, this function always compute with relative size.
Returns
the points of x and y radius of a rounded rect. The points are always based on the top right corner of the rect. the first point of vector is X the second Y

Definition at line 253 of file qetgraphicshandlerutility.cpp.

Referenced by PartRectangle::addHandler(), QetShapeItem::addHandler(), PartRectangle::adjusteHandlerPos(), and QetShapeItem::adjusteHandlerPos().

◆ pointsForArc()

QVector< QPointF > QetGraphicsHandlerUtility::pointsForArc ( const QRectF &  rect,
qreal  start_angle,
qreal  span_angle 
)
static

QetGraphicsHandlerUtility::pointsForArc Return the points for the given arc. The first value in the vector is the start point, the second the end point.

Parameters
rect
start_angle: start angle in degree
span_angle: span angle in degree;
Returns

Definition at line 78 of file qetgraphicshandlerutility.cpp.

Referenced by PartArc::addHandler(), PartArc::adjusteHandlerPos(), PartArc::handlerMouseMoveEvent(), and PartArc::handlerMousePressEvent().

◆ pointsForLine()

QVector< QPointF > QetGraphicsHandlerUtility::pointsForLine ( const QLineF &  line)
static

QetGraphicsHandlerUtility::pointsForLine The point that define a line in a QVector. there is two points.

Parameters
line
Returns

Definition at line 65 of file qetgraphicshandlerutility.cpp.

◆ pointsForRect()

QVector< QPointF > QetGraphicsHandlerUtility::pointsForRect ( const QRectF &  rect)
static

QetGraphicsHandlerUtility::pointsForRect Return the keys points of the rectangle, stored in a vector. The points in the vector are stored like this :


0—1—2 | | 3 4 | | 5—6—7


Parameters
rect
Returns

Definition at line 36 of file qetgraphicshandlerutility.cpp.

Referenced by PartEllipse::addHandler(), PartArc::addHandler(), PartRectangle::addHandler(), QetShapeItem::addHandler(), PartEllipse::adjusteHandlerPos(), PartArc::adjusteHandlerPos(), PartRectangle::adjusteHandlerPos(), and QetShapeItem::adjusteHandlerPos().

◆ polygonForInsertPoint()

QPolygonF QetGraphicsHandlerUtility::polygonForInsertPoint ( const QPolygonF &  old_polygon,
bool  closed,
const QPointF &  pos 
)
static

QetGraphicsHandlerUtility::polygonForInsertPoint.

Parameters
old_polygon: the polygon which we insert a new point.
closed: polygon is closed or not
pos: the pos where the new point must be added
Returns
the new polygon

Definition at line 195 of file qetgraphicshandlerutility.cpp.

Referenced by PartPolygon::insertPoint(), and QetShapeItem::insertPoint().

◆ radiusForPosAtIndex()

qreal QetGraphicsHandlerUtility::radiusForPosAtIndex ( const QRectF &  rect,
const QPointF &  pos,
int  index,
Qt::SizeMode  mode = Qt::AbsoluteSize 
)
static

QetGraphicsHandlerUtility::radiusForPosAtIndex.

Parameters
rectthe rectangle
pos: the pos of the new radius
index: index of radius 0=X 1=Y
mode
Returns

Definition at line 293 of file qetgraphicshandlerutility.cpp.

References percentageInRange(), and QET::Icons::tr.

Referenced by PartRectangle::handlerMouseMoveEvent(), and QetShapeItem::handlerMouseMoveEvent().

◆ rectForPosAtIndex()

QRectF QetGraphicsHandlerUtility::rectForPosAtIndex ( const QRectF &  old_rect,
const QPointF &  pos,
int  index 
)
static

QetGraphicsHandlerUtility::rectForPosAtIndex Return a rectangle after modification of the point '' at index '' of original rectangle ''.

Parameters
old_rect- the rectangle befor modification
pos- the new position of a key point
index- the index of the key point to modifie see QetGraphicsHandlerUtility::pointsForRect to know the index of each keys points of a rectangle)
Returns
: the rectangle with modification. If index is lower than 0 or higher than 7, this method return old_rect.

Definition at line 99 of file qetgraphicshandlerutility.cpp.

Referenced by PartEllipse::handlerMouseMoveEvent(), PartArc::handlerMouseMoveEvent(), PartRectangle::handlerMouseMoveEvent(), and QetShapeItem::handlerMouseMoveEvent().


The documentation for this class was generated from the following files: