17#ifndef QGSGRAPHICSVIEWMOUSEHANDLES_H 
   18#define QGSGRAPHICSVIEWMOUSEHANDLES_H 
   23#include <QGraphicsRectItem> 
   46class GUI_EXPORT QgsGraphicsViewMouseHandles : 
public QObject, 
public QGraphicsRectItem
 
   69    QgsGraphicsViewMouseHandles( QGraphicsView *view );
 
   75    bool isDragging()
 const { 
return mIsDragging; }
 
   78    bool isResizing()
 const { 
return mIsResizing; }
 
   80    bool shouldBlockEvent( QInputEvent *event ) 
const;
 
   83    void startMove( QPointF sceneCoordPos );
 
   88    void selectedItemSizeChanged();
 
   91    void selectedItemRotationChanged();
 
   94    void paintInternal( QPainter *painter, 
bool showHandles, 
bool showStaticBoundingBoxes, 
bool showTemporaryBoundingBoxes, 
const QStyleOptionGraphicsItem *option, QWidget *widget = 
nullptr );
 
   97    virtual void setViewportCursor( Qt::CursorShape cursor ) = 0;
 
   99    virtual QList<QGraphicsItem *> sceneItemsAtPoint( QPointF scenePoint ) = 0;
 
  100    virtual QList<QGraphicsItem *> selectedSceneItems( 
bool includeLockedItems = 
true ) 
const = 0;
 
  101    virtual bool itemIsLocked( QGraphicsItem *item )
 
  106    virtual bool itemIsGroupMember( QGraphicsItem *item )
 
  111    virtual QRectF itemRect( QGraphicsItem *item ) 
const = 0;
 
  112    virtual QRectF storedItemRect( QGraphicsItem *item ) 
const;
 
  113    virtual void moveItem( QGraphicsItem *item, 
double deltaX, 
double deltaY ) = 0;
 
  114    virtual void previewItemMove( QGraphicsItem *item, 
double deltaX, 
double deltaY );
 
  115    virtual void setItemRect( QGraphicsItem *item, QRectF rect ) = 0;
 
  125    virtual QRectF previewSetItemRect( QGraphicsItem *item, QRectF rect );
 
  127    virtual void startMacroCommand( 
const QString &text );
 
  128    virtual void endMacroCommand();
 
  129    virtual void createItemCommand( QGraphicsItem *item );
 
  130    virtual void endItemCommand( QGraphicsItem *item );
 
  131    virtual void showStatusMessage( 
const QString &message ) { Q_UNUSED( message ) }
 
  132    virtual void hideAlignItems() {}
 
  134    virtual QPointF snapPoint( QPointF originalPoint, SnapGuideMode mode, 
bool snapHorizontal = 
true, 
bool snapVertical = 
true );
 
  137    virtual void expandItemList( 
const QList<QGraphicsItem *> &items, QList<QGraphicsItem *> &collected ) 
const;
 
  139    void mouseDoubleClickEvent( QGraphicsSceneMouseEvent *event ) 
override;
 
  140    void hoverMoveEvent( QGraphicsSceneHoverEvent *event ) 
override;
 
  141    void hoverLeaveEvent( QGraphicsSceneHoverEvent *event ) 
override;
 
  142    void mousePressEvent( QGraphicsSceneMouseEvent *event ) 
override;
 
  143    void mouseMoveEvent( QGraphicsSceneMouseEvent *event ) 
override;
 
  144    void mouseReleaseEvent( QGraphicsSceneMouseEvent *event ) 
override;
 
  147    void resetStatusBar();
 
  150    bool selectionRotation( 
double &rotation ) 
const;
 
  153    void updateHandles();
 
  156    void dragMouseMove( QPointF currentPosition, 
bool lockMovement, 
bool preventSnap );
 
  159    void resizeMouseMove( QPointF currentPosition, 
bool lockAspect, 
bool fromCenter );
 
  161    void setHandleSize( 
double size );
 
  167    QSizeF calcCursorEdgeOffset( QPointF cursorPos );
 
  170    QRectF selectionBounds() 
const;
 
  180    static void relativeResizeRect( QRectF &rectToResize, 
const QRectF &boundsBefore, 
const QRectF &boundsAfter );
 
  191    static double relativePosition( 
double position, 
double beforeMin, 
double beforeMax, 
double afterMin, 
double afterMax );
 
  194    QGraphicsView *mView = 
nullptr;
 
  196    double mHandleSize = 10;
 
  198    QSizeF mCursorOffset;
 
  199    double mResizeMoveX = 0;
 
  200    double mResizeMoveY = 0;
 
  203    double mBeginHandleWidth = 0;
 
  204    double mBeginHandleHeight = 0;
 
  209    QPointF mMouseMoveStartPos;
 
  212    bool mDoubleClickInProgress = 
false;
 
  215    bool mIsDragging = 
false;
 
  217    bool mIsResizing = 
false;
 
  220    QPointF mBeginMouseEventPos;
 
  223    QPointF mBeginHandlePos;
 
  226    void drawHandles( QPainter *painter, 
double rectHandlerSize );
 
  229    void drawSelectedItemBounds( QPainter *painter );
 
  235    double rectHandlerBorderTolerance();
 
  238    Qt::CursorShape cursorForPosition( QPointF itemCoordPos );
 
MouseHandlesAction
Action to be performed by the mouse handles.