QGIS API Documentation 3.41.0-Master (3291e9ff48b)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
QgsLayoutGridSettings Class Reference

Contains settings relating to the appearance, spacing and offset for layout grids. More...

#include <qgslayoutgridsettings.h>

Inheritance diagram for QgsLayoutGridSettings:
Inheritance graph
[legend]

Public Types

enum  Style { StyleLines , StyleDots , StyleCrosses }
 Style for drawing the page/snapping grid. More...
 

Public Member Functions

 QgsLayoutGridSettings (QgsLayout *layout)
 Constructor for QgsLayoutGridSettings.
 
QgsLayoutlayout () override
 Returns the layout the object belongs to.
 
void loadFromSettings ()
 Loads grid settings from the application layout settings.
 
QgsLayoutPoint offset () const
 Returns the offset of the page/snap grid.
 
QPen pen () const
 Returns the pen used for drawing page/snap grids.
 
bool readXml (const QDomElement &gridElement, const QDomDocument &document, const QgsReadWriteContext &context) override
 Sets the grid's state from a DOM element.
 
QgsLayoutMeasurement resolution () const
 Returns the page/snap grid resolution.
 
void setOffset (const QgsLayoutPoint &offset)
 Sets the offset of the page/snap grid.
 
void setPen (const QPen &pen)
 Sets the pen used for drawing page/snap grids.
 
void setResolution (QgsLayoutMeasurement resolution)
 Sets the page/snap grid resolution.
 
void setStyle (const Style style)
 Sets the style used for drawing the page/snap grids.
 
QString stringType () const override
 Returns the object type as a string.
 
Style style () const
 Returns the style used for drawing the page/snap grids.
 
bool writeXml (QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const override
 Stores the grid's state in a DOM element.
 
- Public Member Functions inherited from QgsLayoutSerializableObject
QgsAbstractLayoutUndoCommandcreateCommand (const QString &text, int id, QUndoCommand *parent=nullptr) override
 Creates a new layout undo command with the specified text and parent.
 
- Public Member Functions inherited from QgsLayoutUndoObjectInterface
virtual ~QgsLayoutUndoObjectInterface ()=default
 

Detailed Description

Contains settings relating to the appearance, spacing and offset for layout grids.

Definition at line 34 of file qgslayoutgridsettings.h.

Member Enumeration Documentation

◆ Style

Style for drawing the page/snapping grid.

Enumerator
StyleLines 

Solid lines.

StyleDots 

Dots.

StyleCrosses 

Crosses.

Definition at line 40 of file qgslayoutgridsettings.h.

Constructor & Destructor Documentation

◆ QgsLayoutGridSettings()

QgsLayoutGridSettings::QgsLayoutGridSettings ( QgsLayout layout)

Constructor for QgsLayoutGridSettings.

Definition at line 25 of file qgslayoutgridsettings.cpp.

Member Function Documentation

◆ layout()

QgsLayout * QgsLayoutGridSettings::layout ( )
overridevirtual

Returns the layout the object belongs to.

Implements QgsLayoutSerializableObject.

Definition at line 34 of file qgslayoutgridsettings.cpp.

◆ loadFromSettings()

void QgsLayoutGridSettings::loadFromSettings ( )

Loads grid settings from the application layout settings.

Definition at line 53 of file qgslayoutgridsettings.cpp.

◆ offset()

QgsLayoutPoint QgsLayoutGridSettings::offset ( ) const
inline

Returns the offset of the page/snap grid.

See also
setOffset()
resolution()

Definition at line 81 of file qgslayoutgridsettings.h.

◆ pen()

QPen QgsLayoutGridSettings::pen ( ) const
inline

Returns the pen used for drawing page/snap grids.

See also
setPen()
style()

Definition at line 95 of file qgslayoutgridsettings.h.

◆ readXml()

bool QgsLayoutGridSettings::readXml ( const QDomElement &  gridElement,
const QDomDocument &  document,
const QgsReadWriteContext context 
)
overridevirtual

Sets the grid's state from a DOM element.

gridElement is the DOM node corresponding to the grid.

See also
writeXml()

Implements QgsLayoutSerializableObject.

Definition at line 106 of file qgslayoutgridsettings.cpp.

◆ resolution()

QgsLayoutMeasurement QgsLayoutGridSettings::resolution ( ) const
inline

Returns the page/snap grid resolution.

See also
setResolution()
offset()

Definition at line 67 of file qgslayoutgridsettings.h.

◆ setOffset()

void QgsLayoutGridSettings::setOffset ( const QgsLayoutPoint offset)

Sets the offset of the page/snap grid.

See also
offset()
setResolution()

Definition at line 46 of file qgslayoutgridsettings.cpp.

◆ setPen()

void QgsLayoutGridSettings::setPen ( const QPen &  pen)
inline

Sets the pen used for drawing page/snap grids.

See also
pen()
setStyle()

Definition at line 88 of file qgslayoutgridsettings.h.

◆ setResolution()

void QgsLayoutGridSettings::setResolution ( QgsLayoutMeasurement  resolution)

Sets the page/snap grid resolution.

See also
resolution()
setOffset()

Definition at line 39 of file qgslayoutgridsettings.cpp.

◆ setStyle()

void QgsLayoutGridSettings::setStyle ( const Style  style)
inline

Sets the style used for drawing the page/snap grids.

See also
style()
setPen()

Definition at line 102 of file qgslayoutgridsettings.h.

◆ stringType()

QString QgsLayoutGridSettings::stringType ( ) const
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 52 of file qgslayoutgridsettings.h.

◆ style()

Style QgsLayoutGridSettings::style ( ) const
inline

Returns the style used for drawing the page/snap grids.

See also
setStyle()
pen()

Definition at line 109 of file qgslayoutgridsettings.h.

◆ writeXml()

bool QgsLayoutGridSettings::writeXml ( QDomElement &  parentElement,
QDomDocument &  document,
const QgsReadWriteContext context 
) const
overridevirtual

Stores the grid's state in a DOM element.

The parentElement should refer to the parent layout's DOM element.

See also
readXml()

Implements QgsLayoutSerializableObject.

Definition at line 91 of file qgslayoutgridsettings.cpp.


The documentation for this class was generated from the following files: