QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
|
Abstract base class for all layout view tools. More...
#include <qgslayoutviewtool.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 (QgsLayoutItem *item) |
Emitted when an item is "focused" by the tool, i.e. | |
Public Member Functions | |
~QgsLayoutViewTool () 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 layout tool. | |
virtual void | deactivate () |
Called when tool is deactivated. | |
QgsLayoutViewTool::Flags | flags () const |
Returns the current combination of flags set for the tool. | |
virtual QList< QgsLayoutItem * > | ignoredSnapItems () const |
Returns a list of items which should be ignored while snapping events for this tool. | |
virtual void | keyPressEvent (QKeyEvent *event) |
Key press event for overriding. | |
virtual void | keyReleaseEvent (QKeyEvent *event) |
Key release event for overriding. | |
QgsLayout * | layout () const |
Returns the layout associated with the tool. | |
virtual void | layoutDoubleClickEvent (QgsLayoutViewMouseEvent *event) |
Mouse double-click event for overriding. | |
virtual void | layoutMoveEvent (QgsLayoutViewMouseEvent *event) |
Mouse move event for overriding. | |
virtual void | layoutPressEvent (QgsLayoutViewMouseEvent *event) |
Mouse press event for overriding. | |
virtual void | layoutReleaseEvent (QgsLayoutViewMouseEvent *event) |
Mouse release event for overriding. | |
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. | |
QgsLayoutView * | view () const |
Returns the view associated with the tool. | |
virtual void | wheelEvent (QWheelEvent *event) |
Mouse wheel event for overriding. | |
Protected Member Functions | |
QgsLayoutViewTool (QgsLayoutView *view, const QString &name) | |
Constructor for QgsLayoutViewTool, taking a layout 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 (QgsLayoutViewTool::Flags flags) |
Sets the combination of flags that will be used for the tool. | |
Friends | |
class | TestQgsLayoutView |
Abstract base class for all layout view tools.
Layout view tools are user interactive tools for manipulating and adding items to QgsLayoutView widgets.
Definition at line 45 of file qgslayoutviewtool.h.
typedef QFlags< Flag > QgsLayoutViewTool::Flags |
Definition at line 66 of file qgslayoutviewtool.h.
Flags for controlling how a tool behaves.
Enumerator | |
---|---|
FlagSnaps | Tool utilizes snapped coordinates. |
Definition at line 62 of file qgslayoutviewtool.h.
|
override |
Definition at line 54 of file qgslayoutviewtool.cpp.
|
protected |
Constructor for QgsLayoutViewTool, taking a layout view and tool name as parameters.
Definition at line 21 of file qgslayoutviewtool.cpp.
QAction * QgsLayoutViewTool::action | ( | ) |
Returns the action associated with the tool or nullptr
if no action is associated.
Definition at line 110 of file qgslayoutviewtool.cpp.
|
virtual |
Called when tool is set as the currently active layout tool.
Overridden implementations must take care to call the base class implementation.
Reimplemented in QgsLayoutViewToolAddItem, QgsLayoutViewToolEditNodes, QgsLayoutViewToolTemporaryKeyPan, QgsLayoutViewToolTemporaryKeyZoom, and QgsLayoutViewToolTemporaryMousePan.
Definition at line 121 of file qgslayoutviewtool.cpp.
|
signal |
Emitted when the tool is activated.
|
virtual |
Called when tool is deactivated.
Overridden implementations must take care to call the base class implementation.
Reimplemented in QgsLayoutViewToolAddItem, QgsLayoutViewToolAddNodeItem, QgsLayoutViewToolEditNodes, QgsLayoutViewToolPan, QgsLayoutViewToolSelect, and QgsLayoutViewToolZoom.
Definition at line 131 of file qgslayoutviewtool.cpp.
|
signal |
Emitted when the tool is deactivated.
QgsLayoutViewTool::Flags QgsLayoutViewTool::flags | ( | ) | const |
Returns the current combination of flags set for the tool.
Definition at line 60 of file qgslayoutviewtool.cpp.
|
virtual |
Returns a list of items which should be ignored while snapping events for this tool.
Reimplemented in QgsLayoutViewToolEditNodes.
Definition at line 49 of file qgslayoutviewtool.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 qgslayoutviewtool.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 QgsLayoutViewToolAddNodeItem, QgsLayoutViewToolEditNodes, QgsLayoutViewToolSelect, QgsLayoutViewToolTemporaryKeyZoom, and QgsLayoutViewToolZoom.
Definition at line 95 of file qgslayoutviewtool.cpp.
|
virtual |
Key release event for overriding.
Default implementation does nothing.
Reimplemented in QgsLayoutViewToolTemporaryKeyPan, QgsLayoutViewToolTemporaryKeyZoom, and QgsLayoutViewToolZoom.
Definition at line 100 of file qgslayoutviewtool.cpp.
QgsLayout * QgsLayoutViewTool::layout | ( | ) | const |
Returns the layout associated with the tool.
Definition at line 44 of file qgslayoutviewtool.cpp.
|
virtual |
Mouse double-click event for overriding.
Default implementation does nothing.
Reimplemented in QgsLayoutViewToolEditNodes.
Definition at line 75 of file qgslayoutviewtool.cpp.
|
virtual |
Mouse move event for overriding.
Default implementation does nothing.
Reimplemented in QgsLayoutViewToolAddItem, QgsLayoutViewToolAddNodeItem, QgsLayoutViewToolEditNodes, QgsLayoutViewToolMoveItemContent, QgsLayoutViewToolPan, QgsLayoutViewToolSelect, QgsLayoutViewToolTemporaryKeyPan, QgsLayoutViewToolTemporaryMousePan, and QgsLayoutViewToolZoom.
Definition at line 70 of file qgslayoutviewtool.cpp.
|
virtual |
Mouse press event for overriding.
Default implementation does nothing. Note that subclasses must ensure that they correctly handle cases when a layoutPressEvent is called without a corresponding layoutReleaseEvent (e.g. due to tool being changed mid way through a press-release operation).
Reimplemented in QgsLayoutViewToolAddItem, QgsLayoutViewToolAddNodeItem, QgsLayoutViewToolEditNodes, QgsLayoutViewToolMoveItemContent, QgsLayoutViewToolPan, QgsLayoutViewToolSelect, and QgsLayoutViewToolZoom.
Definition at line 80 of file qgslayoutviewtool.cpp.
|
virtual |
Mouse release event for overriding.
Default implementation does nothing. Note that subclasses must ensure that they correctly handle cases when a layoutPressEvent is called without a corresponding layoutReleaseEvent (e.g. due to tool being changed mid way through a press-release operation).
Reimplemented in QgsLayoutViewToolAddItem, QgsLayoutViewToolAddNodeItem, QgsLayoutViewToolEditNodes, QgsLayoutViewToolMoveItemContent, QgsLayoutViewToolPan, QgsLayoutViewToolSelect, QgsLayoutViewToolTemporaryKeyZoom, QgsLayoutViewToolTemporaryMousePan, and QgsLayoutViewToolZoom.
Definition at line 85 of file qgslayoutviewtool.cpp.
void QgsLayoutViewTool::setAction | ( | QAction * | action | ) |
Associates an action with this tool.
When the setLayoutTool method of QgsLayoutView 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 qgslayoutviewtool.cpp.
void QgsLayoutViewTool::setCursor | ( | const QCursor & | cursor | ) |
Sets a user defined cursor for use when the tool is active.
Definition at line 116 of file qgslayoutviewtool.cpp.
|
protected |
Sets the combination of flags that will be used for the tool.
Definition at line 65 of file qgslayoutviewtool.cpp.
|
inline |
Returns a user-visible, translated name for the tool.
Definition at line 154 of file qgslayoutviewtool.h.
QgsLayoutView * QgsLayoutViewTool::view | ( | ) | const |
Returns the view associated with the tool.
Definition at line 39 of file qgslayoutviewtool.cpp.
|
virtual |
Mouse wheel event for overriding.
Default implementation does nothing.
Reimplemented in QgsLayoutViewToolMoveItemContent, and QgsLayoutViewToolSelect.
Definition at line 90 of file qgslayoutviewtool.cpp.
|
friend |
Definition at line 230 of file qgslayoutviewtool.h.