QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
19 #include "qgis_core.h"
20 #include <QGraphicsScene>
64 ZMouseHandles = 10000,
66 ZSnapIndicator = 10002,
97 void initializeDefaults();
122 template<class T>
void layoutItems( QList<T *> &itemList ) const
SIP_SKIP
125 QList<QGraphicsItem *> graphicsItemList = items();
126 QList<QGraphicsItem *>::iterator itemIt = graphicsItemList.begin();
127 for ( ; itemIt != graphicsItemList.end(); ++itemIt )
129 T *item =
dynamic_cast<T *
>( *itemIt );
132 itemList.push_back( item );
144 const QList<QGraphicsItem *> itemList( items() );
145 const QList<QgsLayoutMultiFrame *> frameList( multiFrames() );
146 for (
const auto &obj : itemList )
148 T *item =
dynamic_cast<T *
>( obj );
151 objectList.push_back( item );
154 for (
const auto &obj : frameList )
156 T *item =
dynamic_cast<T *
>( obj );
159 objectList.push_back( item );
170 QList<QgsLayoutItem *> selectedLayoutItems(
bool includeLockedItems =
true );
197 bool raiseItem(
QgsLayoutItem *item,
bool deferUpdate =
false );
211 bool lowerItem(
QgsLayoutItem *item,
bool deferUpdate =
false );
225 bool moveItemToTop(
QgsLayoutItem *item,
bool deferUpdate =
false );
238 bool moveItemToBottom(
QgsLayoutItem *item,
bool deferUpdate =
false );
245 void updateZValues(
bool addUndoCommands =
true );
262 QgsLayoutItem *itemByUuid(
const QString &uuid,
bool includeTemplateUuids =
false )
const;
279 QgsLayoutItem *itemByTemplateUuid(
const QString &uuid )
const;
302 QgsLayoutMultiFrame *multiFrameByUuid(
const QString &uuid,
bool includeTemplateUuids =
false )
const;
308 QgsLayoutItem *layoutItemAt( QPointF position,
bool ignoreLocked =
false )
const;
345 QSizeF convertToLayoutUnits(
const QgsLayoutSize &size )
const;
353 QPointF convertToLayoutUnits(
const QgsLayoutPoint &point )
const;
430 void reloadSettings();
456 void setCustomProperty(
const QString &key,
const QVariant &value );
467 QVariant customProperty(
const QString &key,
const QVariant &defaultValue = QVariant() )
const;
476 void removeCustomProperty(
const QString &key );
484 QStringList customProperties()
const;
522 QRectF layoutBounds(
bool ignorePages =
false,
double margin = 0.0 )
const;
534 QRectF pageItemBounds(
int page,
bool visibleOnly =
false )
const;
568 QList< QgsLayoutMultiFrame * > multiFrames()
const;
588 QList< QgsLayoutItem * > loadFromTemplate(
const QDomDocument &document,
const QgsReadWriteContext &context,
bool clearExisting =
true,
bool *ok
SIP_OUT =
nullptr );
594 virtual QDomElement writeXml( QDomDocument &document,
const QgsReadWriteContext &context )
const;
600 virtual bool readXml(
const QDomElement &layoutElement,
const QDomDocument &document,
const QgsReadWriteContext &context );
614 QList< QgsLayoutItem * > addItemsFromXml(
const QDomElement &parentElement,
const QDomDocument &document,
616 QPointF *position =
nullptr,
bool pasteInPlace =
false );
695 void variablesChanged();
714 void backgroundTaskCountChanged(
int total );
724 void itemBackgroundTaskCountChanged(
int count );
729 std::unique_ptr< QgsLayoutModel > mItemsModel;
739 std::unique_ptr< QgsLayoutPageCollection > mPageCollection;
740 std::unique_ptr< QgsLayoutUndoStack > mUndoStack;
743 QList<QgsLayoutMultiFrame *> mMultiFrames;
746 QString mWorldFileMapId;
748 QHash< QgsLayoutItem *, int > mBackgroundTaskCount;
751 void writeXmlLayoutSettings( QDomElement &element, QDomDocument &document,
const QgsReadWriteContext &context )
const;
753 bool readXmlLayoutSettings(
const QDomElement &layoutElement,
const QDomDocument &document,
const QgsReadWriteContext &context );
765 void deleteAndRemoveMultiFrames();
768 QPointF minPointFromXml(
const QDomElement &elem )
const;
773 friend class QgsLayoutItemAddItemCommand;
774 friend class QgsLayoutItemDeleteUndoCommand;
775 friend class QgsLayoutItemUndoCommand;
776 friend class QgsLayoutUndoCommand;
777 friend class QgsLayoutItemGroupUndoCommand;
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
virtual QgsAbstractLayoutUndoCommand * createCommand(const QString &text, int id=0, QUndoCommand *parent=nullptr)=0
Creates a new layout undo command with the specified text and parent.
The class is used as a container of context for various read/write operations on other objects.
const QgsLayoutSnapper & snapper() const
Returns a reference to the layout's snapper, which stores handles layout snap grids and lines and sna...
const QgsLayoutGridSettings & gridSettings() const
Returns a reference to the layout's grid settings, which stores settings relating to grid appearance,...
LayoutUnit
Layout measurement units.
Stores information relating to the current rendering settings for a layout.
Stores information relating to the current reporting context for a layout.
An interface for classes which can visit style entity (e.g. symbol) nodes (using the visitor pattern)...
QgsUnitTypes::LayoutUnit units() const
Returns the native units for the layout.
Abstract base class for layout items with the ability to distribute the content to several frames (Qg...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
void setUnits(QgsUnitTypes::LayoutUnit units)
Sets the native measurement units for the layout.
QgsLayoutSnapper & snapper()
Returns a reference to the layout's snapper, which stores handles layout snap grids and lines and sna...
An undo stack for QgsLayouts.
A model for items attached to a layout. The model also maintains the z-order for the layout,...
QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout.
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Base class for graphical items within a QgsLayout.
static const char * CORE_LAYOUT
@ UndoLayoutDpi
Change layout default DPI.
Interface for layout objects which support undo/redo commands.
A container for grouping several QgsLayoutItems.
Layout graphical items for displaying a map.
Stores and manages the snap guides used by a layout.
A manager for a collection of pages in a layout.
Base class for commands to undo/redo layout and layout object changes.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Simple key-value store (keys = strings, values = variants) that supports loading/saving to/from XML i...
Contains settings relating to the appearance, spacing and offset for layout grids.
QgsLayoutGridSettings & gridSettings()
Returns a reference to the layout's grid settings, which stores settings relating to grid appearance,...
Manages snapping grids and preset snap lines in a layout, and handles snapping points to the nearest ...
This class provides a method of storing sizes, consisting of a width and height, for use in QGIS layo...
@ LayoutMillimeters
Millimeters.
A string list settings entry.
This class provides a method of storing points, consisting of an x and y coordinate,...
Abstract interface for generating an expression context.
void layoutObjects(QList< T * > &objectList) const
Returns a list of layout objects (items and multiframes) of a specific type.
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...
ZValues
Preset item z-values, to ensure correct stacking.
UndoCommand
Layout undo commands, used for collapsing undo commands.