QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgslayoutpropertieswidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutpropertieswidget.cpp
3  -----------------------------
4  begin : July 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
18 #include "qgslayout.h"
19 #include "qgslayoutsnapper.h"
21 #include "qgslayoutundostack.h"
22 #include "qgslayoutitemmap.h"
24 #include "qgsprintlayout.h"
25 #include "qgslayoutatlas.h"
26 
28  : QgsPanelWidget( parent )
29  , mLayout( layout )
30 {
31  Q_ASSERT( mLayout );
32 
33  setupUi( this );
34  setPanelTitle( tr( "Layout Properties" ) );
35  blockSignals( true );
36 
37  mVariableEditor->setMinimumHeight( mVariableEditor->fontMetrics().height() * 15 );
38 
39  updateSnappingElements();
40 
41  mGridSpacingUnitsCombo->linkToWidget( mGridResolutionSpinBox );
42  mGridOffsetUnitsComboBox->linkToWidget( mOffsetXSpinBox );
43  mGridOffsetUnitsComboBox->linkToWidget( mOffsetYSpinBox );
44 
45  blockSignals( false );
46 
47  connect( mSnapToleranceSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsLayoutPropertiesWidget::snapToleranceChanged );
48 
49  connect( mGridOffsetUnitsComboBox, &QgsLayoutUnitsComboBox::changed, this, &QgsLayoutPropertiesWidget::gridOffsetUnitsChanged );
50  connect( mGridSpacingUnitsCombo, &QgsLayoutUnitsComboBox::changed, this, &QgsLayoutPropertiesWidget::gridResolutionUnitsChanged );
51  connect( mGridResolutionSpinBox, static_cast < void ( QgsDoubleSpinBox::* )( double ) > ( &QgsDoubleSpinBox::valueChanged ), this, &QgsLayoutPropertiesWidget::gridResolutionChanged );
52  connect( mOffsetXSpinBox, static_cast < void ( QgsDoubleSpinBox::* )( double ) > ( &QgsDoubleSpinBox::valueChanged ), this, &QgsLayoutPropertiesWidget::gridOffsetXChanged );
53  connect( mOffsetYSpinBox, static_cast < void ( QgsDoubleSpinBox::* )( double ) > ( &QgsDoubleSpinBox::valueChanged ), this, &QgsLayoutPropertiesWidget::gridOffsetYChanged );
54 
55  const double leftMargin = mLayout->customProperty( QStringLiteral( "resizeToContentsLeftMargin" ) ).toDouble();
56  const double topMargin = mLayout->customProperty( QStringLiteral( "resizeToContentsTopMargin" ) ).toDouble();
57  const double bottomMargin = mLayout->customProperty( QStringLiteral( "resizeToContentsBottomMargin" ) ).toDouble();
58  const double rightMargin = mLayout->customProperty( QStringLiteral( "resizeToContentsRightMargin" ) ).toDouble();
59  const QgsUnitTypes::LayoutUnit marginUnit = static_cast< QgsUnitTypes::LayoutUnit >(
60  mLayout->customProperty( QStringLiteral( "imageCropMarginUnit" ), QgsUnitTypes::LayoutMillimeters ).toInt() );
61 
62  const bool exportWorldFile = mLayout->customProperty( QStringLiteral( "exportWorldFile" ), false ).toBool();
63  mGenerateWorldFileCheckBox->setChecked( exportWorldFile );
64  connect( mGenerateWorldFileCheckBox, &QCheckBox::toggled, this, &QgsLayoutPropertiesWidget::worldFileToggled );
65 
66  connect( mRasterizeCheckBox, &QCheckBox::toggled, this, &QgsLayoutPropertiesWidget::rasterizeToggled );
67  connect( mForceVectorCheckBox, &QCheckBox::toggled, this, &QgsLayoutPropertiesWidget::forceVectorToggled );
68 
69  mTopMarginSpinBox->setValue( topMargin );
70  mMarginUnitsComboBox->linkToWidget( mTopMarginSpinBox );
71  mRightMarginSpinBox->setValue( rightMargin );
72  mMarginUnitsComboBox->linkToWidget( mRightMarginSpinBox );
73  mBottomMarginSpinBox->setValue( bottomMargin );
74  mMarginUnitsComboBox->linkToWidget( mBottomMarginSpinBox );
75  mLeftMarginSpinBox->setValue( leftMargin );
76  mMarginUnitsComboBox->linkToWidget( mLeftMarginSpinBox );
77  mMarginUnitsComboBox->setUnit( marginUnit );
78  mMarginUnitsComboBox->setConverter( &mLayout->renderContext().measurementConverter() );
79 
80  connect( mTopMarginSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutPropertiesWidget::resizeMarginsChanged );
81  connect( mRightMarginSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutPropertiesWidget::resizeMarginsChanged );
82  connect( mBottomMarginSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutPropertiesWidget::resizeMarginsChanged );
83  connect( mLeftMarginSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutPropertiesWidget::resizeMarginsChanged );
84  connect( mResizePageButton, &QPushButton::clicked, this, &QgsLayoutPropertiesWidget::resizeToContents );
85 
86  connect( mResolutionSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsLayoutPropertiesWidget::dpiChanged );
87 
88  mReferenceMapComboBox->setCurrentLayout( mLayout );
89  mReferenceMapComboBox->setItemType( QgsLayoutItemRegistry::LayoutMap );
90  connect( mReferenceMapComboBox, &QgsLayoutItemComboBox::itemChanged, this, &QgsLayoutPropertiesWidget::referenceMapChanged );
91 
92  connect( mLayout, &QgsLayout::changed, this, &QgsLayoutPropertiesWidget::updateGui );
93 
94  updateVariables();
95  connect( mVariableEditor, &QgsVariableEditorWidget::scopeChanged, this, &QgsLayoutPropertiesWidget::variablesChanged );
96  // listen out for variable edits
97  connect( QgsApplication::instance(), &QgsApplication::customVariablesChanged, this, &QgsLayoutPropertiesWidget::updateVariables );
98  connect( QgsProject::instance(), &QgsProject::customVariablesChanged, this, &QgsLayoutPropertiesWidget::updateVariables );
99  connect( QgsProject::instance(), &QgsProject::metadataChanged, this, &QgsLayoutPropertiesWidget::updateVariables );
100  connect( &mLayout->renderContext(), &QgsLayoutRenderContext::dpiChanged, this, &QgsLayoutPropertiesWidget::updateVariables );
101  connect( mLayout->pageCollection(), &QgsLayoutPageCollection::changed, this, &QgsLayoutPropertiesWidget::updateVariables );
102  connect( mLayout, &QgsLayout::variablesChanged, this, &QgsLayoutPropertiesWidget::updateVariables );
103 
104  updateGui();
105 }
106 
108 {
109  if ( QgsPrintLayout *printLayout = dynamic_cast< QgsPrintLayout * >( masterLayout ) )
110  {
111  connect( printLayout, &QgsPrintLayout::nameChanged, this, &QgsLayoutPropertiesWidget::updateVariables );
112  connect( printLayout->atlas(), &QgsLayoutAtlas::coverageLayerChanged, this, &QgsLayoutPropertiesWidget::updateVariables );
113  }
114 }
115 
117 {
118  whileBlocking( mReferenceMapComboBox )->setItem( mLayout->referenceMap() );
119  whileBlocking( mResolutionSpinBox )->setValue( mLayout->renderContext().dpi() );
120 
121  const bool rasterize = mLayout->customProperty( QStringLiteral( "rasterize" ), false ).toBool();
122  whileBlocking( mRasterizeCheckBox )->setChecked( rasterize );
123 
124  const bool forceVectors = mLayout->customProperty( QStringLiteral( "forceVector" ), false ).toBool();
125  whileBlocking( mForceVectorCheckBox )->setChecked( forceVectors );
126 
127  if ( rasterize )
128  {
129  mForceVectorCheckBox->setChecked( false );
130  mForceVectorCheckBox->setEnabled( false );
131  }
132  else
133  {
134  mForceVectorCheckBox->setEnabled( true );
135  }
136 }
137 
138 void QgsLayoutPropertiesWidget::updateSnappingElements()
139 {
140  mSnapToleranceSpinBox->setValue( mLayout->snapper().snapTolerance() );
141 
142  mGridSpacingUnitsCombo->setUnit( mLayout->gridSettings().resolution().units() );
143  mGridResolutionSpinBox->setValue( mLayout->gridSettings().resolution().length() );
144 
145  mGridOffsetUnitsComboBox->setUnit( mLayout->gridSettings().offset().units() );
146  mOffsetXSpinBox->setValue( mLayout->gridSettings().offset().x() );
147  mOffsetYSpinBox->setValue( mLayout->gridSettings().offset().y() );
148 }
149 
150 void QgsLayoutPropertiesWidget::gridResolutionChanged( double d )
151 {
153  m.setLength( d );
154  mLayout->gridSettings().setResolution( m );
155  mLayout->pageCollection()->redraw();
156 }
157 
158 void QgsLayoutPropertiesWidget::gridResolutionUnitsChanged( QgsUnitTypes::LayoutUnit unit )
159 {
161  m.setUnits( unit );
162  mLayout->gridSettings().setResolution( m );
163  mLayout->pageCollection()->redraw();
164 }
165 
166 void QgsLayoutPropertiesWidget::gridOffsetXChanged( double d )
167 {
168  QgsLayoutPoint o = mLayout->gridSettings().offset();
169  o.setX( d );
170  mLayout->gridSettings().setOffset( o );
171  mLayout->pageCollection()->redraw();
172 }
173 
174 void QgsLayoutPropertiesWidget::gridOffsetYChanged( double d )
175 {
176  QgsLayoutPoint o = mLayout->gridSettings().offset();
177  o.setY( d );
178  mLayout->gridSettings().setOffset( o );
179  mLayout->pageCollection()->redraw();
180 }
181 
182 void QgsLayoutPropertiesWidget::gridOffsetUnitsChanged( QgsUnitTypes::LayoutUnit unit )
183 {
184  QgsLayoutPoint o = mLayout->gridSettings().offset();
185  o.setUnits( unit );
186  mLayout->gridSettings().setOffset( o );
187  mLayout->pageCollection()->redraw();
188 }
189 
190 void QgsLayoutPropertiesWidget::snapToleranceChanged( int tolerance )
191 {
192  mLayout->snapper().setSnapTolerance( tolerance );
193 }
194 
195 void QgsLayoutPropertiesWidget::resizeMarginsChanged()
196 {
197  mLayout->setCustomProperty( QStringLiteral( "resizeToContentsLeftMargin" ), mLeftMarginSpinBox->value() );
198  mLayout->setCustomProperty( QStringLiteral( "resizeToContentsTopMargin" ), mTopMarginSpinBox->value() );
199  mLayout->setCustomProperty( QStringLiteral( "resizeToContentsBottomMargin" ), mBottomMarginSpinBox->value() );
200  mLayout->setCustomProperty( QStringLiteral( "resizeToContentsRightMargin" ), mRightMarginSpinBox->value() );
201  mLayout->setCustomProperty( QStringLiteral( "imageCropMarginUnit" ), mMarginUnitsComboBox->unit() );
202 }
203 
204 void QgsLayoutPropertiesWidget::resizeToContents()
205 {
206  mLayout->undoStack()->beginMacro( tr( "Resize to Contents" ) );
207 
208  mLayout->pageCollection()->resizeToContents( QgsMargins( mLeftMarginSpinBox->value(),
209  mTopMarginSpinBox->value(),
210  mRightMarginSpinBox->value(),
211  mBottomMarginSpinBox->value() ),
212  mMarginUnitsComboBox->unit() );
213 
214  mLayout->undoStack()->endMacro();
215 }
216 
217 void QgsLayoutPropertiesWidget::referenceMapChanged( QgsLayoutItem *item )
218 {
219  mLayout->undoStack()->beginCommand( mLayout, tr( "Set Reference Map" ) );
220  QgsLayoutItemMap *map = qobject_cast< QgsLayoutItemMap * >( item );
221  mLayout->setReferenceMap( map );
222  mLayout->undoStack()->endCommand();
223 }
224 
225 void QgsLayoutPropertiesWidget::dpiChanged( int value )
226 {
227  mLayout->undoStack()->beginCommand( mLayout, tr( "Set Default DPI" ), QgsLayout::UndoLayoutDpi );
228  mLayout->renderContext().setDpi( value );
229  mLayout->undoStack()->endCommand();
230 
231  mLayout->refresh();
232 }
233 
234 void QgsLayoutPropertiesWidget::worldFileToggled()
235 {
236  mLayout->setCustomProperty( QStringLiteral( "exportWorldFile" ), mGenerateWorldFileCheckBox->isChecked() );
237 }
238 
239 void QgsLayoutPropertiesWidget::rasterizeToggled()
240 {
241  mLayout->setCustomProperty( QStringLiteral( "rasterize" ), mRasterizeCheckBox->isChecked() );
242 
243  if ( mRasterizeCheckBox->isChecked() )
244  {
245  mForceVectorCheckBox->setChecked( false );
246  mForceVectorCheckBox->setEnabled( false );
247  }
248  else
249  {
250  mForceVectorCheckBox->setEnabled( true );
251  }
252 }
253 
254 void QgsLayoutPropertiesWidget::forceVectorToggled()
255 {
256  mLayout->setCustomProperty( QStringLiteral( "forceVector" ), mForceVectorCheckBox->isChecked() );
257 }
258 
259 void QgsLayoutPropertiesWidget::variablesChanged()
260 {
261  mBlockVariableUpdates = true;
262  QgsExpressionContextUtils::setLayoutVariables( mLayout, mVariableEditor->variablesInActiveScope() );
263  mBlockVariableUpdates = false;
264 }
265 
266 void QgsLayoutPropertiesWidget::updateVariables()
267 {
268  if ( mBlockVariableUpdates )
269  return;
270 
271  QgsExpressionContext context;
275  mVariableEditor->setContext( &context );
276  mVariableEditor->setEditableScopeIndex( 2 );
277 }
278 
279 void QgsLayoutPropertiesWidget::blockSignals( bool block )
280 {
281  mGridResolutionSpinBox->blockSignals( block );
282  mOffsetXSpinBox->blockSignals( block );
283  mOffsetYSpinBox->blockSignals( block );
284  mSnapToleranceSpinBox->blockSignals( block );
285 }
286 
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:406
QgsLayout::changed
void changed()
Emitted when properties of the layout change.
qgsexpressioncontextutils.h
QgsLayout::referenceMap
QgsLayoutItemMap * referenceMap() const
Returns the map item which will be used to generate corresponding world files when the layout is expo...
Definition: qgslayout.cpp:430
QgsLayoutRenderContext::measurementConverter
const QgsLayoutMeasurementConverter & measurementConverter() const
Returns the layout measurement converter to be used in the layout.
Definition: qgslayoutrendercontext.h:133
QgsLayoutPropertiesWidget::updateGui
void updateGui()
Refreshes the gui to reflect the current layout settings.
Definition: qgslayoutpropertieswidget.cpp:116
qgslayoutundostack.h
QgsLayoutMeasurement::setUnits
void setUnits(const QgsUnitTypes::LayoutUnit units)
Sets the units for the measurement.
Definition: qgslayoutmeasurement.h:67
QgsExpressionContextUtils::globalScope
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
Definition: qgsexpressioncontextutils.cpp:40
QgsLayoutUnitsComboBox::changed
void changed(QgsUnitTypes::LayoutUnit unit)
Emitted when the unit is changed.
QgsLayout::renderContext
QgsLayoutRenderContext & renderContext()
Returns a reference to the layout's render context, which stores information relating to the current ...
Definition: qgslayout.cpp:359
QgsLayoutMeasurement::length
double length() const
Returns the length of the measurement.
Definition: qgslayoutmeasurement.h:48
QgsLayoutMeasurement::setLength
void setLength(const double length)
Sets the length of the measurement.
Definition: qgslayoutmeasurement.h:54
QgsLayoutUndoStack::endMacro
void endMacro()
Ends a macro command.
Definition: qgslayoutundostack.cpp:36
QgsUnitTypes::LayoutUnit
LayoutUnit
Layout measurement units.
Definition: qgsunittypes.h:181
QgsLayoutPoint::y
double y() const
Returns y coordinate of point.
Definition: qgslayoutpoint.h:86
QgsProject::instance
static QgsProject * instance()
Returns the QgsProject singleton instance.
Definition: qgsproject.cpp:480
QgsLayoutGridSettings::setResolution
void setResolution(QgsLayoutMeasurement resolution)
Sets the page/snap grid resolution.
Definition: qgslayoutgridsettings.cpp:39
QgsExpressionContextUtils::layoutScope
static QgsExpressionContextScope * layoutScope(const QgsLayout *layout)
Creates a new scope which contains variables and functions relating to a QgsLayout layout.
Definition: qgsexpressioncontextutils.cpp:556
QgsApplication::instance
static QgsApplication * instance()
Returns the singleton instance of the QgsApplication.
Definition: qgsapplication.cpp:478
QgsLayout::pageCollection
QgsLayoutPageCollection * pageCollection()
Returns a pointer to the layout's page collection, which stores and manages page items in the layout.
Definition: qgslayout.cpp:459
QgsVariableEditorWidget::scopeChanged
void scopeChanged()
Emitted when the user has modified a scope using the widget.
QgsLayout::snapper
QgsLayoutSnapper & snapper()
Returns a reference to the layout's snapper, which stores handles layout snap grids and lines and sna...
Definition: qgslayout.h:407
QgsLayoutRenderContext::setDpi
void setDpi(double dpi)
Sets the dpi for outputting the layout.
Definition: qgslayoutrendercontext.cpp:80
QgsLayoutGridSettings::setOffset
void setOffset(const QgsLayoutPoint &offset)
Sets the offset of the page/snap grid.
Definition: qgslayoutgridsettings.cpp:46
QgsExpressionContextUtils::projectScope
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
Definition: qgsexpressioncontextutils.cpp:291
QgsPrintLayout
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Definition: qgsprintlayout.h:30
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:29
QgsLayoutPoint::setY
void setY(const double y)
Sets y coordinate of point.
Definition: qgslayoutpoint.h:93
QgsLayout::customProperty
QVariant customProperty(const QString &key, const QVariant &defaultValue=QVariant()) const
Read a custom property from the layout.
Definition: qgslayout.cpp:415
whileBlocking
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Definition: qgis.h:2191
QgsLayoutSnapper::setSnapTolerance
void setSnapTolerance(int snapTolerance)
Sets the snap tolerance (in pixels) to use when snapping.
Definition: qgslayoutsnapper.cpp:36
QgsLayoutMeasurement::units
QgsUnitTypes::LayoutUnit units() const
Returns the units for the measurement.
Definition: qgslayoutmeasurement.h:60
QgsLayoutSnapper::snapTolerance
int snapTolerance() const
Returns the snap tolerance (in pixels) to use when snapping.
Definition: qgslayoutsnapper.h:59
QgsLayoutPageCollection::changed
void changed()
Emitted when pages are added or removed from the collection.
QgsPrintLayout::nameChanged
void nameChanged(const QString &name)
Emitted when the layout's name is changed.
QgsMargins
The QgsMargins class defines the four margins of a rectangle.
Definition: qgsmargins.h:37
QgsLayout::variablesChanged
void variablesChanged()
Emitted whenever the expression variables stored in the layout have been changed.
QgsApplication::customVariablesChanged
void customVariablesChanged()
Emitted whenever a custom global variable changes.
QgsLayoutItem
Base class for graphical items within a QgsLayout.
Definition: qgslayoutitem.h:112
QgsLayout::UndoLayoutDpi
@ UndoLayoutDpi
Change layout default DPI.
Definition: qgslayout.h:72
QgsPanelWidget::setPanelTitle
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
Definition: qgspanelwidget.h:44
QgsLayoutGridSettings::offset
QgsLayoutPoint offset() const
Returns the offset of the page/snap grid.
Definition: qgslayoutgridsettings.h:82
qgslayout.h
QgsLayoutUndoStack::beginMacro
void beginMacro(const QString &commandText)
Starts a macro command, with the given descriptive commandText.
Definition: qgslayoutundostack.cpp:30
qgslayoutsnapper.h
QgsLayoutItemMap
Layout graphical items for displaying a map.
Definition: qgslayoutitemmap.h:317
QgsLayout::setReferenceMap
void setReferenceMap(QgsLayoutItemMap *map)
Sets the map item which will be used to generate corresponding world files when the layout is exporte...
Definition: qgslayout.cpp:453
QgsLayoutAtlas::coverageLayerChanged
void coverageLayerChanged(QgsVectorLayer *layer)
Emitted when the coverage layer for the atlas changes.
QgsLayoutPoint::setX
void setX(const double x)
Sets the x coordinate of point.
Definition: qgslayoutpoint.h:79
QgsLayoutUndoStack::endCommand
void endCommand()
Saves final state of an object and pushes the active command to the undo history.
Definition: qgslayoutundostack.cpp:53
QgsLayoutPageCollection::redraw
void redraw()
Triggers a redraw for all pages.
Definition: qgslayoutpagecollection.cpp:448
QgsLayout
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:50
QgsLayoutPropertiesWidget::QgsLayoutPropertiesWidget
QgsLayoutPropertiesWidget(QWidget *parent, QgsLayout *layout)
constructor
Definition: qgslayoutpropertieswidget.cpp:27
qgsprintlayout.h
QgsLayout::gridSettings
QgsLayoutGridSettings & gridSettings()
Returns a reference to the layout's grid settings, which stores settings relating to grid appearance,...
Definition: qgslayout.h:419
QgsLayoutItemRegistry::LayoutMap
@ LayoutMap
Map item.
Definition: qgslayoutitemregistry.h:347
QgsLayoutUndoStack::beginCommand
void beginCommand(QgsLayoutUndoObjectInterface *object, const QString &commandText, int id=0)
Begins a new undo command for the specified object.
Definition: qgslayoutundostack.cpp:42
QgsProject::metadataChanged
void metadataChanged()
Emitted when the project's metadata is changed.
QgsDoubleSpinBox
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value....
Definition: qgsdoublespinbox.h:42
qgslayoutpagecollection.h
qgslayoutpropertieswidget.h
QgsLayoutPropertiesWidget::setMasterLayout
void setMasterLayout(QgsMasterLayoutInterface *masterLayout)
Sets the master layout.
Definition: qgslayoutpropertieswidget.cpp:107
QgsLayoutItemComboBox::itemChanged
void itemChanged(QgsLayoutItem *item)
Emitted whenever the currently selected item changes.
QgsLayoutRenderContext::dpi
double dpi() const
Returns the dpi for outputting the layout.
Definition: qgslayoutrendercontext.cpp:89
QgsUnitTypes::LayoutMillimeters
@ LayoutMillimeters
Millimeters.
Definition: qgsunittypes.h:183
QgsProject::customVariablesChanged
void customVariablesChanged()
Emitted whenever the expression variables stored in the project have been changed.
QgsMasterLayoutInterface
Interface for master layout type objects, such as print layouts and reports.
Definition: qgsmasterlayoutinterface.h:42
QgsLayout::setCustomProperty
void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for the layout.
Definition: qgslayout.cpp:407
QgsLayoutPoint
This class provides a method of storing points, consisting of an x and y coordinate,...
Definition: qgslayoutpoint.h:39
QgsLayoutPoint::setUnits
void setUnits(const QgsUnitTypes::LayoutUnit units)
Sets the units for the point.
Definition: qgslayoutpoint.h:106
QgsLayoutPoint::x
double x() const
Returns x coordinate of point.
Definition: qgslayoutpoint.h:72
QgsLayout::refresh
void refresh()
Forces the layout, and all items contained within it, to refresh.
Definition: qgslayout.cpp:804
QgsLayoutMeasurement
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...
Definition: qgslayoutmeasurement.h:33
QgsExpressionContextUtils::setLayoutVariables
static void setLayoutVariables(QgsLayout *layout, const QVariantMap &variables)
Sets all layout context variables.
Definition: qgsexpressioncontextutils.cpp:641
QgsLayoutPoint::units
QgsUnitTypes::LayoutUnit units() const
Returns the units for the point.
Definition: qgslayoutpoint.h:99
qgslayoutitemmap.h
QgsLayoutPageCollection::resizeToContents
void resizeToContents(const QgsMargins &margins, QgsUnitTypes::LayoutUnit marginUnits)
Resizes the layout to a single page which fits the current contents of the layout.
Definition: qgslayoutpagecollection.cpp:295
QgsLayoutGridSettings::resolution
QgsLayoutMeasurement resolution() const
Returns the page/snap grid resolution.
Definition: qgslayoutgridsettings.h:68
QgsLayoutRenderContext::dpiChanged
void dpiChanged()
Emitted when the context's DPI is changed.
qgslayoutatlas.h
QgsLayout::undoStack
QgsLayoutUndoStack * undoStack()
Returns a pointer to the layout's undo stack, which manages undo/redo states for the layout and it's ...
Definition: qgslayout.cpp:686