16#ifndef QGSLAYOUTGUIDECOLLECTION_H
17#define QGSLAYOUTGUIDECOLLECTION_H
27#include <QAbstractListModel>
28#include <QGraphicsLineItem>
30#include <QSortFilterProxyModel>
125 QGraphicsLineItem *
item();
148 Qt::Orientation mOrientation = Qt::Vertical;
154 QPointer< QgsLayoutItemPage > mPage;
156 QPointer< QgsLayout > mLayout;
159 QGraphicsLineItem *mLineItem =
nullptr;
203 QString
stringType()
const override {
return QStringLiteral(
"LayoutGuideCollection" ); }
206 int rowCount(
const QModelIndex & )
const override;
207 int columnCount(
const QModelIndex & )
const override;
208 QVariant data(
const QModelIndex &index,
int role )
const override;
209 bool setData(
const QModelIndex &index,
const QVariant &value,
int role )
override;
210 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
211 QVariant headerData(
int section, Qt::Orientation orientation,
212 int role = Qt::DisplayRole )
const override;
213 bool removeRows(
int row,
int count,
const QModelIndex &parent = QModelIndex() )
override;
231 void setGuideLayoutPosition(
QgsLayoutGuide *guide,
double position );
242 void applyGuidesToAllOtherPages(
int sourcePage );
252 QList< QgsLayoutGuide * > guides();
260 QList< QgsLayoutGuide * > guides( Qt::Orientation orientation,
int page = -1 );
266 QList< QgsLayoutGuide * > guidesOnPage(
int page );
272 bool visible()
const;
278 void setVisible(
bool visible );
284 bool writeXml( QDomElement &parentElement, QDomDocument &document,
const QgsReadWriteContext &context )
const override;
290 bool readXml(
const QDomElement &collectionElement,
const QDomDocument &document,
const QgsReadWriteContext &context )
override;
294 void pageAboutToBeRemoved(
int pageNumber );
304 QgsLayout *mLayout =
nullptr;
305 QgsLayoutPageCollection *mPageCollection =
nullptr;
307 QList< QgsLayoutGuide * > mGuides;
310 bool mGuidesVisible =
true;
311 bool mBlockUndoCommands =
false;
341 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent )
const override;
342 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
345 Qt::Orientation mOrientation = Qt::Horizontal;
Stores and manages the snap guides used by a layout.
QString stringType() const override
Returns the object type as a string.
QgsLayoutGuideCollection(QgsLayout *layout, QgsLayoutPageCollection *pageCollection)
Constructor for QgsLayoutGuideCollection belonging to the specified layout, and linked to the specifi...
friend class QgsLayoutGuideCollectionUndoCommand
void setPage(int page)
Sets the current page for filtering matching guides.
QgsLayoutGuideProxyModel(QObject *parent, Qt::Orientation orientation, int page)
Constructor for QgsLayoutGuideProxyModel, filtered to guides of the specified orientation and page on...
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
Contains the configuration for a single snap guide used by a layout.
QgsLayoutMeasurement position() const
Returns the guide's position within the page.
QgsLayoutItemPage * page()
Returns the page the guide is contained within.
Qt::Orientation orientation() const
Returns the guide's orientation.
QgsLayout * layout() const
Returns the layout the guide belongs to.
void setLayout(QgsLayout *layout)
Sets the layout the guide belongs to.
void setLayoutPosition(double position)
Sets the guide's position in absolute layout units.
void setPage(QgsLayoutItemPage *page)
Sets the page the guide is contained within.
void setPosition(QgsLayoutMeasurement position)
Sets the guide's position within the page.
QgsLayoutGuide(Qt::Orientation orientation, QgsLayoutMeasurement position, QgsLayoutItemPage *page)
Constructor for a new guide with the specified orientation and initial position.
double layoutPosition() const
Returns the guide's position in absolute layout units.
void positionChanged()
Emitted when the guide's position is changed.
void update()
Updates the position of the guide's line item.
QGraphicsLineItem * item()
Returns the guide's line item.
Item representing the paper in a layout.
Provides a method of storing measurements for use in QGIS layouts using a variety of different measur...
A manager for a collection of pages in a layout.
An interface for layout objects which can be stored and read from DOM elements.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
A container for the context for various read/write operations on objects.
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)