QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
Layout view tool for adding items to a layout. More...
#include <qgslayoutviewtooladditem.h>
Signals | |
void | createdItem () |
Emitted when an item has been created using the tool. | |
Signals inherited from QgsLayoutViewTool | |
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 | |
QgsLayoutViewToolAddItem (QgsLayoutView *view) | |
Constructs a QgsLayoutViewToolAddItem for the given layout view. | |
void | activate () override |
Called when tool is set as the currently active layout tool. | |
QVariantMap | customProperties () const |
Returns any custom properties set for the tool. | |
void | deactivate () override |
Called when tool is deactivated. | |
int | itemMetadataId () const |
Returns the item metadata id for items created by the tool. | |
void | layoutMoveEvent (QgsLayoutViewMouseEvent *event) override |
Mouse move event for overriding. | |
void | layoutPressEvent (QgsLayoutViewMouseEvent *event) override |
Mouse press event for overriding. | |
void | layoutReleaseEvent (QgsLayoutViewMouseEvent *event) override |
Mouse release event for overriding. | |
void | setCustomProperties (const QVariantMap &properties) |
Sets custom properties for the tool. | |
void | setItemMetadataId (int metadataId) |
Sets the item metadata metadataId for items created by the tool. | |
Public Member Functions inherited from QgsLayoutViewTool | |
~QgsLayoutViewTool () override | |
QAction * | action () |
Returns the action associated with the tool or nullptr if no action is associated. | |
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. | |
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. | |
Additional Inherited Members | |
Public Types inherited from QgsLayoutViewTool | |
enum | Flag { FlagSnaps = 1 << 1 } |
Flags for controlling how a tool behaves. More... | |
typedef QFlags< Flag > | Flags |
Protected Member Functions inherited from QgsLayoutViewTool | |
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. | |
Layout view tool for adding items to a layout.
Definition at line 29 of file qgslayoutviewtooladditem.h.
QgsLayoutViewToolAddItem::QgsLayoutViewToolAddItem | ( | QgsLayoutView * | view | ) |
Constructs a QgsLayoutViewToolAddItem for the given layout view.
Definition at line 32 of file qgslayoutviewtooladditem.cpp.
|
overridevirtual |
Called when tool is set as the currently active layout tool.
Overridden implementations must take care to call the base class implementation.
Reimplemented from QgsLayoutViewTool.
Definition at line 159 of file qgslayoutviewtooladditem.cpp.
|
signal |
Emitted when an item has been created using the tool.
QVariantMap QgsLayoutViewToolAddItem::customProperties | ( | ) | const |
Returns any custom properties set for the tool.
Definition at line 177 of file qgslayoutviewtooladditem.cpp.
|
overridevirtual |
Called when tool is deactivated.
Overridden implementations must take care to call the base class implementation.
Reimplemented from QgsLayoutViewTool.
Definition at line 165 of file qgslayoutviewtooladditem.cpp.
int QgsLayoutViewToolAddItem::itemMetadataId | ( | ) | const |
Returns the item metadata id for items created by the tool.
Definition at line 187 of file qgslayoutviewtooladditem.cpp.
|
overridevirtual |
Mouse move event for overriding.
Default implementation does nothing.
Reimplemented from QgsLayoutViewTool.
Definition at line 66 of file qgslayoutviewtooladditem.cpp.
|
overridevirtual |
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 from QgsLayoutViewTool.
Definition at line 44 of file qgslayoutviewtooladditem.cpp.
|
overridevirtual |
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 from QgsLayoutViewTool.
Definition at line 78 of file qgslayoutviewtooladditem.cpp.
void QgsLayoutViewToolAddItem::setCustomProperties | ( | const QVariantMap & | properties | ) |
Sets custom properties for the tool.
These properties are transient, and are cleared whenever the tool is activated. Callers must ensure that the properties are set only after the tool is activated.
Definition at line 182 of file qgslayoutviewtooladditem.cpp.
void QgsLayoutViewToolAddItem::setItemMetadataId | ( | int | metadataId | ) |
Sets the item metadata metadataId for items created by the tool.
The metadataId associates the current tool behavior with a metadata entry from QgsLayoutItemGuiRegistry.
Definition at line 39 of file qgslayoutviewtooladditem.cpp.