16#ifndef QGSMODELGRAPHICVIEW_H
17#define QGSMODELGRAPHICVIEW_H
24#include <QGraphicsRectItem>
25#include <QGraphicsView>
31class QgsModelComponentGraphicItem;
32class QgsModelGraphicsScene;
33class QgsModelViewSnapMarker;
43class GUI_EXPORT QgsModelGraphicsView :
public QGraphicsView
51 QgsModelGraphicsView( QWidget *parent =
nullptr );
52 ~QgsModelGraphicsView()
override;
54 void dragEnterEvent( QDragEnterEvent *event )
override;
55 void dropEvent( QDropEvent *event )
override;
56 void dragMoveEvent( QDragMoveEvent *event )
override;
57 void wheelEvent( QWheelEvent *event )
override;
58 void mousePressEvent( QMouseEvent *event )
override;
59 void mouseReleaseEvent( QMouseEvent *event )
override;
60 void mouseMoveEvent( QMouseEvent *event )
override;
61 void mouseDoubleClickEvent( QMouseEvent *event )
override;
62 void keyPressEvent( QKeyEvent *event )
override;
63 void keyReleaseEvent( QKeyEvent *event )
override;
68 void setModelScene( QgsModelGraphicsScene *scene );
74 QgsModelGraphicsScene *modelScene()
const;
87 void setTool( QgsModelViewTool *tool )
SIP_SKIP;
96 void unsetTool( QgsModelViewTool *tool )
SIP_SKIP;
101 QgsModelSnapper *snapper()
SIP_SKIP;
106 void startMacroCommand( const QString &text );
111 void endMacroCommand();
116 void beginCommand( const QString &text );
131 enum ClipboardOperation
142 void copySelectedItems( ClipboardOperation operation );
149 void copyItems(
const QList<QgsModelComponentGraphicItem *> &items, ClipboardOperation operation );
165 void pasteItems( PasteMode mode );
178 void algorithmDropped(
const QString &algorithmId,
const QPointF &pos );
183 void inputDropped(
const QString &inputId,
const QPointF &pos );
189 void toolSet( QgsModelViewTool *tool )
SIP_SKIP;
195 void itemFocused( QgsModelComponentGraphicItem *item );
201 void willBeDeleted();
206 void macroCommandStarted(
const QString &text );
211 void macroCommandEnded();
216 void commandBegun(
const QString &text );
227 void commandAborted();
232 void deleteSelectedItems();
236 void wheelZoom( QWheelEvent *event );
242 void scaleSafe(
double scale );
248 QPointF deltaForKeyEvent( QKeyEvent *event );
261 void friendlySetSceneRect();
263 QPointer<QgsModelViewTool> mTool;
265 QgsModelViewToolTemporaryKeyPan *mSpacePanTool =
nullptr;
266 QgsModelViewToolTemporaryMousePan *mMidMouseButtonPanTool =
nullptr;
267 QgsModelViewToolTemporaryKeyZoom *mSpaceZoomTool =
nullptr;
269 QPoint mMouseCurrentXY;
271 int mBlockScrollbarSignals = 0;
273 QgsModelSnapper mSnapper;
274 QgsModelViewSnapMarker *mSnapMarker =
nullptr;
282class GUI_EXPORT QgsModelViewSnapMarker :
public QGraphicsRectItem
285 QgsModelViewSnapMarker();
287 void paint( QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget =
nullptr )
override;