QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Abstract base class for all model designer view tools. More...
#include <qgsmodelviewtool.h>
Public Types | |
enum | Flag { FlagSnaps = 1 << 1 } |
Flags for controlling how a tool behaves. More... | |
Signals | |
void | activated () |
Emitted when the tool is activated. More... | |
void | deactivated () |
Emitted when the tool is deactivated. More... | |
void | itemFocused (QgsModelComponentGraphicItem *item) |
Emitted when an item is "focused" by the tool, i.e. More... | |
Public Member Functions | |
~QgsModelViewTool () override | |
QAction * | action () |
Returns the action associated with the tool or nullptr if no action is associated. More... | |
virtual void | activate () |
Called when tool is set as the currently active model tool. More... | |
virtual bool | allowItemInteraction () |
Returns true if the tool allows interaction with component graphic items. More... | |
virtual void | deactivate () |
Called when tool is deactivated. More... | |
QgsModelViewTool::Flags | flags () const |
Returns the current combination of flags set for the tool. More... | |
virtual void | keyPressEvent (QKeyEvent *event) |
Key press event for overriding. More... | |
virtual void | keyReleaseEvent (QKeyEvent *event) |
Key release event for overriding. More... | |
virtual void | modelDoubleClickEvent (QgsModelViewMouseEvent *event) |
Mouse double-click event for overriding. More... | |
virtual void | modelMoveEvent (QgsModelViewMouseEvent *event) |
Mouse move event for overriding. More... | |
virtual void | modelPressEvent (QgsModelViewMouseEvent *event) |
Mouse press event for overriding. More... | |
virtual void | modelReleaseEvent (QgsModelViewMouseEvent *event) |
Mouse release event for overriding. More... | |
QgsModelGraphicsScene * | scene () const |
Returns the scene associated with the tool. More... | |
void | setAction (QAction *action) |
Associates an action with this tool. More... | |
void | setCursor (const QCursor &cursor) |
Sets a user defined cursor for use when the tool is active. More... | |
QString | toolName () const |
Returns a user-visible, translated name for the tool. More... | |
QgsModelGraphicsView * | view () const |
Returns the view associated with the tool. More... | |
virtual void | wheelEvent (QWheelEvent *event) |
Mouse wheel event for overriding. More... | |
Protected Member Functions | |
QgsModelViewTool (QgsModelGraphicsView *view, const QString &name) | |
Constructor for QgsModelViewTool, taking a model view and tool name as parameters. More... | |
bool | isClickAndDrag (QPoint startViewPoint, QPoint endViewPoint) const |
Returns true if a mouse press/release operation which started at startViewPoint and ended at endViewPoint should be considered a "click and drag". More... | |
void | setFlags (QgsModelViewTool::Flags flags) |
Sets the combination of flags that will be used for the tool. More... | |
Abstract base class for all model designer view tools.
Model designer view tools are user interactive tools for manipulating and adding items within the model designer.
Definition at line 43 of file qgsmodelviewtool.h.
Flags for controlling how a tool behaves.
Enumerator | |
---|---|
FlagSnaps | Tool utilizes snapped coordinates. |
Definition at line 51 of file qgsmodelviewtool.h.
|
override |
Definition at line 49 of file qgsmodelviewtool.cpp.
|
protected |
Constructor for QgsModelViewTool, taking a model view and tool name as parameters.
Definition at line 21 of file qgsmodelviewtool.cpp.
QAction * QgsModelViewTool::action | ( | ) |
Returns the action associated with the tool or nullptr
if no action is associated.
Definition at line 110 of file qgsmodelviewtool.cpp.
|
virtual |
Called when tool is set as the currently active model tool.
Overridden implementations must take care to call the base class implementation.
Reimplemented in QgsModelViewToolTemporaryMousePan, QgsModelViewToolTemporaryKeyZoom, and QgsModelViewToolTemporaryKeyPan.
Definition at line 120 of file qgsmodelviewtool.cpp.
|
signal |
Emitted when the tool is activated.
|
virtual |
Returns true
if the tool allows interaction with component graphic items.
Reimplemented in QgsModelViewToolSelect.
Definition at line 100 of file qgsmodelviewtool.cpp.
|
virtual |
Called when tool is deactivated.
Overridden implementations must take care to call the base class implementation.
Reimplemented in QgsModelViewToolZoom, and QgsModelViewToolSelect.
Definition at line 130 of file qgsmodelviewtool.cpp.
|
signal |
Emitted when the tool is deactivated.
QgsModelViewTool::Flags QgsModelViewTool::flags | ( | ) | const |
Returns the current combination of flags set for the tool.
Definition at line 55 of file qgsmodelviewtool.cpp.
|
protected |
Returns true
if a mouse press/release operation which started at startViewPoint and ended at endViewPoint should be considered a "click and drag".
If false
is returned, the operation should be instead treated as just a click on startViewPoint.
Definition at line 32 of file qgsmodelviewtool.cpp.
|
signal |
Emitted when an item is "focused" by the tool, i.e.
it should become the active item and should have its properties displayed in any designer windows.
|
virtual |
Key press event for overriding.
Default implementation does nothing.
Reimplemented in QgsModelViewToolZoom, QgsModelViewToolTemporaryKeyZoom, and QgsModelViewToolSelect.
Definition at line 90 of file qgsmodelviewtool.cpp.
|
virtual |
Key release event for overriding.
Default implementation does nothing.
Reimplemented in QgsModelViewToolZoom, QgsModelViewToolTemporaryKeyZoom, and QgsModelViewToolTemporaryKeyPan.
Definition at line 95 of file qgsmodelviewtool.cpp.
|
virtual |
Mouse double-click event for overriding.
Default implementation does nothing.
Reimplemented in QgsModelViewToolSelect.
Definition at line 70 of file qgsmodelviewtool.cpp.
|
virtual |
Mouse move event for overriding.
Default implementation does nothing.
Reimplemented in QgsModelViewToolZoom, QgsModelViewToolTemporaryMousePan, QgsModelViewToolTemporaryKeyPan, and QgsModelViewToolSelect.
Definition at line 65 of file qgsmodelviewtool.cpp.
|
virtual |
Mouse press event for overriding.
Default implementation does nothing. Note that subclasses must ensure that they correctly handle cases when a modelPressEvent is called without a corresponding modelReleaseEvent (e.g. due to tool being changed mid way through a press-release operation).
Reimplemented in QgsModelViewToolZoom, and QgsModelViewToolSelect.
Definition at line 75 of file qgsmodelviewtool.cpp.
|
virtual |
Mouse release event for overriding.
Default implementation does nothing. Note that subclasses must ensure that they correctly handle cases when a modelPressEvent is called without a corresponding modelReleaseEvent (e.g. due to tool being changed mid way through a press-release operation).
Reimplemented in QgsModelViewToolZoom, QgsModelViewToolTemporaryMousePan, QgsModelViewToolTemporaryKeyZoom, and QgsModelViewToolSelect.
Definition at line 80 of file qgsmodelviewtool.cpp.
QgsModelGraphicsScene * QgsModelViewTool::scene | ( | ) | const |
Returns the scene associated with the tool.
Definition at line 44 of file qgsmodelviewtool.cpp.
void QgsModelViewTool::setAction | ( | QAction * | action | ) |
Associates an action with this tool.
When the setModelTool method of QgsModelGraphicsView is called the action's state will be set to on. Usually this will cause a toolbutton to appear pressed in and the previously used toolbutton to pop out.
Definition at line 105 of file qgsmodelviewtool.cpp.
void QgsModelViewTool::setCursor | ( | const QCursor & | cursor | ) |
Sets a user defined cursor for use when the tool is active.
Definition at line 115 of file qgsmodelviewtool.cpp.
|
protected |
Sets the combination of flags that will be used for the tool.
Definition at line 60 of file qgsmodelviewtool.cpp.
|
inline |
Returns a user-visible, translated name for the tool.
Definition at line 148 of file qgsmodelviewtool.h.
QgsModelGraphicsView * QgsModelViewTool::view | ( | ) | const |
Returns the view associated with the tool.
Definition at line 39 of file qgsmodelviewtool.cpp.
|
virtual |
Mouse wheel event for overriding.
Default implementation does nothing.
Reimplemented in QgsModelViewToolSelect.
Definition at line 85 of file qgsmodelviewtool.cpp.