QGIS API Documentation 3.43.0-Master (5df50c54ce9)
qgslayoutelevationprofilewidget.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutelevationprofilewidget.cpp
3 ----------------------
4 begin : January 2023
5 copyright : (C) 2023 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
19#include "moc_qgslayoutelevationprofilewidget.cpp"
21#include "qgslayoutitemwidget.h"
23#include "qgsplot.h"
24#include "qgsfillsymbol.h"
25#include "qgslinesymbol.h"
26#include "qgsvectorlayer.h"
28#include "qgslayout.h"
29#include "qgslayertree.h"
33#include "qgscurve.h"
34#include "qgslayoutatlas.h"
36#include "qgsprofilerenderer.h"
37#include "qgsgui.h"
38#include <QMenu>
39
41
43 : QgsLayoutItemBaseWidget( nullptr, profile )
44 , mProfile( profile )
45 , mLayerTree( new QgsLayerTree() )
46 , mLayerTreeBridge( new QgsLayerTreeRegistryBridge( mLayerTree.get(), mProfile->layout() ? mProfile->layout()->project() : QgsProject::instance(), this ) )
47{
48 Q_ASSERT( mProfile );
49
50 setupUi( this );
51 setPanelTitle( tr( "Elevation Profile Properties" ) );
52
53 mCopyFromDockMenu = new QMenu( this );
54 connect( mCopyFromDockMenu, &QMenu::aboutToShow, this, [=] {
55 sBuildCopyMenuFunction( this, mCopyFromDockMenu );
56 } );
57
58 connect( mActionRefresh, &QAction::triggered, this, [=] {
59 if ( !mProfile )
60 {
61 return;
62 }
63 mProfile->invalidateCache();
64 mProfile->refresh();
65 } );
66
67 QToolButton *copyFromDockButton = new QToolButton();
68 copyFromDockButton->setAutoRaise( true );
69 copyFromDockButton->setToolTip( tr( "Copy From Profile" ) );
70 copyFromDockButton->setMenu( mCopyFromDockMenu );
71 copyFromDockButton->setPopupMode( QToolButton::InstantPopup );
72 copyFromDockButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionCopyProfileSettings.svg" ) ) );
73
74 mDockToolbar->addWidget( copyFromDockButton );
75
76 //add widget for general composer item properties
77 mItemPropertiesWidget = new QgsLayoutItemPropertiesWidget( this, profile );
78 mainLayout->addWidget( mItemPropertiesWidget );
79
80 connect( mLayerTree.get(), &QgsLayerTree::layerOrderChanged, this, &QgsLayoutElevationProfileWidget::updateItemLayers );
81 connect( mLayerTree.get(), &QgsLayerTreeGroup::visibilityChanged, this, &QgsLayoutElevationProfileWidget::updateItemLayers );
82
83 mSpinTolerance->setClearValue( 0 );
84 connect( mSpinTolerance, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
85 if ( !mProfile || mBlockChanges )
86 return;
87
88 mProfile->beginCommand( tr( "Change Profile Tolerance Distance" ), QgsLayoutItem::UndoElevationProfileTolerance );
89 mProfile->setTolerance( value );
90 mProfile->invalidateCache();
91 mProfile->update();
92 mProfile->endCommand();
93 } );
94
95 connect( mCheckControlledByAtlas, &QCheckBox::toggled, this, [=] {
96 if ( !mProfile || mBlockChanges )
97 return;
98
99 mProfile->beginCommand( tr( "Change Profile Atlas Control" ) );
100 mProfile->setAtlasDriven( mCheckControlledByAtlas->isChecked() );
101 mProfile->invalidateCache();
102 mProfile->update();
103 mProfile->endCommand();
104 } );
105
106 // subsections indicator
107 mSubsectionsSymbolButton->setSymbolType( Qgis::SymbolType::Line );
108 connect( mSubsectionsSymbolButton, &QgsSymbolButton::changed, this, [=] {
109 if ( !mProfile || mBlockChanges )
110 return;
111
112 mProfile->beginCommand( tr( "Change Profile Subsection Indicator" ), QgsLayoutItem::UndoElevationProfileSubsectionLines );
113 mProfile->setSubsectionsSymbol( mSubsectionsSymbolButton->clonedSymbol<QgsLineSymbol>() );
114 mProfile->invalidateCache();
115 mProfile->update();
116 mProfile->endCommand();
117 } );
118 mSubsectionsSymbolButton->setDefaultSymbol( QgsProfilePlotRenderer::defaultSubSectionsSymbol().release() );
119
120 connect( mSubsectionsActivateCheck, &QGroupBox::toggled, this, [=] {
121 if ( !mProfile || mBlockChanges )
122 return;
123
124 const bool subsectionsActivated = mSubsectionsActivateCheck->isChecked();
125 mProfile->beginCommand( tr( "Change Profile Subsection Indicator" ), QgsLayoutItem::UndoElevationProfileSubsectionLines );
126 std::unique_ptr<QgsLineSymbol> subSectionsSymbol( subsectionsActivated ? mSubsectionsSymbolButton->clonedSymbol<QgsLineSymbol>() : nullptr );
127 mProfile->setSubsectionsSymbol( subSectionsSymbol.release() );
128
129 mProfile->invalidateCache();
130 mProfile->update();
131 mProfile->endCommand();
132 } );
133
134 mSpinMinDistance->setClearValue( 0 );
135 connect( mSpinMinDistance, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
136 if ( !mProfile || mBlockChanges )
137 return;
138
139 mProfile->beginCommand( tr( "Change Profile Chart Minimum Distance" ), QgsLayoutItem::UndoElevationProfileMinimumDistance );
140 mProfile->plot()->setXMinimum( value );
141 mProfile->invalidateCache();
142 mProfile->update();
143 mProfile->endCommand();
144 } );
145
146 connect( mSpinMaxDistance, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
147 if ( !mProfile || mBlockChanges )
148 return;
149
150 mProfile->beginCommand( tr( "Change Profile Chart Maximum Distance" ), QgsLayoutItem::UndoElevationProfileMaximumDistance );
151 mProfile->plot()->setXMaximum( value );
152 mProfile->invalidateCache();
153 mProfile->update();
154 mProfile->endCommand();
155 } );
156
157 mSpinMinElevation->setClearValue( 0 );
158 connect( mSpinMinElevation, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
159 if ( !mProfile || mBlockChanges )
160 return;
161
162 mProfile->beginCommand( tr( "Change Profile Chart Minimum Elevation" ), QgsLayoutItem::UndoElevationProfileMinimumElevation );
163 mProfile->plot()->setYMinimum( value );
164 mProfile->invalidateCache();
165 mProfile->update();
166 mProfile->endCommand();
167 } );
168
169 connect( mSpinMaxElevation, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
170 if ( !mProfile || mBlockChanges )
171 return;
172
173 mProfile->beginCommand( tr( "Change Profile Chart Maximum Elevation" ), QgsLayoutItem::UndoElevationProfileMaximumElevation );
174 mProfile->plot()->setYMaximum( value );
175 mProfile->invalidateCache();
176 mProfile->update();
177 mProfile->endCommand();
178 } );
179
180 mDistanceAxisMajorLinesSymbolButton->setSymbolType( Qgis::SymbolType::Line );
181 connect( mDistanceAxisMajorLinesSymbolButton, &QgsSymbolButton::changed, this, [=] {
182 if ( !mProfile || mBlockChanges )
183 return;
184
185 mProfile->beginCommand( tr( "Change Profile Chart Distance Major Gridlines" ), QgsLayoutItem::UndoElevationProfileDistanceMajorGridlines );
186 mProfile->plot()->xAxis().setGridMajorSymbol( mDistanceAxisMajorLinesSymbolButton->clonedSymbol<QgsLineSymbol>() );
187 mProfile->invalidateCache();
188 mProfile->update();
189 mProfile->endCommand();
190 } );
191 mDistanceAxisMajorLinesSymbolButton->setDefaultSymbol( QgsPlotDefaultSettings::axisGridMajorSymbol() );
192
193 mDistanceAxisMinorLinesSymbolButton->setSymbolType( Qgis::SymbolType::Line );
194 connect( mDistanceAxisMinorLinesSymbolButton, &QgsSymbolButton::changed, this, [=] {
195 if ( !mProfile || mBlockChanges )
196 return;
197
198 mProfile->beginCommand( tr( "Change Profile Chart Distance Minor Gridlines" ), QgsLayoutItem::UndoElevationProfileDistanceMinorGridlines );
199 mProfile->plot()->xAxis().setGridMinorSymbol( mDistanceAxisMinorLinesSymbolButton->clonedSymbol<QgsLineSymbol>() );
200 mProfile->invalidateCache();
201 mProfile->update();
202 mProfile->endCommand();
203 } );
204 mDistanceAxisMinorLinesSymbolButton->setDefaultSymbol( QgsPlotDefaultSettings::axisGridMinorSymbol() );
205
206 connect( mDistanceAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
207 if ( !mProfile || mBlockChanges )
208 return;
209
210 mProfile->beginCommand( tr( "Change Profile Chart Distance Major Gridlines" ), QgsLayoutItem::UndoElevationProfileDistanceMajorGridlines );
211 mProfile->plot()->xAxis().setGridIntervalMajor( value );
212 mProfile->invalidateCache();
213 mProfile->update();
214 mProfile->endCommand();
215 } );
216
217 connect( mDistanceAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
218 if ( !mProfile || mBlockChanges )
219 return;
220
221 mProfile->beginCommand( tr( "Change Profile Chart Distance Minor Gridlines" ), QgsLayoutItem::UndoElevationProfileDistanceMinorGridlines );
222 mProfile->plot()->xAxis().setGridIntervalMinor( value );
223 mProfile->invalidateCache();
224 mProfile->update();
225 mProfile->endCommand();
226 } );
227
228 connect( mDistanceAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
229 if ( !mProfile || mBlockChanges )
230 return;
231
232 mProfile->beginCommand( tr( "Change Profile Chart Distance Label" ), QgsLayoutItem::UndoElevationProfileDistanceLabels );
233 mProfile->plot()->xAxis().setLabelInterval( value );
234 mProfile->invalidateCache();
235 mProfile->update();
236 mProfile->endCommand();
237 } );
238
239 mElevationAxisMajorLinesSymbolButton->setSymbolType( Qgis::SymbolType::Line );
240 connect( mElevationAxisMajorLinesSymbolButton, &QgsSymbolButton::changed, this, [=] {
241 if ( !mProfile || mBlockChanges )
242 return;
243
244 mProfile->beginCommand( tr( "Change Profile Chart Elevation Major Gridlines" ), QgsLayoutItem::UndoElevationProfileElevationMajorGridlines );
245 mProfile->plot()->yAxis().setGridMajorSymbol( mElevationAxisMajorLinesSymbolButton->clonedSymbol<QgsLineSymbol>() );
246 mProfile->invalidateCache();
247 mProfile->update();
248 mProfile->endCommand();
249 } );
250 mElevationAxisMajorLinesSymbolButton->setDefaultSymbol( QgsPlotDefaultSettings::axisGridMajorSymbol() );
251
252 mElevationAxisMinorLinesSymbolButton->setSymbolType( Qgis::SymbolType::Line );
253 connect( mElevationAxisMinorLinesSymbolButton, &QgsSymbolButton::changed, this, [=] {
254 if ( !mProfile || mBlockChanges )
255 return;
256
257 mProfile->beginCommand( tr( "Change Profile Chart Elevation Minor Gridlines" ), QgsLayoutItem::UndoElevationProfileElevationMinorGridlines );
258 mProfile->plot()->yAxis().setGridMinorSymbol( mElevationAxisMinorLinesSymbolButton->clonedSymbol<QgsLineSymbol>() );
259 mProfile->invalidateCache();
260 mProfile->update();
261 mProfile->endCommand();
262 } );
263 mElevationAxisMinorLinesSymbolButton->setDefaultSymbol( QgsPlotDefaultSettings::axisGridMinorSymbol() );
264
265 connect( mElevationAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
266 if ( !mProfile || mBlockChanges )
267 return;
268
269 mProfile->beginCommand( tr( "Change Profile Chart Elevation Label" ), QgsLayoutItem::UndoElevationProfileElevationLabels );
270 mProfile->plot()->yAxis().setLabelInterval( value );
271 mProfile->invalidateCache();
272 mProfile->update();
273 mProfile->endCommand();
274 } );
275
276 connect( mElevationAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
277 if ( !mProfile || mBlockChanges )
278 return;
279
280 mProfile->beginCommand( tr( "Change Profile Chart Elevation Major Gridlines" ), QgsLayoutItem::UndoElevationProfileElevationMajorGridlines );
281 mProfile->plot()->yAxis().setGridIntervalMajor( value );
282 mProfile->invalidateCache();
283 mProfile->update();
284 mProfile->endCommand();
285 } );
286
287 connect( mElevationAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
288 if ( !mProfile || mBlockChanges )
289 return;
290
291 mProfile->beginCommand( tr( "Change Profile Chart Distance Minor Gridlines" ), QgsLayoutItem::UndoElevationProfileElevationMinorGridlines );
292 mProfile->plot()->yAxis().setGridIntervalMinor( value );
293 mProfile->invalidateCache();
294 mProfile->update();
295 mProfile->endCommand();
296 } );
297
298 mChartBackgroundSymbolButton->setSymbolType( Qgis::SymbolType::Fill );
299 connect( mChartBackgroundSymbolButton, &QgsSymbolButton::changed, this, [=] {
300 if ( !mProfile || mBlockChanges )
301 return;
302
303 mProfile->beginCommand( tr( "Change Profile Chart Background" ), QgsLayoutItem::UndoElevationProfileChartBackground );
304 mProfile->plot()->setChartBackgroundSymbol( mChartBackgroundSymbolButton->clonedSymbol<QgsFillSymbol>() );
305 mProfile->invalidateCache();
306 mProfile->update();
307 mProfile->endCommand();
308 } );
309 mChartBackgroundSymbolButton->setDefaultSymbol( QgsPlotDefaultSettings::chartBackgroundSymbol() );
310
311 mChartBorderSymbolButton->setSymbolType( Qgis::SymbolType::Fill );
312 connect( mChartBorderSymbolButton, &QgsSymbolButton::changed, this, [=] {
313 if ( !mProfile || mBlockChanges )
314 return;
315
316 mProfile->beginCommand( tr( "Change Profile Chart Border" ), QgsLayoutItem::UndoElevationProfileChartBorder );
317 mProfile->plot()->setChartBorderSymbol( mChartBorderSymbolButton->clonedSymbol<QgsFillSymbol>() );
318 mProfile->invalidateCache();
319 mProfile->update();
320 mProfile->endCommand();
321 } );
322 mChartBorderSymbolButton->setDefaultSymbol( QgsPlotDefaultSettings::chartBorderSymbol() );
323
324 connect( mDistanceAxisLabelFormatButton, &QPushButton::clicked, this, [=] {
325 if ( !mProfile || mBlockChanges )
326 return;
327
329 widget->setPanelTitle( tr( "Distance Number Format" ) );
330 widget->setFormat( mProfile->plot()->xAxis().numericFormat() );
331 connect( widget, &QgsNumericFormatSelectorWidget::changed, this, [=] {
332 mProfile->beginCommand( tr( "Change Profile Chart Distance Format" ), QgsLayoutItem::UndoElevationProfileDistanceFormat );
333 mProfile->plot()->xAxis().setNumericFormat( widget->format() );
334 mProfile->invalidateCache();
335 mProfile->endCommand();
336 mProfile->update();
337 } );
338 openPanel( widget );
339 } );
340
341 connect( mElevationAxisLabelFormatButton, &QPushButton::clicked, this, [=] {
342 if ( !mProfile || mBlockChanges )
343 return;
344
346 widget->setPanelTitle( tr( "Elevation Number Format" ) );
347 widget->setFormat( mProfile->plot()->yAxis().numericFormat() );
348 connect( widget, &QgsNumericFormatSelectorWidget::changed, this, [=] {
349 mProfile->beginCommand( tr( "Change Profile Chart Elevation Format" ), QgsLayoutItem::UndoElevationProfileElevationFormat );
350 mProfile->plot()->yAxis().setNumericFormat( widget->format() );
351 mProfile->invalidateCache();
352 mProfile->endCommand();
353 mProfile->update();
354 } );
355 openPanel( widget );
356 } );
357
358 mDistanceAxisLabelFontButton->setDialogTitle( tr( "Distance Label Font" ) );
359 mElevationAxisLabelFontButton->setDialogTitle( tr( "Elevation Label Font" ) );
360 mDistanceAxisLabelFontButton->setMode( QgsFontButton::ModeTextRenderer );
361 mElevationAxisLabelFontButton->setMode( QgsFontButton::ModeTextRenderer );
362
363 connect( mDistanceAxisLabelFontButton, &QgsFontButton::changed, this, [=] {
364 if ( !mProfile || mBlockChanges )
365 return;
366
367 mProfile->beginCommand( tr( "Change Profile Chart Distance Font" ), QgsLayoutItem::UndoElevationProfileDistanceFont );
368 mProfile->plot()->xAxis().setTextFormat( mDistanceAxisLabelFontButton->textFormat() );
369 mProfile->invalidateCache();
370 mProfile->endCommand();
371 mProfile->update();
372 } );
373
374 connect( mElevationAxisLabelFontButton, &QgsFontButton::changed, this, [=] {
375 if ( !mProfile || mBlockChanges )
376 return;
377
378 mProfile->beginCommand( tr( "Change Profile Chart Elevation Font" ), QgsLayoutItem::UndoElevationProfileElevationFont );
379 mProfile->plot()->yAxis().setTextFormat( mElevationAxisLabelFontButton->textFormat() );
380 mProfile->invalidateCache();
381 mProfile->endCommand();
382 mProfile->update();
383 } );
384
385 mSpinLeftMargin->setClearValue( 0 );
386 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
387 if ( !mProfile || mBlockChanges )
388 return;
389
390 mProfile->beginCommand( tr( "Change Profile Chart Left Margin" ), QgsLayoutItem::UndoMarginLeft );
391 QgsMargins margins = mProfile->plot()->margins();
392 margins.setLeft( value );
393 mProfile->plot()->setMargins( margins );
394 mProfile->invalidateCache();
395 mProfile->update();
396 mProfile->endCommand();
397 } );
398
399 mSpinRightMargin->setClearValue( 0 );
400 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
401 if ( !mProfile || mBlockChanges )
402 return;
403
404 mProfile->beginCommand( tr( "Change Profile Chart Right Margin" ), QgsLayoutItem::UndoMarginRight );
405 QgsMargins margins = mProfile->plot()->margins();
406 margins.setRight( value );
407 mProfile->plot()->setMargins( margins );
408 mProfile->invalidateCache();
409 mProfile->update();
410 mProfile->endCommand();
411 } );
412
413 mSpinTopMargin->setClearValue( 0 );
414 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
415 if ( !mProfile || mBlockChanges )
416 return;
417
418 mProfile->beginCommand( tr( "Change Profile Chart Top Margin" ), QgsLayoutItem::UndoMarginTop );
419 QgsMargins margins = mProfile->plot()->margins();
420 margins.setTop( value );
421 mProfile->plot()->setMargins( margins );
422 mProfile->invalidateCache();
423 mProfile->update();
424 mProfile->endCommand();
425 } );
426
427 mSpinBottomMargin->setClearValue( 0 );
428 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
429 if ( !mProfile || mBlockChanges )
430 return;
431
432 mProfile->beginCommand( tr( "Change Profile Chart Bottom Margin" ), QgsLayoutItem::UndoMarginBottom );
433 QgsMargins margins = mProfile->plot()->margins();
434 margins.setBottom( value );
435 mProfile->plot()->setMargins( margins );
436 mProfile->invalidateCache();
437 mProfile->update();
438 mProfile->endCommand();
439 } );
440
441 for ( Qgis::DistanceUnit unit :
442 {
453 } )
454 {
455 QString title;
457 {
459 }
460 else
461 {
462 title = QgsUnitTypes::toString( unit );
463 }
464 mDistanceUnitCombo->addItem( title, QVariant::fromValue( unit ) );
465 }
466
467 connect( mDistanceUnitCombo, qOverload<int>( &QComboBox::currentIndexChanged ), this, [=]( int ) {
468 if ( !mProfile || mBlockChanges )
469 return;
470
471 mProfile->beginCommand( tr( "Change Profile Chart Units" ) );
472 mProfile->setDistanceUnit( mDistanceUnitCombo->currentData().value<Qgis::DistanceUnit>() );
473 mProfile->invalidateCache();
474 mProfile->update();
475 mProfile->endCommand();
476 } );
477
478 mDistanceLabelsCombo->addItem( tr( "None" ), QVariant::fromValue( Qgis::PlotAxisSuffixPlacement::NoLabels ) );
479 mDistanceLabelsCombo->addItem( tr( "Every Value" ), QVariant::fromValue( Qgis::PlotAxisSuffixPlacement::EveryLabel ) );
480 mDistanceLabelsCombo->addItem( tr( "First Value" ), QVariant::fromValue( Qgis::PlotAxisSuffixPlacement::FirstLabel ) );
481 mDistanceLabelsCombo->addItem( tr( "Last Value" ), QVariant::fromValue( Qgis::PlotAxisSuffixPlacement::LastLabel ) );
482 mDistanceLabelsCombo->addItem( tr( "First and Last Values" ), QVariant::fromValue( Qgis::PlotAxisSuffixPlacement::FirstAndLastLabels ) );
483 connect( mDistanceLabelsCombo, qOverload<int>( &QComboBox::currentIndexChanged ), this, [=]( int ) {
484 if ( !mProfile || mBlockChanges )
485 return;
486
487 mProfile->beginCommand( tr( "Change Profile Chart Label Placement" ) );
488 mProfile->plot()->xAxis().setLabelSuffixPlacement( mDistanceLabelsCombo->currentData().value<Qgis::PlotAxisSuffixPlacement>() );
489 mProfile->invalidateCache();
490 mProfile->update();
491 mProfile->endCommand();
492 } );
493
494
510
511 mLayerTreeView = new QgsElevationProfileLayerTreeView( mLayerTree.get() );
512
513 QVBoxLayout *vl = new QVBoxLayout();
514 vl->setContentsMargins( 0, 0, 0, 0 );
515 vl->addWidget( mLayerTreeView );
516 mTreeViewContainer->setLayout( vl );
517
518 mBlockChanges++;
519 mLayerTreeView->populateInitialLayers( mProfile->layout() && mProfile->layout()->project() ? mProfile->layout()->project() : QgsProject::instance() );
520 mBlockChanges--;
521
522 setGuiElementValues();
523
524 mSubsectionsSymbolButton->registerExpressionContextGenerator( mProfile );
525 mDistanceAxisMajorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
526 mDistanceAxisMinorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
527 mElevationAxisMajorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
528 mElevationAxisMinorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
529 mChartBackgroundSymbolButton->registerExpressionContextGenerator( mProfile );
530 mChartBorderSymbolButton->registerExpressionContextGenerator( mProfile );
531 mDistanceAxisLabelFontButton->registerExpressionContextGenerator( mProfile );
532 mElevationAxisLabelFontButton->registerExpressionContextGenerator( mProfile );
533
534 mSubsectionsSymbolButton->setLayer( coverageLayer() );
535 mDistanceAxisMajorLinesSymbolButton->setLayer( coverageLayer() );
536 mDistanceAxisMinorLinesSymbolButton->setLayer( coverageLayer() );
537 mElevationAxisMajorLinesSymbolButton->setLayer( coverageLayer() );
538 mElevationAxisMinorLinesSymbolButton->setLayer( coverageLayer() );
539 mDistanceAxisLabelFontButton->setLayer( coverageLayer() );
540 mElevationAxisLabelFontButton->setLayer( coverageLayer() );
541 mChartBackgroundSymbolButton->setLayer( coverageLayer() );
542 mChartBorderSymbolButton->setLayer( coverageLayer() );
543
544 if ( mProfile->layout() )
545 {
546 connect( &mProfile->layout()->reportContext(), &QgsLayoutReportContext::layerChanged, this, [=]( QgsVectorLayer *layer ) {
547 mSubsectionsSymbolButton->setLayer( layer );
548 mDistanceAxisMajorLinesSymbolButton->setLayer( layer );
549 mDistanceAxisMinorLinesSymbolButton->setLayer( layer );
550 mElevationAxisMajorLinesSymbolButton->setLayer( layer );
551 mElevationAxisMinorLinesSymbolButton->setLayer( layer );
552 mDistanceAxisLabelFontButton->setLayer( layer );
553 mElevationAxisLabelFontButton->setLayer( layer );
554 mChartBackgroundSymbolButton->setLayer( layer );
555 mChartBorderSymbolButton->setLayer( layer );
556 } );
557
558 connect( &mProfile->layout()->reportContext(), &QgsLayoutReportContext::layerChanged, this, &QgsLayoutElevationProfileWidget::atlasLayerChanged );
559 }
560
561 if ( QgsLayoutAtlas *atlas = layoutAtlas() )
562 {
563 connect( atlas, &QgsLayoutAtlas::toggled, this, &QgsLayoutElevationProfileWidget::layoutAtlasToggled );
564 layoutAtlasToggled( atlas->enabled() );
565 }
566}
567
569
571{
572 if ( mItemPropertiesWidget )
573 mItemPropertiesWidget->setMasterLayout( masterLayout );
574}
575
577{
578 return mProfile->createExpressionContext();
579}
580
586
588{
589 mCheckControlledByAtlas->setText( tr( "Controlled by %1" ).arg( string == tr( "atlas" ) ? tr( "Atlas" ) : tr( "Report" ) ) );
590}
591
593{
594 mBlockChanges++;
595
596 mProfile->setCrs( canvas->crs() );
597
598 mSpinTolerance->setValue( canvas->tolerance() );
599 mProfile->setTolerance( canvas->tolerance() );
600
601 mProfile->setDistanceUnit( canvas->distanceUnit() );
602 mDistanceUnitCombo->setCurrentIndex( mDistanceUnitCombo->findData( QVariant::fromValue( canvas->distanceUnit() ) ) );
603
604 mProfile->plot()->xAxis().setLabelSuffixPlacement( canvas->plot().xAxis().labelSuffixPlacement() );
605 mDistanceLabelsCombo->setCurrentIndex( mDistanceLabelsCombo->findData( QVariant::fromValue( canvas->plot().xAxis().labelSuffixPlacement() ) ) );
606
607 if ( const QgsCurve *curve = canvas->profileCurve() )
608 mProfile->setProfileCurve( curve->clone() );
609
610 mSpinMinDistance->setValue( canvas->plot().xMinimum() );
611 mSpinMinDistance->setClearValue( canvas->plot().xMinimum() );
612 mProfile->plot()->setXMinimum( canvas->plot().xMinimum() );
613
614 mSpinMaxDistance->setValue( canvas->plot().xMaximum() );
615 mSpinMaxDistance->setClearValue( canvas->plot().xMaximum() );
616 mProfile->plot()->setXMaximum( canvas->plot().xMaximum() );
617
618 mDistanceAxisMajorIntervalSpin->setValue( canvas->plot().xAxis().gridIntervalMajor() );
619 mDistanceAxisMajorIntervalSpin->setClearValue( canvas->plot().xAxis().gridIntervalMajor() );
620 mProfile->plot()->xAxis().setGridIntervalMajor( canvas->plot().xAxis().gridIntervalMajor() );
621
622 mDistanceAxisMinorIntervalSpin->setValue( canvas->plot().xAxis().gridIntervalMinor() );
623 mDistanceAxisMinorIntervalSpin->setClearValue( canvas->plot().xAxis().gridIntervalMinor() );
624 mProfile->plot()->xAxis().setGridIntervalMinor( canvas->plot().xAxis().gridIntervalMinor() );
625
626 mDistanceAxisLabelIntervalSpin->setValue( canvas->plot().xAxis().labelInterval() );
627 mDistanceAxisLabelIntervalSpin->setClearValue( canvas->plot().xAxis().labelInterval() );
628 mProfile->plot()->xAxis().setLabelInterval( canvas->plot().xAxis().labelInterval() );
629
630 mSpinMinElevation->setValue( canvas->plot().xMinimum() );
631 mSpinMinElevation->setClearValue( canvas->plot().yMinimum() );
632 mProfile->plot()->setYMinimum( canvas->plot().yMinimum() );
633
634 mSpinMaxElevation->setValue( canvas->plot().yMaximum() );
635 mSpinMaxElevation->setClearValue( canvas->plot().yMaximum() );
636 mProfile->plot()->setYMaximum( canvas->plot().yMaximum() );
637
638 mElevationAxisMajorIntervalSpin->setValue( canvas->plot().yAxis().gridIntervalMajor() );
639 mElevationAxisMajorIntervalSpin->setClearValue( canvas->plot().yAxis().gridIntervalMajor() );
640 mProfile->plot()->yAxis().setGridIntervalMajor( canvas->plot().yAxis().gridIntervalMajor() );
641
642 mElevationAxisMinorIntervalSpin->setValue( canvas->plot().yAxis().gridIntervalMinor() );
643 mElevationAxisMinorIntervalSpin->setClearValue( canvas->plot().yAxis().gridIntervalMinor() );
644 mProfile->plot()->yAxis().setGridIntervalMinor( canvas->plot().yAxis().gridIntervalMinor() );
645
646 mElevationAxisLabelIntervalSpin->setValue( canvas->plot().yAxis().labelInterval() );
647 mElevationAxisLabelIntervalSpin->setClearValue( canvas->plot().yAxis().labelInterval() );
648 mProfile->plot()->yAxis().setLabelInterval( canvas->plot().yAxis().labelInterval() );
649
650 const QgsLineSymbol *subSectionsSymbol = canvas->subsectionsSymbol() ? canvas->subsectionsSymbol() : nullptr;
651 const bool subSectionsEnabled = static_cast< bool >( subSectionsSymbol );
652 mSubsectionsActivateCheck->setChecked( subSectionsEnabled );
653 if ( subSectionsSymbol )
654 {
655 mSubsectionsSymbolButton->setSymbol( subSectionsSymbol->clone() );
656 mProfile->setSubsectionsSymbol( subSectionsSymbol->clone() );
657 }
658
659 QList<QgsMapLayer *> canvasLayers = canvas->layers();
660 // canvas layers are in opposite direction to what the layout item requires
661 std::reverse( canvasLayers.begin(), canvasLayers.end() );
662 mProfile->setLayers( canvasLayers );
663 const QList<QgsLayerTreeLayer *> layers = mLayerTree->findLayers();
664 for ( QgsLayerTreeLayer *layer : layers )
665 {
666 layer->setItemVisibilityChecked( mProfile->layers().contains( layer->layer() ) );
667 }
668 mLayerTree->reorderGroupLayers( mProfile->layers() );
669
670 mProfile->invalidateCache();
671 mProfile->update();
672 mBlockChanges--;
673}
674
676{
678 return false;
679
680 if ( mProfile )
681 {
682 disconnect( mProfile, &QgsLayoutObject::changed, this, &QgsLayoutElevationProfileWidget::setGuiElementValues );
683 }
684
685 mProfile = qobject_cast<QgsLayoutItemElevationProfile *>( item );
686 mItemPropertiesWidget->setItem( mProfile );
687
688 if ( mProfile )
689 {
690 connect( mProfile, &QgsLayoutObject::changed, this, &QgsLayoutElevationProfileWidget::setGuiElementValues );
691 mSubsectionsSymbolButton->registerExpressionContextGenerator( mProfile );
692 mDistanceAxisMajorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
693 mDistanceAxisMinorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
694 mElevationAxisMajorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
695 mElevationAxisMinorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
696 mDistanceAxisLabelFontButton->registerExpressionContextGenerator( mProfile );
697 mElevationAxisLabelFontButton->registerExpressionContextGenerator( mProfile );
698 mChartBackgroundSymbolButton->registerExpressionContextGenerator( mProfile );
699 mChartBorderSymbolButton->registerExpressionContextGenerator( mProfile );
700 }
701
702 setGuiElementValues();
703
704 return true;
705}
706
707void QgsLayoutElevationProfileWidget::setGuiElementValues()
708{
709 mBlockChanges++;
710
711 mSpinTolerance->setValue( mProfile->tolerance() );
712 mCheckControlledByAtlas->setChecked( mProfile->atlasDriven() );
713
714 mSpinMinDistance->setValue( mProfile->plot()->xMinimum() );
715 mSpinMaxDistance->setValue( mProfile->plot()->xMaximum() );
716 mSpinMinElevation->setValue( mProfile->plot()->yMinimum() );
717 mSpinMaxElevation->setValue( mProfile->plot()->yMaximum() );
718
719 mSubsectionsActivateCheck->setChecked( mProfile->subsectionsSymbol() );
720 if ( mProfile->subsectionsSymbol() )
721 {
722 mSubsectionsSymbolButton->setSymbol( mProfile->subsectionsSymbol()->clone() );
723 }
724
725 if ( mProfile->plot()->xAxis().gridMajorSymbol() )
726 mDistanceAxisMajorLinesSymbolButton->setSymbol( mProfile->plot()->xAxis().gridMajorSymbol()->clone() );
727 if ( mProfile->plot()->xAxis().gridMinorSymbol() )
728 mDistanceAxisMinorLinesSymbolButton->setSymbol( mProfile->plot()->xAxis().gridMinorSymbol()->clone() );
729 if ( mProfile->plot()->yAxis().gridMajorSymbol() )
730 mElevationAxisMajorLinesSymbolButton->setSymbol( mProfile->plot()->yAxis().gridMajorSymbol()->clone() );
731 if ( mProfile->plot()->yAxis().gridMinorSymbol() )
732 mElevationAxisMinorLinesSymbolButton->setSymbol( mProfile->plot()->yAxis().gridMinorSymbol()->clone() );
733
734 mDistanceAxisLabelFontButton->setTextFormat( mProfile->plot()->xAxis().textFormat() );
735 mElevationAxisLabelFontButton->setTextFormat( mProfile->plot()->yAxis().textFormat() );
736
737 mDistanceUnitCombo->setCurrentIndex( mDistanceUnitCombo->findData( QVariant::fromValue( mProfile->distanceUnit() ) ) );
738 mDistanceLabelsCombo->setCurrentIndex( mDistanceLabelsCombo->findData( QVariant::fromValue( mProfile->plot()->xAxis().labelSuffixPlacement() ) ) );
739
740 mDistanceAxisMajorIntervalSpin->setValue( mProfile->plot()->xAxis().gridIntervalMajor() );
741 mDistanceAxisMinorIntervalSpin->setValue( mProfile->plot()->xAxis().gridIntervalMinor() );
742 mDistanceAxisLabelIntervalSpin->setValue( mProfile->plot()->xAxis().labelInterval() );
743
744 mElevationAxisMajorIntervalSpin->setValue( mProfile->plot()->yAxis().gridIntervalMajor() );
745 mElevationAxisMinorIntervalSpin->setValue( mProfile->plot()->yAxis().gridIntervalMinor() );
746 mElevationAxisLabelIntervalSpin->setValue( mProfile->plot()->yAxis().labelInterval() );
747
748 if ( mProfile->plot()->chartBackgroundSymbol() )
749 mChartBackgroundSymbolButton->setSymbol( mProfile->plot()->chartBackgroundSymbol()->clone() );
750 if ( mProfile->plot()->chartBorderSymbol() )
751 mChartBorderSymbolButton->setSymbol( mProfile->plot()->chartBorderSymbol()->clone() );
752
753 mSpinLeftMargin->setValue( mProfile->plot()->margins().left() );
754 mSpinRightMargin->setValue( mProfile->plot()->margins().right() );
755 mSpinTopMargin->setValue( mProfile->plot()->margins().top() );
756 mSpinBottomMargin->setValue( mProfile->plot()->margins().bottom() );
757
758 const QList<QgsLayerTreeLayer *> layers = mLayerTree->findLayers();
759 for ( QgsLayerTreeLayer *layer : layers )
760 {
761 layer->setItemVisibilityChecked( mProfile->layers().contains( layer->layer() ) );
762 }
763 mLayerTree->reorderGroupLayers( mProfile->layers() );
764
765 updateDataDefinedButton( mDDBtnTolerance );
766 updateDataDefinedButton( mDDBtnMinDistance );
767 updateDataDefinedButton( mDDBtnMaxDistance );
768 updateDataDefinedButton( mDDBtnMinElevation );
769 updateDataDefinedButton( mDDBtnMaxElevation );
770 updateDataDefinedButton( mDDBtnDistanceMajorInterval );
771 updateDataDefinedButton( mDDBtnDistanceMinorInterval );
772 updateDataDefinedButton( mDDBtnDistanceLabelInterval );
773 updateDataDefinedButton( mDDBtnElevationMajorInterval );
774 updateDataDefinedButton( mDDBtnElevationMinorInterval );
775 updateDataDefinedButton( mDDBtnElevationLabelInterval );
776 updateDataDefinedButton( mDDBtnLeftMargin );
777 updateDataDefinedButton( mDDBtnRightMargin );
778 updateDataDefinedButton( mDDBtnTopMargin );
779 updateDataDefinedButton( mDDBtnBottomMargin );
780
781 mBlockChanges--;
782}
783
784void QgsLayoutElevationProfileWidget::updateItemLayers()
785{
786 if ( mBlockChanges )
787 return;
788
789 QList<QgsMapLayer *> layers;
790 const QList<QgsMapLayer *> layerOrder = mLayerTree->layerOrder();
791 layers.reserve( layerOrder.size() );
792 for ( QgsMapLayer *layer : layerOrder )
793 {
794 if ( mLayerTree->findLayer( layer )->isVisible() )
795 layers << layer;
796 }
797
798 mProfile->setLayers( layers );
799 mProfile->update();
800}
801
802void QgsLayoutElevationProfileWidget::layoutAtlasToggled( bool atlasEnabled )
803{
804 if ( atlasEnabled && mProfile && mProfile->layout() && mProfile->layout()->reportContext().layer()
805 && mProfile->layout()->reportContext().layer()->geometryType() == Qgis::GeometryType::Line )
806 {
807 mCheckControlledByAtlas->setEnabled( true );
808 }
809 else
810 {
811 mCheckControlledByAtlas->setEnabled( false );
812 mCheckControlledByAtlas->setChecked( false );
813 }
814}
815
816void QgsLayoutElevationProfileWidget::atlasLayerChanged( QgsVectorLayer *layer )
817{
818 if ( !layer || layer->geometryType() != Qgis::GeometryType::Line )
819 {
820 //non-line layer, disable atlas control
821 mCheckControlledByAtlas->setChecked( false );
822 mCheckControlledByAtlas->setEnabled( false );
823 return;
824 }
825 else
826 {
827 mCheckControlledByAtlas->setEnabled( true );
828 }
829}
PlotAxisSuffixPlacement
Placement options for suffixes in the labels for axis of plots.
Definition qgis.h:3212
@ FirstAndLastLabels
Place suffix after the first and last label values only.
@ EveryLabel
Place suffix after every value label.
@ FirstLabel
Place suffix after the first label value only.
@ LastLabel
Place suffix after the last label value only.
@ NoLabels
Do not place suffixes.
DistanceUnit
Units of distance.
Definition qgis.h:4844
@ Feet
Imperial feet.
@ Centimeters
Centimeters.
@ Millimeters
Millimeters.
@ Miles
Terrestrial miles.
@ Yards
Imperial yards.
@ Degrees
Degrees, for planar geographic CRS distance measurements.
@ NauticalMiles
Nautical miles.
@ Kilometers
Kilometers.
@ TitleCase
Simple title case conversion - does not fully grammatically parse the text and uses simple rules only...
@ Line
Line symbol.
@ Fill
Fill symbol.
double yMaximum() const
Returns the maximum value of the y axis.
Definition qgsplot.h:383
QgsPlotAxis & xAxis()
Returns a reference to the plot's x axis.
Definition qgsplot.h:397
double xMaximum() const
Returns the maximum value of the x axis.
Definition qgsplot.h:369
double xMinimum() const
Returns the minimum value of the x axis.
Definition qgsplot.h:341
QgsPlotAxis & yAxis()
Returns a reference to the plot's y axis.
Definition qgsplot.h:411
double yMinimum() const
Returns the minimum value of the y axis.
Definition qgsplot.h:355
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
Abstract base class for curved geometry type.
Definition qgscurve.h:35
A canvas for elevation profiles.
QgsCurve * profileCurve() const
Returns the profile curve.
QgsCoordinateReferenceSystem crs() const override
Returns the coordinate reference system (CRS) for map coordinates used by the canvas.
QList< QgsMapLayer * > layers() const
Returns the list of layers included in the profile.
const Qgs2DPlot & plot() const
Returns a reference to the 2D plot used by the widget.
Qgis::DistanceUnit distanceUnit() const
Returns the distance unit used by the canvas.
double tolerance() const
Returns the tolerance of the profile (in crs() units).
QgsLineSymbol * subsectionsSymbol()
Returns the symbol used to draw the subsections.
A layer tree view for elevation profiles.
void populateInitialLayers(QgsProject *project)
Initially populates the tree view using layers from a project.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
@ ModeTextRenderer
Configure font settings for use with QgsTextRenderer.
void changed()
Emitted when the widget's text format settings are changed.
@ HigDialogTitleIsTitleCase
Dialog titles should be title case.
Definition qgsgui.h:278
static QgsGui::HigFlags higFlags()
Returns the platform's HIG flags.
Definition qgsgui.cpp:239
Layer tree node points to a map layer.
void visibilityChanged(QgsLayerTreeNode *node)
Emitted when check state of a node within the tree has been changed.
Listens to layer changes from a QgsProject and applies changes to a QgsLayerTree.
Namespace with helper functions for layer tree operations.
void layerOrderChanged()
Emitted when the layer order has changed.
Used to render QgsLayout as an atlas, by iterating over the features from an associated vector layer.
void toggled(bool enabled)
Emitted when atlas is enabled or disabled.
A common interface for layout designer dialogs and widgets.
A widget for layout elevation profile item settings.
void setReportTypeString(const QString &string) override
Sets the string to use to describe the current report type (e.g.
void copySettingsFromProfileCanvas(QgsElevationProfileCanvas *canvas)
Copies selected settings from a elevation profile canvas.
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
void setMasterLayout(QgsMasterLayoutInterface *masterLayout) override
Sets the master layout associated with the item.
bool setNewItem(QgsLayoutItem *item) override
Attempts to update the widget to show the properties for the specified item.
static std::function< void(QgsLayoutElevationProfileWidget *, QMenu *)> sBuildCopyMenuFunction
QgsLayoutElevationProfileWidget(QgsLayoutItemElevationProfile *profile)
constructor
void setDesignerInterface(QgsLayoutDesignerInterface *iface) override
Sets the the layout designer interface in which the widget is being shown.
A base class for property widgets for layout items.
void updateDataDefinedButton(QgsPropertyOverrideButton *button)
Updates a previously registered data defined button to reflect the item's current properties.
QgsVectorLayer * coverageLayer() const
Returns the current layout context coverage layer (if set).
void registerDataDefinedButton(QgsPropertyOverrideButton *button, QgsLayoutObject::DataDefinedProperty property)
Registers a data defined button, setting up its initial value, connections and description.
virtual void setDesignerInterface(QgsLayoutDesignerInterface *iface)
Sets the the layout designer interface in which the widget is being shown.
QgsLayoutAtlas * layoutAtlas() const
Returns the atlas for the layout (if available)
A layout item subclass for elevation profile plots.
A widget for controlling the common properties of layout items (e.g.
void setMasterLayout(QgsMasterLayoutInterface *masterLayout)
Sets the master layout associated with the item.
void setItem(QgsLayoutItem *item)
Sets the layout item.
@ LayoutElevationProfile
Elevation profile item.
Base class for graphical items within a QgsLayout.
@ UndoElevationProfileElevationMajorGridlines
Change elevation profile elevation axis major gridlines.
@ UndoElevationProfileMaximumDistance
Change elevation profile maximum distance.
@ UndoElevationProfileChartBackground
Change elevation profile chart background.
@ UndoElevationProfileDistanceMinorGridlines
Change elevation profile distance axis minor gridlines.
@ UndoMarginTop
Top margin.
@ UndoElevationProfileChartBorder
Change elevation profile chart border.
@ UndoElevationProfileMaximumElevation
Change elevation profile maximum elevation.
@ UndoMarginLeft
Left margin.
@ UndoMarginRight
Right margin.
@ UndoElevationProfileTolerance
Change elevation profile distance tolerance.
@ UndoElevationProfileElevationFormat
Change elevation profile elevation axis number format.
@ UndoElevationProfileMinimumElevation
Change elevation profile minimum elevation.
@ UndoElevationProfileDistanceLabels
Change elevation profile distance axis label interval.
@ UndoMarginBottom
Bottom margin.
@ UndoElevationProfileElevationFont
Change elevation profile elevation axis number font.
@ UndoElevationProfileDistanceFormat
Change elevation profile distance axis number format.
@ UndoElevationProfileElevationMinorGridlines
Change elevation profile elevation axis minor gridlines.
@ UndoElevationProfileDistanceFont
Change elevation profile distance axis number font.
@ UndoElevationProfileElevationLabels
Change elevation profile elevation axis label interval.
@ UndoElevationProfileDistanceMajorGridlines
Change elevation profile distance axis major gridlines.
@ UndoElevationProfileMinimumDistance
Change elevation profile minimum distance.
@ UndoElevationProfileSubsectionLines
Change elevation profile subsection indicator symbol.
int type() const override
Returns a unique graphics item type identifier.
void changed()
Emitted when the object's properties change.
@ ElevationProfileMaximumDistance
Maximum distance value for elevation profile.
@ ElevationProfileElevationMinorInterval
Minor grid line interval for elevation profile elevation axis.
@ ElevationProfileDistanceMinorInterval
Minor grid line interval for elevation profile distance axis.
@ ElevationProfileMinimumDistance
Minimum distance value for elevation profile.
@ ElevationProfileMaximumElevation
Maximum elevation value for elevation profile.
@ ElevationProfileDistanceLabelInterval
Label interval for elevation profile distance axis.
@ ElevationProfileTolerance
Tolerance distance for elevation profiles.
@ ElevationProfileMinimumElevation
Minimum elevation value for elevation profile.
@ ElevationProfileElevationLabelInterval
Label interval for elevation profile elevation axis.
@ ElevationProfileDistanceMajorInterval
Major grid line interval for elevation profile distance axis.
@ ElevationProfileElevationMajorInterval
Major grid line interval for elevation profile elevation axis.
void layerChanged(QgsVectorLayer *layer)
Emitted when the context's layer is changed.
A line symbol type, for rendering LineString and MultiLineString geometries.
QgsLineSymbol * clone() const override
Returns a deep copy of this symbol.
Base class for all map layer types.
Definition qgsmaplayer.h:77
Defines the four margins of a rectangle.
Definition qgsmargins.h:37
void setBottom(double bottom)
Sets the bottom margin to bottom.
Definition qgsmargins.h:113
void setLeft(double left)
Sets the left margin to left.
Definition qgsmargins.h:95
void setRight(double right)
Sets the right margin to right.
Definition qgsmargins.h:107
void setTop(double top)
Sets the top margin to top.
Definition qgsmargins.h:101
Interface for master layout type objects, such as print layouts and reports.
A widget which allows choice of numeric formats and the properties of them.
QgsNumericFormat * format() const
Returns a new format object representing the settings currently configured in the widget.
void changed()
Emitted whenever the format configured55 in the widget is changed.
void setFormat(const QgsNumericFormat *format)
Sets the format to show in the widget.
void openPanel(QgsPanelWidget *panel)
Open a panel or dialog depending on dock mode setting If dock mode is true this method will emit the ...
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
double gridIntervalMinor() const
Returns the interval of minor grid lines for the axis.
Definition qgsplot.h:99
double gridIntervalMajor() const
Returns the interval of major grid lines for the axis.
Definition qgsplot.h:113
double labelInterval() const
Returns the interval of labels for the axis.
Definition qgsplot.h:127
Qgis::PlotAxisSuffixPlacement labelSuffixPlacement() const
Returns the placement for the axis label suffixes.
Definition qgsplot.cpp:124
static QgsFillSymbol * chartBorderSymbol()
Returns the default fill symbol to use for the chart area border.
Definition qgsplot.cpp:805
static QgsLineSymbol * axisGridMinorSymbol()
Returns the default line symbol to use for axis minor grid lines.
Definition qgsplot.cpp:792
static QgsFillSymbol * chartBackgroundSymbol()
Returns the default fill symbol to use for the chart area background fill.
Definition qgsplot.cpp:799
static QgsLineSymbol * axisGridMajorSymbol()
Returns the default line symbol to use for axis major grid lines.
Definition qgsplot.cpp:785
static std::unique_ptr< QgsLineSymbol > defaultSubSectionsSymbol()
Returns the default line symbol to use for subsections lines.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107
static QgsProject * instance()
Returns the QgsProject singleton instance.
static QString capitalize(const QString &string, Qgis::Capitalization capitalization)
Converts a string by applying capitalization rules to the string.
void changed()
Emitted when the symbol's settings are changed.
static Q_INVOKABLE QString toString(Qgis::DistanceUnit unit)
Returns a translated string representing a distance unit.
Represents a vector layer which manages a vector based dataset.
Q_INVOKABLE Qgis::GeometryType geometryType() const
Returns point, line or polygon.