QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
|
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... | |
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 46 of file qgslayoutviewtool.h.
Flags for controlling how a tool behaves.
Enumerator | |
---|---|
FlagSnaps | Tool utilizes snapped coordinates. |
Definition at line 63 of file qgslayoutviewtool.h.
|
override |
Definition at line 53 of file qgslayoutviewtool.cpp.
|
protected |
Constructor for QgsLayoutViewTool, taking a layout view and tool name as parameters.
Definition at line 20 of file qgslayoutviewtool.cpp.
QAction * QgsLayoutViewTool::action | ( | ) |
Returns the action associated with the tool or nullptr
if no action is associated.
Definition at line 109 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 120 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 130 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 59 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 48 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 31 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 94 of file qgslayoutviewtool.cpp.
|
virtual |
Key release event for overriding.
Default implementation does nothing.
Reimplemented in QgsLayoutViewToolTemporaryKeyPan, QgsLayoutViewToolTemporaryKeyZoom, and QgsLayoutViewToolZoom.
Definition at line 99 of file qgslayoutviewtool.cpp.
QgsLayout * QgsLayoutViewTool::layout | ( | ) | const |
Returns the layout associated with the tool.
Definition at line 43 of file qgslayoutviewtool.cpp.
|
virtual |
Mouse double-click event for overriding.
Default implementation does nothing.
Reimplemented in QgsLayoutViewToolEditNodes.
Definition at line 74 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 69 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 79 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 84 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 104 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 115 of file qgslayoutviewtool.cpp.
|
protected |
Sets the combination of flags that will be used for the tool.
Definition at line 64 of file qgslayoutviewtool.cpp.
|
inline |
Returns a user-visible, translated name for the tool.
Definition at line 155 of file qgslayoutviewtool.h.
QgsLayoutView * QgsLayoutViewTool::view | ( | ) | const |
Returns the view associated with the tool.
Definition at line 38 of file qgslayoutviewtool.cpp.
|
virtual |
Mouse wheel event for overriding.
Default implementation does nothing.
Reimplemented in QgsLayoutViewToolMoveItemContent, and QgsLayoutViewToolSelect.
Definition at line 89 of file qgslayoutviewtool.cpp.
|
friend |
Definition at line 231 of file qgslayoutviewtool.h.