17 #ifndef QGSCOMPOSERMOUSEHANDLES_H
18 #define QGSCOMPOSERMOUSEHANDLES_H
20 #include <QGraphicsRectItem>
77 void paint( QPainter* painter,
const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
90 void mouseMoveEvent( QGraphicsSceneMouseEvent* event );
91 void mouseReleaseEvent( QGraphicsSceneMouseEvent* event );
92 void mousePressEvent( QGraphicsSceneMouseEvent* event );
93 void mouseDoubleClickEvent( QGraphicsSceneMouseEvent* event );
94 void hoverMoveEvent( QGraphicsSceneHoverEvent * event );
95 void hoverLeaveEvent( QGraphicsSceneHoverEvent * event );
100 void selectionChanged();
103 void selectedItemSizeChanged();
106 void selectedItemRotationChanged();
111 QGraphicsView* mGraphicsView;
115 QPointF mMouseMoveStartPos;
117 QPointF mLastMouseEventPos;
119 QPointF mBeginMouseEventPos;
121 QPointF mBeginHandlePos;
123 double mBeginHandleWidth;
124 double mBeginHandleHeight;
136 QGraphicsLineItem* mHAlignSnapItem;
137 QGraphicsLineItem* mVAlignSnapItem;
139 QSizeF mCursorOffset;
142 QRectF selectionBounds()
const;
145 bool selectionRotation(
double & rotation )
const;
148 void updateHandles();
150 void drawHandles( QPainter* painter,
double rectHandlerSize );
152 void drawSelectedItemBounds( QPainter* painter );
156 double rectHandlerBorderTolerance();
159 Qt::CursorShape cursorForPosition(
const QPointF& itemCoordPos );
165 void dragMouseMove(
const QPointF& currentPosition,
bool lockMovement,
bool preventSnap );
168 QSizeF calcCursorEdgeOffset(
const QPointF &cursorPos );
171 void resizeMouseMove(
const QPointF& currentPosition,
bool lockAspect,
bool fromCenter );
174 QGraphicsLineItem* hAlignSnapItem();
175 void deleteHAlignSnapItem();
177 QGraphicsLineItem* vAlignSnapItem();
178 void deleteVAlignSnapItem();
179 void deleteAlignItems();
184 QPointF alignItem(
double& alignX,
double& alignY,
double unalignedX,
double unalignedY );
186 QPointF alignPos(
const QPointF& pos,
double& alignX,
double& alignY );
189 void collectAlignCoordinates( QMap< double, const QgsComposerItem* >& alignCoordsX, QMap< double, const QgsComposerItem* >& alignCoordsY );
190 bool nearestItem(
const QMap< double, const QgsComposerItem* >& coords,
double value,
double& nearestValue )
const;
191 void checkNearestItem(
double checkCoord,
const QMap< double, const QgsComposerItem* >& alignCoords,
double& smallestDiff,
double itemCoordOffset,
double& itemCoord,
double& alignCoord );
194 QGraphicsView* graphicsView();
197 void setViewportCursor( Qt::CursorShape cursor );
200 void resetStatusBar();
203 #endif // QGSCOMPOSERMOUSEHANDLES_H