16#ifndef QGSMODELGRAPHICVIEW_H
17#define QGSMODELGRAPHICVIEW_H
24#include <QGraphicsRectItem>
25#include <QGraphicsView>
33class QgsModelComponentGraphicItem;
34class QgsModelGraphicsScene;
35class QgsModelViewSnapMarker;
46class GUI_EXPORT QgsModelGraphicsView :
public QGraphicsView
54 QgsModelGraphicsView( QWidget *parent =
nullptr );
55 ~QgsModelGraphicsView()
override;
57 void dragEnterEvent( QDragEnterEvent *event )
override;
58 void dropEvent( QDropEvent *event )
override;
59 void dragMoveEvent( QDragMoveEvent *event )
override;
60 void wheelEvent( QWheelEvent *event )
override;
61 void mousePressEvent( QMouseEvent *event )
override;
62 void mouseReleaseEvent( QMouseEvent *event )
override;
63 void mouseMoveEvent( QMouseEvent *event )
override;
64 void mouseDoubleClickEvent( QMouseEvent *event )
override;
65 void keyPressEvent( QKeyEvent *event )
override;
66 void keyReleaseEvent( QKeyEvent *event )
override;
71 void setModelScene( QgsModelGraphicsScene *scene );
77 QgsModelGraphicsScene *modelScene()
const;
109 void startMacroCommand( const QString &text );
114 void endMacroCommand();
119 void beginCommand( const QString &text );
134 enum ClipboardOperation
145 void copySelectedItems( ClipboardOperation operation );
152 void copyItems(
const QList<QgsModelComponentGraphicItem *> &items, ClipboardOperation operation );
168 void pasteItems( PasteMode mode );
181 void algorithmDropped(
const QString &algorithmId,
const QPointF &pos );
186 void inputDropped(
const QString &inputId,
const QPointF &pos );
192 void toolSet( QgsModelViewTool *tool );
198 void itemFocused( QgsModelComponentGraphicItem *item );
204 void willBeDeleted();
209 void macroCommandStarted(
const QString &text );
214 void macroCommandEnded();
219 void commandBegun(
const QString &text );
230 void commandAborted();
235 void deleteSelectedItems();
239 void wheelZoom( QWheelEvent *event );
245 void scaleSafe(
double scale );
251 QPointF deltaForKeyEvent( QKeyEvent *event );
264 void friendlySetSceneRect();
266 QPointer<QgsModelViewTool> mTool;
268 QgsModelViewToolTemporaryKeyPan *mSpacePanTool =
nullptr;
269 QgsModelViewToolTemporaryMousePan *mMidMouseButtonPanTool =
nullptr;
270 QgsModelViewToolTemporaryKeyZoom *mSpaceZoomTool =
nullptr;
272 QPoint mMouseCurrentXY;
274 int mBlockScrollbarSignals = 0;
276 QgsModelSnapper mSnapper;
277 QgsModelViewSnapMarker *mSnapMarker =
nullptr;
285class GUI_EXPORT QgsModelViewSnapMarker :
public QGraphicsRectItem
288 QgsModelViewSnapMarker();
290 void paint( QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget =
nullptr )
override;
Manages snapping grids and preset snap lines in a layout, and handles snapping points to the nearest ...