QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
|
A collection of grids which is drawn above the map content in a QgsLayoutItemMap. More...
#include <qgslayoutitemmapgrid.h>
Public Member Functions | |
QgsLayoutItemMapGridStack (QgsLayoutItemMap *map) | |
Constructor for QgsLayoutItemMapGridStack, attached to the specified map. | |
void | addGrid (QgsLayoutItemMapGrid *grid) |
Adds a new map grid to the stack and takes ownership of the grid. | |
QList< QgsLayoutItemMapGrid * > | asList () const |
Returns a list of QgsLayoutItemMapGrids contained by the stack. | |
void | calculateMaxGridExtension (double &top, double &right, double &bottom, double &left) const |
Calculates the maximum distance grids within the stack extend beyond the QgsLayoutItemMap's item rect. | |
QgsLayoutItemMapGrid * | grid (const QString &gridId) const |
Returns a reference to a grid with matching gridId within the stack. | |
QgsLayoutItemMapGrid * | grid (int index) const |
Returns a reference to a grid at the specified index within the stack. | |
double | maxGridExtension () const |
Calculates the maximum distance grids within the stack extend beyond the QgsLayoutItemMap's item rect. | |
void | moveGridDown (const QString &gridId) |
Moves a grid with matching gridId down the stack, causing it to be rendered below other grids. | |
void | moveGridUp (const QString &gridId) |
Moves a grid with matching gridId up the stack, causing it to be rendered above other grids. | |
QgsLayoutItemMapGrid & | operator[] (int index) |
Returns a reference to a grid at the specified index within the stack. | |
bool | readXml (const QDomElement &elem, const QDomDocument &doc, const QgsReadWriteContext &context) override |
Sets the item stack's state from a DOM document, where element is a DOM node corresponding to a 'LayoutMap' tag. | |
void | removeGrid (const QString &gridId) |
Removes a grid with matching gridId from the stack and deletes the corresponding QgsLayoutItemMapGrid. | |
Public Member Functions inherited from QgsLayoutItemMapItemStack | |
QgsLayoutItemMapItemStack (QgsLayoutItemMap *map) | |
Constructor for QgsLayoutItemMapItemStack, attached to the specified map. | |
virtual | ~QgsLayoutItemMapItemStack () |
bool | containsAdvancedEffects () const |
Returns whether any items within the stack contain advanced effects, such as blending modes. | |
void | drawItems (QPainter *painter, bool ignoreStacking=true) |
Draws the items from the stack on a specified painter. | |
virtual void | finalizeRestoreFromXml () |
Called after all pending items have been restored from XML. | |
bool | hasEnabledItems () const |
Returns true if the stack has any currently enabled items. | |
QgsLayoutItemMapItem * | item (int index) const |
Returns a reference to the item at the specified index within the stack. | |
int | size () const |
Returns the number of items in the stack. | |
virtual bool | writeXml (QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context) const |
Stores the state of the item stack in a DOM node, where element is the DOM element corresponding to a 'LayoutMap' tag. | |
Additional Inherited Members | |
Protected Member Functions inherited from QgsLayoutItemMapItemStack | |
void | addItem (QgsLayoutItemMapItem *item) |
Adds a new map item to the stack and takes ownership of the item. | |
QList< QgsLayoutItemMapItem * > | asList () const |
Returns a list of QgsLayoutItemMapItems contained by the stack. | |
QgsLayoutItemMapItem * | item (const QString &itemId) const |
Returns a reference to an item which matching itemId within the stack. | |
void | moveItemDown (const QString &itemId) |
Moves an item which matching itemId up the stack, causing it to be rendered above other items. | |
void | moveItemUp (const QString &itemId) |
Moves an item which matching itemId up the stack, causing it to be rendered above other items. | |
QgsLayoutItemMapItem & | operator[] (int index) |
Returns a reference to an item at the specified index within the stack. | |
void | removeItem (const QString &itemId) |
Removes an item which matching itemId from the stack and deletes the corresponding QgsLayoutItemMapItem. | |
void | removeItems () |
Clears the item stack and deletes all QgsLayoutItemMapItems contained by the stack. | |
Protected Attributes inherited from QgsLayoutItemMapItemStack | |
QList< QgsLayoutItemMapItem * > | mItems |
QgsLayoutItemMap * | mMap = nullptr |
A collection of grids which is drawn above the map content in a QgsLayoutItemMap.
The grid stack controls which grids are drawn and the order they are drawn in.
Definition at line 45 of file qgslayoutitemmapgrid.h.
QgsLayoutItemMapGridStack::QgsLayoutItemMapGridStack | ( | QgsLayoutItemMap * | map | ) |
Constructor for QgsLayoutItemMapGridStack, attached to the specified map.
Definition at line 52 of file qgslayoutitemmapgrid.cpp.
void QgsLayoutItemMapGridStack::addGrid | ( | QgsLayoutItemMapGrid * | grid | ) |
Adds a new map grid to the stack and takes ownership of the grid.
The grid will be added to the end of the stack, and rendered above any existing map grids already present in the stack.
Definition at line 58 of file qgslayoutitemmapgrid.cpp.
QList< QgsLayoutItemMapGrid * > QgsLayoutItemMapGridStack::asList | ( | ) | const |
Returns a list of QgsLayoutItemMapGrids contained by the stack.
Definition at line 90 of file qgslayoutitemmapgrid.cpp.
void QgsLayoutItemMapGridStack::calculateMaxGridExtension | ( | double & | top, |
double & | right, | ||
double & | bottom, | ||
double & | left | ||
) | const |
Calculates the maximum distance grids within the stack extend beyond the QgsLayoutItemMap's item rect.
This method calculates the distance for each side of the map item separately.
Definition at line 137 of file qgslayoutitemmapgrid.cpp.
QgsLayoutItemMapGrid * QgsLayoutItemMapGridStack::grid | ( | const QString & | gridId | ) | const |
Returns a reference to a grid with matching gridId within the stack.
Definition at line 78 of file qgslayoutitemmapgrid.cpp.
QgsLayoutItemMapGrid * QgsLayoutItemMapGridStack::grid | ( | int | index | ) | const |
Returns a reference to a grid at the specified index within the stack.
Definition at line 84 of file qgslayoutitemmapgrid.cpp.
double QgsLayoutItemMapGridStack::maxGridExtension | ( | ) | const |
Calculates the maximum distance grids within the stack extend beyond the QgsLayoutItemMap's item rect.
Definition at line 127 of file qgslayoutitemmapgrid.cpp.
void QgsLayoutItemMapGridStack::moveGridDown | ( | const QString & | gridId | ) |
Moves a grid with matching gridId down the stack, causing it to be rendered below other grids.
Definition at line 73 of file qgslayoutitemmapgrid.cpp.
void QgsLayoutItemMapGridStack::moveGridUp | ( | const QString & | gridId | ) |
Moves a grid with matching gridId up the stack, causing it to be rendered above other grids.
Definition at line 68 of file qgslayoutitemmapgrid.cpp.
QgsLayoutItemMapGrid & QgsLayoutItemMapGridStack::operator[] | ( | int | index | ) |
Returns a reference to a grid at the specified index within the stack.
Definition at line 103 of file qgslayoutitemmapgrid.cpp.
|
overridevirtual |
Sets the item stack's state from a DOM document, where element is a DOM node corresponding to a 'LayoutMap' tag.
Returns true
if read was successful.
Implements QgsLayoutItemMapItemStack.
Definition at line 110 of file qgslayoutitemmapgrid.cpp.
void QgsLayoutItemMapGridStack::removeGrid | ( | const QString & | gridId | ) |
Removes a grid with matching gridId from the stack and deletes the corresponding QgsLayoutItemMapGrid.
Definition at line 63 of file qgslayoutitemmapgrid.cpp.