QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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. More...
 
QgsLayoutlayout () override
 Returns the layout the object belongs to. More...
 
void loadFromSettings ()
 Loads grid settings from the application layout settings. More...
 
QgsLayoutPoint offset () const
 Returns the offset of the page/snap grid. More...
 
QPen pen () const
 Returns the pen used for drawing page/snap grids. More...
 
bool readXml (const QDomElement &gridElement, const QDomDocument &document, const QgsReadWriteContext &context) override
 Sets the grid's state from a DOM element. More...
 
QgsLayoutMeasurement resolution () const
 Returns the page/snap grid resolution. More...
 
void setOffset (const QgsLayoutPoint &offset)
 Sets the offset of the page/snap grid. More...
 
void setPen (const QPen &pen)
 Sets the pen used for drawing page/snap grids. More...
 
void setResolution (QgsLayoutMeasurement resolution)
 Sets the page/snap grid resolution. More...
 
void setStyle (const Style style)
 Sets the style used for drawing the page/snap grids. More...
 
QString stringType () const override
 Returns the object type as a string. More...
 
Style style () const
 Returns the style used for drawing the page/snap grids. More...
 
bool writeXml (QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const override
 Stores the grid's state in a DOM element. More...
 
- 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. More...
 
- Public Member Functions inherited from QgsLayoutUndoObjectInterface
virtual ~QgsLayoutUndoObjectInterface ()=default
 Destructor for QgsLayoutUndoObjectInterface. More...
 

Detailed Description

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

Since
QGIS 3.0

Definition at line 35 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 41 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 82 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 96 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 68 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 89 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 103 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 53 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 110 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: