QGIS API Documentation
3.6.0-Noosa (5873452)
|
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. More... | |
void | deactivated () |
Emitted when the tool is deactivated. More... | |
void | itemFocused (QgsLayoutItem *item) |
Emitted when an item is "focused" by the tool, i.e. More... | |
Public Member Functions | |
~QgsLayoutViewTool () override | |
QAction * | action () |
Returns the action associated with the tool or nullptr if no action is associated. More... | |
virtual void | activate () |
Called when tool is set as the currently active layout tool. More... | |
virtual void | deactivate () |
Called when tool is deactivated. More... | |
QgsLayoutViewTool::Flags | flags () const |
Returns the current combination of flags set for the tool. More... | |
virtual QList< QgsLayoutItem *> | ignoredSnapItems () const |
Returns a list of items which should be ignored while snapping events for this tool. More... | |
virtual void | keyPressEvent (QKeyEvent *event) |
Key press event for overriding. More... | |
virtual void | keyReleaseEvent (QKeyEvent *event) |
Key release event for overriding. More... | |
QgsLayout * | layout () const |
Returns the layout associated with the tool. More... | |
virtual void | layoutDoubleClickEvent (QgsLayoutViewMouseEvent *event) |
Mouse double-click event for overriding. More... | |
virtual void | layoutMoveEvent (QgsLayoutViewMouseEvent *event) |
Mouse move event for overriding. More... | |
virtual void | layoutPressEvent (QgsLayoutViewMouseEvent *event) |
Mouse press event for overriding. More... | |
virtual void | layoutReleaseEvent (QgsLayoutViewMouseEvent *event) |
Mouse release event for overriding. More... | |
void | setAction (QAction *action) |
Associates an action with this tool. More... | |
void | setCursor (const QCursor &cursor) |
Sets a user defined cursor for use when the tool is active. More... | |
QString | toolName () const |
Returns a user-visible, translated name for the tool. More... | |
QgsLayoutView * | view () const |
Returns the view associated with the tool. More... | |
virtual void | wheelEvent (QWheelEvent *event) |
Mouse wheel event for overriding. More... | |
Protected Member Functions | |
QgsLayoutViewTool (QgsLayoutView *view, const QString &name) | |
Constructor for QgsLayoutViewTool, taking a layout view and tool name as parameters. More... | |
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". More... | |
void | setFlags (QgsLayoutViewTool::Flags flags) |
Sets the combination of flags that will be used for the tool. More... | |
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 QgsLayoutViewToolEditNodes, QgsLayoutViewToolTemporaryKeyZoom, QgsLayoutViewToolTemporaryKeyPan, 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 QgsLayoutViewToolAddNodeItem, QgsLayoutViewToolAddItem, QgsLayoutViewToolEditNodes, QgsLayoutViewToolSelect, QgsLayoutViewToolZoom, and QgsLayoutViewToolPan.
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, QgsLayoutViewToolZoom, and QgsLayoutViewToolTemporaryKeyZoom.
Definition at line 94 of file qgslayoutviewtool.cpp.
|
virtual |
Key release event for overriding.
Default implementation does nothing.
Reimplemented in QgsLayoutViewToolZoom, QgsLayoutViewToolTemporaryKeyZoom, and QgsLayoutViewToolTemporaryKeyPan.
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, QgsLayoutViewToolSelect, QgsLayoutViewToolZoom, QgsLayoutViewToolMoveItemContent, QgsLayoutViewToolPan, QgsLayoutViewToolTemporaryKeyPan, and QgsLayoutViewToolTemporaryMousePan.
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, QgsLayoutViewToolSelect, QgsLayoutViewToolZoom, QgsLayoutViewToolMoveItemContent, and QgsLayoutViewToolPan.
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, QgsLayoutViewToolSelect, QgsLayoutViewToolZoom, QgsLayoutViewToolMoveItemContent, QgsLayoutViewToolPan, QgsLayoutViewToolTemporaryKeyZoom, and QgsLayoutViewToolTemporaryMousePan.
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 QgsLayoutViewToolSelect, and QgsLayoutViewToolMoveItemContent.
Definition at line 89 of file qgslayoutviewtool.cpp.
|
friend |
Definition at line 231 of file qgslayoutviewtool.h.