17#ifndef QGSLAYOUTPAGECOLLECTION_H
18#define QGSLAYOUTPAGECOLLECTION_H
33using namespace Qt::StringLiterals;
58 QString
stringType()
const override {
return u
"LayoutPageCollection"_s; }
66 QList< QgsLayoutItemPage * > pages();
72 int pageCount()
const;
104 QList< QgsLayoutItemPage * > visiblePages(
const QRectF ®ion )
const;
111 QList< int > visiblePageNumbers(
const QRectF ®ion )
const;
118 bool pageIsEmpty(
int page )
const;
123 QList< QgsLayoutItem *> itemsOnPage(
int page )
const;
132 const QList<QGraphicsItem *> graphicsItemList = mLayout->items();
133 for ( QGraphicsItem *graphicsItem : graphicsItemList )
135 T *item =
dynamic_cast<T *
>( graphicsItem );
136 if ( item && item->page() ==
page )
138 itemList.push_back( item );
151 bool shouldExportPage(
int page )
const;
205 void deletePage(
int pageNumber );
250 void beginPageSizeChange();
258 void endPageSizeChange();
272 double maximumPageWidth() const;
280 QSizeF maximumPageSize() const;
288 bool hasUniformPageSizes() const;
304 int pageNumberForPoint( QPointF point ) const;
321 int predictPageNumberForPoint( QPointF point ) const;
339 QPointF pagePositionToLayoutPosition(
int page, const
QgsLayoutPoint &position ) const;
352 QPointF positionOnPage( QPointF point ) const;
357 double spaceBetweenPages() const;
362 double pageShadowWidth() const;
372 void resizeToContents( const
QgsMargins &margins,
Qgis::LayoutUnit marginUnits );
378 bool writeXml( QDomElement &parentElement, QDomDocument &document, const
QgsReadWriteContext &context ) const override;
384 bool readXml( const QDomElement &collectionElement, const QDomDocument &document, const
QgsReadWriteContext &context ) override;
401 void applyPropertiesToAllOtherPages(
int sourcePage );
436 bool mBlockUndoCommands = false;
438 QMap< QString, QPair<
int,
QgsLayoutPoint > > mPreviousItemPositions;
440 void createDefaultPageStyleSymbol();
Provides global constants and enumerations for use throughout the application.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
Stores and manages the snap guides used by a layout.
Item representing the paper in a layout.
void changed()
Emitted when pages are added or removed from the collection.
void itemsOnPage(QList< T * > &itemList, int page) const
Returns layout items of a specific type on a specified page.
QgsLayoutPageCollection(QgsLayout *layout)
Constructor for QgsLayoutItemPage, with the specified parent layout.
friend class QgsLayoutPageCollectionUndoCommand
QgsLayout * layout() override
Returns the layout the object belongs to.
void pageAboutToBeRemoved(int pageNumber)
Emitted just before a page is removed from the collection.
QgsLayoutItemPage * page(int pageNumber)
Returns a specific page (by pageNumber) from the collection.
int pageNumber(QgsLayoutItemPage *page) const
Returns the page number for the specified page, or -1 if the page is not contained in the collection.
QString stringType() const override
Returns the object type as a string.
Provides a method of storing points, consisting of an x and y coordinate, for use in QGIS layouts.
An interface for layout objects which can be stored and read from DOM elements.
virtual QgsLayout * layout()=0
Returns the layout the object belongs to.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Defines the four margins of a rectangle.
A container for the context for various read/write operations on objects.