QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
|
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. | |
void | deactivated () |
Emitted when the tool is deactivated. | |
void | itemFocused (QgsModelComponentGraphicItem *item) |
Emitted when an item is "focused" by the tool, i.e. | |
Public Member Functions | |
~QgsModelViewTool () override | |
QAction * | action () |
Returns the action associated with the tool or nullptr if no action is associated. | |
virtual void | activate () |
Called when tool is set as the currently active model tool. | |
virtual bool | allowItemInteraction () |
Returns true if the tool allows interaction with component graphic items. | |
virtual void | deactivate () |
Called when tool is deactivated. | |
QgsModelViewTool::Flags | flags () const |
Returns the current combination of flags set for the tool. | |
virtual void | keyPressEvent (QKeyEvent *event) |
Key press event for overriding. | |
virtual void | keyReleaseEvent (QKeyEvent *event) |
Key release event for overriding. | |
virtual void | modelDoubleClickEvent (QgsModelViewMouseEvent *event) |
Mouse double-click event for overriding. | |
virtual void | modelMoveEvent (QgsModelViewMouseEvent *event) |
Mouse move event for overriding. | |
virtual void | modelPressEvent (QgsModelViewMouseEvent *event) |
Mouse press event for overriding. | |
virtual void | modelReleaseEvent (QgsModelViewMouseEvent *event) |
Mouse release event for overriding. | |
QgsModelGraphicsScene * | scene () const |
Returns the scene associated with the tool. | |
void | setAction (QAction *action) |
Associates an action with this tool. | |
void | setCursor (const QCursor &cursor) |
Sets a user defined cursor for use when the tool is active. | |
QString | toolName () const |
Returns a user-visible, translated name for the tool. | |
QgsModelGraphicsView * | view () const |
Returns the view associated with the tool. | |
virtual void | wheelEvent (QWheelEvent *event) |
Mouse wheel event for overriding. | |
Protected Member Functions | |
QgsModelViewTool (QgsModelGraphicsView *view, const QString &name) | |
Constructor for QgsModelViewTool, taking a model view and tool name as parameters. | |
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". | |
void | setFlags (QgsModelViewTool::Flags flags) |
Sets the combination of flags that will be used for the tool. | |
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 QgsModelViewToolTemporaryKeyPan, QgsModelViewToolTemporaryKeyZoom, and QgsModelViewToolTemporaryMousePan.
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 QgsModelViewToolPan, QgsModelViewToolSelect, and QgsModelViewToolZoom.
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 QgsModelViewToolSelect, QgsModelViewToolTemporaryKeyZoom, and QgsModelViewToolZoom.
Definition at line 90 of file qgsmodelviewtool.cpp.
|
virtual |
Key release event for overriding.
Default implementation does nothing.
Reimplemented in QgsModelViewToolTemporaryKeyPan, QgsModelViewToolTemporaryKeyZoom, and QgsModelViewToolZoom.
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 QgsModelViewToolPan, QgsModelViewToolSelect, QgsModelViewToolTemporaryKeyPan, QgsModelViewToolTemporaryMousePan, and QgsModelViewToolZoom.
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 QgsModelViewToolPan, QgsModelViewToolSelect, and QgsModelViewToolZoom.
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 QgsModelViewToolPan, QgsModelViewToolSelect, QgsModelViewToolTemporaryKeyZoom, QgsModelViewToolTemporaryMousePan, and QgsModelViewToolZoom.
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.