QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
Public Types | Signals | Public Member Functions | Protected Member Functions | List of all members
QgsModelViewTool Class Reference

Abstract base class for all model designer view tools. More...

#include <qgsmodelviewtool.h>

Inheritance diagram for QgsModelViewTool:
Inheritance graph
[legend]

Public Types

enum  Flag { FlagSnaps = 1 << 1 }
 Flags for controlling how a tool behaves. More...
 
typedef QFlags< FlagFlags
 

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.
 

Detailed Description

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.

Since
QGIS 3.14

Definition at line 43 of file qgsmodelviewtool.h.

Member Typedef Documentation

◆ Flags

typedef QFlags< Flag > QgsModelViewTool::Flags

Definition at line 55 of file qgsmodelviewtool.h.

Member Enumeration Documentation

◆ Flag

Flags for controlling how a tool behaves.

Enumerator
FlagSnaps 

Tool utilizes snapped coordinates.

Definition at line 51 of file qgsmodelviewtool.h.

Constructor & Destructor Documentation

◆ ~QgsModelViewTool()

QgsModelViewTool::~QgsModelViewTool ( )
override

Definition at line 50 of file qgsmodelviewtool.cpp.

◆ QgsModelViewTool()

QgsModelViewTool::QgsModelViewTool ( QgsModelGraphicsView *  view,
const QString &  name 
)
protected

Constructor for QgsModelViewTool, taking a model view and tool name as parameters.

Definition at line 22 of file qgsmodelviewtool.cpp.

Member Function Documentation

◆ action()

QAction * QgsModelViewTool::action ( )

Returns the action associated with the tool or nullptr if no action is associated.

See also
setAction()

Definition at line 111 of file qgsmodelviewtool.cpp.

◆ activate()

void QgsModelViewTool::activate ( )
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.

◆ activated

void QgsModelViewTool::activated ( )
signal

Emitted when the tool is activated.

◆ allowItemInteraction()

bool QgsModelViewTool::allowItemInteraction ( )
virtual

Returns true if the tool allows interaction with component graphic items.

Reimplemented in QgsModelViewToolSelect.

Definition at line 101 of file qgsmodelviewtool.cpp.

◆ deactivate()

void QgsModelViewTool::deactivate ( )
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.

◆ deactivated

void QgsModelViewTool::deactivated ( )
signal

Emitted when the tool is deactivated.

◆ flags()

QgsModelViewTool::Flags QgsModelViewTool::flags ( ) const

Returns the current combination of flags set for the tool.

See also
setFlags()

Definition at line 56 of file qgsmodelviewtool.cpp.

◆ isClickAndDrag()

bool QgsModelViewTool::isClickAndDrag ( QPoint  startViewPoint,
QPoint  endViewPoint 
) const
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.

◆ itemFocused

void QgsModelViewTool::itemFocused ( QgsModelComponentGraphicItem *  item)
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.

◆ keyPressEvent()

void QgsModelViewTool::keyPressEvent ( QKeyEvent *  event)
virtual

Key press event for overriding.

Default implementation does nothing.

Reimplemented in QgsModelViewToolSelect, QgsModelViewToolTemporaryKeyZoom, and QgsModelViewToolZoom.

Definition at line 91 of file qgsmodelviewtool.cpp.

◆ keyReleaseEvent()

void QgsModelViewTool::keyReleaseEvent ( QKeyEvent *  event)
virtual

Key release event for overriding.

Default implementation does nothing.

Reimplemented in QgsModelViewToolTemporaryKeyPan, QgsModelViewToolTemporaryKeyZoom, and QgsModelViewToolZoom.

Definition at line 96 of file qgsmodelviewtool.cpp.

◆ modelDoubleClickEvent()

void QgsModelViewTool::modelDoubleClickEvent ( QgsModelViewMouseEvent event)
virtual

Mouse double-click event for overriding.

Default implementation does nothing.

Reimplemented in QgsModelViewToolSelect.

Definition at line 71 of file qgsmodelviewtool.cpp.

◆ modelMoveEvent()

void QgsModelViewTool::modelMoveEvent ( QgsModelViewMouseEvent event)
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.

◆ modelPressEvent()

void QgsModelViewTool::modelPressEvent ( QgsModelViewMouseEvent event)
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.

◆ modelReleaseEvent()

void QgsModelViewTool::modelReleaseEvent ( QgsModelViewMouseEvent event)
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.

◆ scene()

QgsModelGraphicsScene * QgsModelViewTool::scene ( ) const

Returns the scene associated with the tool.

See also
view()

Definition at line 45 of file qgsmodelviewtool.cpp.

◆ setAction()

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.

See also
action()

Definition at line 106 of file qgsmodelviewtool.cpp.

◆ setCursor()

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.

◆ setFlags()

void QgsModelViewTool::setFlags ( QgsModelViewTool::Flags  flags)
protected

Sets the combination of flags that will be used for the tool.

See also
flags()

Definition at line 61 of file qgsmodelviewtool.cpp.

◆ toolName()

QString QgsModelViewTool::toolName ( ) const
inline

Returns a user-visible, translated name for the tool.

Definition at line 148 of file qgsmodelviewtool.h.

◆ view()

QgsModelGraphicsView * QgsModelViewTool::view ( ) const

Returns the view associated with the tool.

See also
scene()

Definition at line 40 of file qgsmodelviewtool.cpp.

◆ wheelEvent()

void QgsModelViewTool::wheelEvent ( QWheelEvent *  event)
virtual

Mouse wheel event for overriding.

Default implementation does nothing.

Reimplemented in QgsModelViewToolSelect.

Definition at line 86 of file qgsmodelviewtool.cpp.


The documentation for this class was generated from the following files: