5 #include "model/sheet.h" 6 #include "model/component.h" 7 #include "model/terminal.h" 11 #include <QGraphicsScene> 12 #include <QGraphicsItem> 42 const Sheet *getSheet()
const;
56 QPointF getSnappedCursorPos()
const;
57 bool getSnapCursorGuides()
const;
58 bool isGridEnabled()
const;
59 bool isSnapEnabled()
const;
60 QSizeF getGridSize()
const;
67 QPointF
snap(
const QPointF &pt)
const;
78 void setSheet(
Sheet *sheet);
85 void setSnapCursorGuides(
bool snap);
86 void setGridSize(
float x,
float y = -1);
87 void setGridSize(QSizeF size);
88 void setGridEnabled(
bool enabled);
89 void setSnapEnabled(
bool snap);
94 void command(QUndoCommand *command);
99 void gridIncrease(
Vim::N n = 0);
100 void gridDecrease(
Vim::N n = 0);
109 void selectPrimitive();
113 void suggestConnections(
GComponent *component);
114 void showGuides(
bool show);
127 bool *confirmed =
nullptr);
130 GObject *itemAt(
const QPointF &pt,
const QTransform &deviceTransform);
136 void itemMoveRequested();
139 void onSelectionChanged();
143 QPointF constrainToContentArea(QPointF pt)
const;
144 void applyCursorMovement(
const QPointF &pt);
149 void insertComponentOrHeader(
const Object &obj);
150 bool askHeaderChangeConfirmation()
const;
151 QList<QPair<Terminal::Prong, Terminal::Prong>>
152 getConnectionSuggestions(
GComponent *component);
156 void keyPressEvent(QKeyEvent *event)
override;
157 void mousePressEvent(QGraphicsSceneMouseEvent *event)
override;
158 void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
override;
159 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
override;
160 void dragMoveEvent(QGraphicsSceneDragDropEvent *event)
override;
161 void dragEnterEvent(QGraphicsSceneDragDropEvent *event)
override;
162 void dropEvent(QGraphicsSceneDragDropEvent *event)
override;
168 void onOperationFinished();
175 QUndoStack undoStack{
this};
178 QGraphicsRectItem *pageBackgroundItem;
179 QList<GConnectionSuggester*> _suggesters;
183 QPointF rawCursorPos;
185 bool snapGuides =
false,
186 showCursorGuides =
true;
189 float gridX = 5, gridY = 5;
190 bool gridEnabled =
true, snapEnabled =
true;
196 #endif // SHEETSCENE_H The abstract base class for all objects in a sheet.
Definition: object.h:21
void startOperation(SceneOperation *op)
Start a scene operation.
QPointF snap(const QPointF &pt) const
Return the point on the grid that is closest to pt.
QPointF getCursorPos() const
Return the processed cursor pos.
Graphical object that wraps a Component.
Definition: gcomponent.h:12
QPointF getRawCursorPos() const
Return the raw cursor position, before applying snap.
Count n()
The vim-count from the current key sequence.
A specialized QGraphicsScene containing a sheet of paper.
Definition: sheetscene.h:27
An action in vim-mode.
Definition: vim.h:81
void setHeader(Header *hdr, bool destroy=true)
Set the header in the scene and in the model.
Definition: gterminal.h:27
bool enabled()
Is vim-mode enabled?
The base class of all objects represented in a graphical scene.
Definition: gobject.h:24
Definition: gterminal.h:8
QPointF forcedSnap(const QPointF &pt) const
Return the point on the grid that is closest to pt.
Definition: terminal.h:45
SheetScene(Sheet *sheet)
Construct a scene based on the specified sheet.
The base class of all scene operations.
Definition: operations.h:22
This class models a sheet of paper.
Definition: sheet.h:16
A specialized QGraphicsView that displays a sheet of paper.
Definition: sheetview.h:16
Representation of a vim-count.
Definition: vim.h:48
void tryChangeHeader(Header *hdr, bool *changed=nullptr, bool *confirmed=nullptr)
Try to set the sheet header to hdr and update the scene.