19 #include "qgis_core.h" 20 #include <QGraphicsScene> 63 ZMouseHandles = 10000,
65 ZSnapIndicator = 10002,
96 void initializeDefaults();
121 template<class T>
void layoutItems( QList<T *> &itemList ) const
SIP_SKIP 124 QList<QGraphicsItem *> graphicsItemList = items();
125 QList<QGraphicsItem *>::iterator itemIt = graphicsItemList.begin();
126 for ( ; itemIt != graphicsItemList.end(); ++itemIt )
128 T *item =
dynamic_cast<T *
>( *itemIt );
131 itemList.push_back( item );
143 const QList<QGraphicsItem *> itemList( items() );
144 const QList<QgsLayoutMultiFrame *> frameList( multiFrames() );
145 for (
const auto &obj : itemList )
147 T *item =
dynamic_cast<T *
>( obj );
150 objectList.push_back( item );
153 for (
const auto &obj : frameList )
155 T *item =
dynamic_cast<T *
>( obj );
158 objectList.push_back( item );
169 QList<QgsLayoutItem *> selectedLayoutItems(
bool includeLockedItems =
true );
196 bool raiseItem(
QgsLayoutItem *item,
bool deferUpdate =
false );
210 bool lowerItem(
QgsLayoutItem *item,
bool deferUpdate =
false );
224 bool moveItemToTop(
QgsLayoutItem *item,
bool deferUpdate =
false );
237 bool moveItemToBottom(
QgsLayoutItem *item,
bool deferUpdate =
false );
244 void updateZValues(
bool addUndoCommands =
true );
261 QgsLayoutItem *itemByUuid(
const QString &uuid,
bool includeTemplateUuids =
false )
const;
278 QgsLayoutItem *itemByTemplateUuid(
const QString &uuid )
const;
301 QgsLayoutMultiFrame *multiFrameByUuid(
const QString &uuid,
bool includeTemplateUuids =
false )
const;
307 QgsLayoutItem *layoutItemAt( QPointF position,
bool ignoreLocked =
false )
const;
344 QSizeF convertToLayoutUnits(
const QgsLayoutSize &size )
const;
352 QPointF convertToLayoutUnits(
const QgsLayoutPoint &point )
const;
429 void reloadSettings();
455 void setCustomProperty(
const QString &key,
const QVariant &value );
466 QVariant customProperty(
const QString &key,
const QVariant &defaultValue = QVariant() )
const;
475 void removeCustomProperty(
const QString &key );
483 QStringList customProperties()
const;
521 QRectF layoutBounds(
bool ignorePages =
false,
double margin = 0.0 )
const;
533 QRectF pageItemBounds(
int page,
bool visibleOnly =
false )
const;
567 QList< QgsLayoutMultiFrame * > multiFrames()
const;
587 QList< QgsLayoutItem * > loadFromTemplate(
const QDomDocument &document,
const QgsReadWriteContext &context,
bool clearExisting =
true,
bool *ok
SIP_OUT =
nullptr );
593 virtual QDomElement writeXml( QDomDocument &document,
const QgsReadWriteContext &context )
const;
599 virtual bool readXml(
const QDomElement &layoutElement,
const QDomDocument &document,
const QgsReadWriteContext &context );
613 QList< QgsLayoutItem * > addItemsFromXml(
const QDomElement &parentElement,
const QDomDocument &document,
615 QPointF *position =
nullptr,
bool pasteInPlace =
false );
689 void variablesChanged();
708 void backgroundTaskCountChanged(
int total );
711 void itemBackgroundTaskCountChanged(
int count );
716 std::unique_ptr< QgsLayoutModel > mItemsModel;
726 std::unique_ptr< QgsLayoutPageCollection > mPageCollection;
727 std::unique_ptr< QgsLayoutUndoStack > mUndoStack;
730 QList<QgsLayoutMultiFrame *> mMultiFrames;
733 QString mWorldFileMapId;
735 QHash< QgsLayoutItem *, int > mBackgroundTaskCount;
738 void writeXmlLayoutSettings( QDomElement &element, QDomDocument &document,
const QgsReadWriteContext &context )
const;
740 bool readXmlLayoutSettings(
const QDomElement &layoutElement,
const QDomDocument &document,
const QgsReadWriteContext &context );
752 void deleteAndRemoveMultiFrames();
755 QPointF minPointFromXml(
const QDomElement &elem )
const;
757 friend class QgsLayoutItemAddItemCommand;
758 friend class QgsLayoutItemDeleteUndoCommand;
759 friend class QgsLayoutItemUndoCommand;
760 friend class QgsLayoutUndoCommand;
761 friend class QgsLayoutItemGroupUndoCommand;
The class is used as a container of context for various read/write operations on other objects...
Base class for graphical items within a QgsLayout.
void layoutObjects(QList< T *> &objectList) const
Returns a list of layout objects (items and multiframes) of a specific type.
Base class for commands to undo/redo layout and layout object changes.
Change layout default DPI.
Stores information relating to the current reporting context for a layout.
QgsUnitTypes::LayoutUnit units() const
Returns the native units for the layout.
An undo stack for QgsLayouts.
QgsLayoutSnapper & snapper()
Returns a reference to the layout's snapper, which stores handles layout snap grids and lines and sna...
A container for grouping several QgsLayoutItems.
void setUnits(QgsUnitTypes::LayoutUnit units)
Sets the native measurement units for the layout.
An interface for classes which can visit style entity (e.g.
const QgsLayoutGridSettings & gridSettings() const
Returns a reference to the layout's grid settings, which stores settings relating to grid appearance...
ZValues
Preset item z-values, to ensure correct stacking.
Abstract base class for layout items with the ability to distribute the content to several frames (Qg...
This class provides a method of storing points, consisting of an x and y coordinate, for use in QGIS layouts.
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Layout graphical items for displaying a map.
const QgsLayoutSnapper & snapper() const
Returns a reference to the layout's snapper, which stores handles layout snap grids and lines and sna...
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...
QgsLayoutGridSettings & gridSettings()
Returns a reference to the layout's grid settings, which stores settings relating to grid appearance...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Stores and manages the snap guides used by a layout.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts, annotations, canvases, etc.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
A manager for a collection of pages in a layout.
Contains settings relating to the appearance, spacing and offset for layout grids.
Abstract interface for generating an expression context.
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.
QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout.
Stores information relating to the current rendering settings for a layout.
Interface for layout objects which support undo/redo commands.
Simple key-value store (keys = strings, values = variants) that supports loading/saving to/from XML i...
UndoCommand
Layout undo commands, used for collapsing undo commands.
LayoutUnit
Layout measurement units.
A model for items attached to a layout.
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...