QGIS API Documentation
3.4.15-Madeira (e83d02e274)
|
Stores and manages the snap guides used by a layout. More...
#include <qgslayoutguidecollection.h>
Public Types | |
enum | Roles { OrientationRole = Qt::UserRole, PositionRole, UnitsRole, PageRole, LayoutPositionRole } |
Model roles. More... | |
Public Member Functions | |
QgsLayoutGuideCollection (QgsLayout *layout, QgsLayoutPageCollection *pageCollection) | |
Constructor for QgsLayoutGuideCollection belonging to the specified layout, and linked to the specified pageCollection. More... | |
~QgsLayoutGuideCollection () override | |
void | addGuide (QgsLayoutGuide *guide) |
Adds a guide to the collection. More... | |
void | applyGuidesToAllOtherPages (int sourcePage) |
Resets all other pages' guides to match the guides from the specified sourcePage. More... | |
void | clear () |
Removes all guides from the collection. More... | |
int | columnCount (const QModelIndex &) const override |
QVariant | data (const QModelIndex &index, int role) const override |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
QList< QgsLayoutGuide * > | guides () |
Returns a list of all guides contained in the collection. More... | |
QList< QgsLayoutGuide * > | guides (Qt::Orientation orientation, int page=-1) |
Returns the list of guides contained in the collection with the specified orientation and on a matching page. More... | |
QList< QgsLayoutGuide * > | guidesOnPage (int page) |
Returns the list of guides contained on a matching page. More... | |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
QgsLayout * | layout () override |
Returns the layout the object belongs to. More... | |
bool | readXml (const QDomElement &collectionElement, const QDomDocument &document, const QgsReadWriteContext &context) override |
Sets the collection's state from a DOM element. More... | |
void | removeGuide (QgsLayoutGuide *guide) |
Removes the specified guide, and deletes it. More... | |
bool | removeRows (int row, int count, const QModelIndex &parent=QModelIndex()) override |
int | rowCount (const QModelIndex &) const override |
bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
void | setGuideLayoutPosition (QgsLayoutGuide *guide, double position) |
Sets the absolute position (in layout coordinates) for guide within the layout. More... | |
void | setVisible (bool visible) |
Sets whether the guide lines should be visible. More... | |
QString | stringType () const override |
Returns the object type as a string. More... | |
void | update () |
Updates the position (and visibility) of all guide line items. More... | |
bool | visible () const |
Returns true if the guide lines should be drawn. More... | |
bool | writeXml (QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const override |
Stores the collection's state in a DOM element. More... | |
Public Member Functions inherited from QgsLayoutSerializableObject | |
QgsAbstractLayoutUndoCommand * | createCommand (const QString &text, int id, QUndoCommand *parent=nullptr) override |
Creates a new layout undo command with the specified text and parent. More... | |
Public Member Functions inherited from QgsLayoutUndoObjectInterface | |
virtual | ~QgsLayoutUndoObjectInterface ()=default |
Destructor for QgsLayoutUndoObjectInterface. More... | |
Friends | |
class | QgsLayoutGuideCollectionUndoCommand |
Stores and manages the snap guides used by a layout.
Definition at line 168 of file qgslayoutguidecollection.h.
Model roles.
Definition at line 176 of file qgslayoutguidecollection.h.
QgsLayoutGuideCollection::QgsLayoutGuideCollection | ( | QgsLayout * | layout, |
QgsLayoutPageCollection * | pageCollection | ||
) |
Constructor for QgsLayoutGuideCollection belonging to the specified layout, and linked to the specified pageCollection.
Definition at line 192 of file qgslayoutguidecollection.cpp.
|
override |
Definition at line 203 of file qgslayoutguidecollection.cpp.
void QgsLayoutGuideCollection::addGuide | ( | QgsLayoutGuide * | guide | ) |
Adds a guide to the collection.
Ownership of the guide is transferred to the collection, and the guide will automatically have the correct layout set.
Definition at line 385 of file qgslayoutguidecollection.cpp.
void QgsLayoutGuideCollection::applyGuidesToAllOtherPages | ( | int | sourcePage | ) |
Resets all other pages' guides to match the guides from the specified sourcePage.
Definition at line 432 of file qgslayoutguidecollection.cpp.
void QgsLayoutGuideCollection::clear | ( | ) |
Removes all guides from the collection.
Definition at line 422 of file qgslayoutguidecollection.cpp.
|
override |
Definition at line 218 of file qgslayoutguidecollection.cpp.
|
override |
Definition at line 226 of file qgslayoutguidecollection.cpp.
|
override |
Definition at line 349 of file qgslayoutguidecollection.cpp.
QList< QgsLayoutGuide * > QgsLayoutGuideCollection::guides | ( | ) |
Returns a list of all guides contained in the collection.
Definition at line 473 of file qgslayoutguidecollection.cpp.
QList< QgsLayoutGuide * > QgsLayoutGuideCollection::guides | ( | Qt::Orientation | orientation, |
int | page = -1 |
||
) |
Returns the list of guides contained in the collection with the specified orientation and on a matching page.
If page is -1, guides from all pages will be returned.
Definition at line 478 of file qgslayoutguidecollection.cpp.
QList< QgsLayoutGuide * > QgsLayoutGuideCollection::guidesOnPage | ( | int | page | ) |
Returns the list of guides contained on a matching page.
Definition at line 490 of file qgslayoutguidecollection.cpp.
|
override |
Definition at line 356 of file qgslayoutguidecollection.cpp.
|
overridevirtual |
Returns the layout the object belongs to.
Implements QgsLayoutSerializableObject.
Definition at line 208 of file qgslayoutguidecollection.cpp.
|
overridevirtual |
Sets the collection's state from a DOM element.
collectionElement is the DOM node corresponding to the collection.
Implements QgsLayoutSerializableObject.
Definition at line 542 of file qgslayoutguidecollection.cpp.
void QgsLayoutGuideCollection::removeGuide | ( | QgsLayoutGuide * | guide | ) |
Removes the specified guide, and deletes it.
Definition at line 404 of file qgslayoutguidecollection.cpp.
|
override |
Definition at line 367 of file qgslayoutguidecollection.cpp.
|
override |
Definition at line 213 of file qgslayoutguidecollection.cpp.
|
override |
Definition at line 266 of file qgslayoutguidecollection.cpp.
void QgsLayoutGuideCollection::setGuideLayoutPosition | ( | QgsLayoutGuide * | guide, |
double | position | ||
) |
Sets the absolute position (in layout coordinates) for guide within the layout.
Definition at line 413 of file qgslayoutguidecollection.cpp.
void QgsLayoutGuideCollection::setVisible | ( | bool | visible | ) |
Sets whether the guide lines should be visible.
Definition at line 506 of file qgslayoutguidecollection.cpp.
|
inlineoverridevirtual |
Returns the object type as a string.
This string must be a unique, single word, character only representation of the item type, eg "LayoutScaleBar"
Implements QgsLayoutSerializableObject.
Definition at line 192 of file qgslayoutguidecollection.h.
void QgsLayoutGuideCollection::update | ( | ) |
Updates the position (and visibility) of all guide line items.
Definition at line 465 of file qgslayoutguidecollection.cpp.
bool QgsLayoutGuideCollection::visible | ( | ) | const |
Returns true if the guide lines should be drawn.
Definition at line 501 of file qgslayoutguidecollection.cpp.
|
overridevirtual |
Stores the collection's state in a DOM element.
The parentElement should refer to the parent layout's DOM element.
Implements QgsLayoutSerializableObject.
Definition at line 524 of file qgslayoutguidecollection.cpp.
|
friend |
Definition at line 302 of file qgslayoutguidecollection.h.