QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
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... | |
typedef QFlags< Flag > | Flags |
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.
typedef QFlags< Flag > QgsModelViewTool::Flags |
Definition at line 55 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 50 of file qgsmodelviewtool.cpp.
|
protected |
Constructor for QgsModelViewTool, taking a model view and tool name as parameters.
Definition at line 22 of file qgsmodelviewtool.cpp.
QAction * QgsModelViewTool::action | ( | ) |
Returns the action associated with the tool or nullptr
if no action is associated.
Definition at line 111 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 121 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 101 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 131 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 56 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 33 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 91 of file qgsmodelviewtool.cpp.
|
virtual |
Key release event for overriding.
Default implementation does nothing.
Reimplemented in QgsModelViewToolTemporaryKeyPan, QgsModelViewToolTemporaryKeyZoom, and QgsModelViewToolZoom.
Definition at line 96 of file qgsmodelviewtool.cpp.
|
virtual |
Mouse double-click event for overriding.
Default implementation does nothing.
Reimplemented in QgsModelViewToolSelect.
Definition at line 71 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 66 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 76 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 81 of file qgsmodelviewtool.cpp.
QgsModelGraphicsScene * QgsModelViewTool::scene | ( | ) | const |
Returns the scene associated with the tool.
Definition at line 45 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 106 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 116 of file qgsmodelviewtool.cpp.
|
protected |
Sets the combination of flags that will be used for the tool.
Definition at line 61 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 40 of file qgsmodelviewtool.cpp.
|
virtual |
Mouse wheel event for overriding.
Default implementation does nothing.
Reimplemented in QgsModelViewToolSelect.
Definition at line 86 of file qgsmodelviewtool.cpp.