QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsstackeddiagramproperties.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsstackeddiagramproperties.h
3 Properties for stacked diagram layers
4 -------------------
5 begin : August 2024
6 copyright : (C) Germán Carrillo
7 email : german at opengis dot ch
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
23
24#include "qgsgui.h"
27#include "qgsproject.h"
29#include "moc_qgsstackeddiagramproperties.cpp"
30#include "qgsvectorlayer.h"
31#include "qgshelp.h"
32
34 : QgsPanelWidget( parent )
35 , mLayer( layer )
36 , mMapCanvas( canvas )
37{
38 if ( !layer )
39 {
40 return;
41 }
42
43 setupUi( this );
44 connect( mSubDiagramsView, &QAbstractItemView::doubleClicked, this, static_cast<void ( QgsStackedDiagramProperties::* )( const QModelIndex & )>( &QgsStackedDiagramProperties::editSubDiagramRenderer ) );
45
46 connect( mAddSubDiagramButton, &QPushButton::clicked, this, &QgsStackedDiagramProperties::addSubDiagramRenderer );
47 connect( mEditSubDiagramButton, &QAbstractButton::clicked, this, static_cast<void ( QgsStackedDiagramProperties::* )()>( &QgsStackedDiagramProperties::editSubDiagramRenderer ) );
48 connect( mRemoveSubDiagramButton, &QPushButton::clicked, this, &QgsStackedDiagramProperties::removeSubDiagramRenderer );
49
50 // Initialize stacked diagram controls
51 mStackedDiagramModeComboBox->addItem( tr( "Horizontal" ), QgsDiagramSettings::Horizontal );
52 mStackedDiagramModeComboBox->addItem( tr( "Vertical" ), QgsDiagramSettings::Vertical );
53
54 mStackedDiagramSpacingSpinBox->setClearValue( 0 );
56
57 connect( mStackedDiagramModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsStackedDiagramProperties::widgetChanged );
58 connect( mStackedDiagramSpacingSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ), this, &QgsStackedDiagramProperties::widgetChanged );
59 connect( mStackedDiagramSpacingUnitComboBox, &QgsUnitSelectionWidget::changed, this, &QgsStackedDiagramProperties::widgetChanged );
60
62 mSubDiagramsView->setModel( mModel );
63 mSubDiagramsView->resizeColumnToContents( 0 );
64
65 connect( mModel, &QAbstractItemModel::dataChanged, this, &QgsStackedDiagramProperties::widgetChanged );
66 connect( mModel, &QAbstractItemModel::rowsInserted, this, &QgsStackedDiagramProperties::widgetChanged );
67 connect( mModel, &QAbstractItemModel::rowsRemoved, this, &QgsStackedDiagramProperties::widgetChanged );
68
70}
71
72void QgsStackedDiagramProperties::addSubDiagramRenderer()
73{
74 // Create a single category renderer by default
75 std::unique_ptr<QgsDiagramRenderer> renderer;
76 std::unique_ptr<QgsSingleCategoryDiagramRenderer> dr = std::make_unique<QgsSingleCategoryDiagramRenderer>();
77 renderer = std::move( dr );
78
79 QItemSelectionModel *sel = mSubDiagramsView->selectionModel();
80 const QModelIndex index = sel->currentIndex();
81
82 if ( index.isValid() )
83 {
84 // add after this subDiagram
85 const QModelIndex currentIndex = mSubDiagramsView->selectionModel()->currentIndex();
86 mModel->insertSubDiagram( currentIndex.row() + 1, renderer.release() );
87 const QModelIndex newIndex = mModel->index( currentIndex.row() + 1, 0 );
88 mSubDiagramsView->selectionModel()->setCurrentIndex( newIndex, QItemSelectionModel::ClearAndSelect );
89 }
90 else
91 {
92 // append to root
93 appendSubDiagramRenderer( renderer.release() );
94 }
95 editSubDiagramRenderer();
96}
97
98void QgsStackedDiagramProperties::appendSubDiagramRenderer( QgsDiagramRenderer *dr )
99{
100 const int rows = mModel->rowCount();
101 mModel->insertSubDiagram( rows, dr ); // Transfers ownership
102 const QModelIndex newIndex = mModel->index( rows, 0 );
103 mSubDiagramsView->selectionModel()->setCurrentIndex( newIndex, QItemSelectionModel::ClearAndSelect );
104}
105
106void QgsStackedDiagramProperties::editSubDiagramRenderer()
107{
108 editSubDiagramRenderer( mSubDiagramsView->selectionModel()->currentIndex() );
109}
110
111void QgsStackedDiagramProperties::editSubDiagramRenderer( const QModelIndex &index )
112{
113 if ( !index.isValid() )
114 return;
115
116 QgsDiagramRenderer *renderer = mModel->subDiagramForIndex( index );
119
120 if ( panel && panel->dockMode() )
121 {
122 QgsDiagramProperties *widget = new QgsDiagramProperties( mLayer, this, mMapCanvas );
123 widget->setPanelTitle( tr( "Edit Sub Diagram" ) );
124 widget->layout()->setContentsMargins( 0, 0, 0, 0 );
125 widget->syncToRenderer( renderer );
126 widget->syncToSettings( &dls );
127 if ( !couldBeFirstSubDiagram( index ) )
128 {
130 }
131
133 connect( widget, &QgsPanelWidget::panelAccepted, this, &QgsStackedDiagramProperties::subDiagramWidgetPanelAccepted );
134 connect( widget, &QgsDiagramProperties::widgetChanged, this, &QgsStackedDiagramProperties::liveUpdateSubDiagramFromPanel );
135 openPanel( widget );
136 return;
137 }
138
139 QgsStackedDiagramPropertiesDialog dlg( mLayer, this, mMapCanvas );
140 dlg.syncToRenderer( renderer );
141 dlg.syncToSettings( &dls );
142 if ( !couldBeFirstSubDiagram( index ) )
143 {
144 dlg.setAllowedToEditDiagramLayerSettings( false );
145 }
146
147 if ( dlg.exec() )
148 {
149 const QModelIndex index = mSubDiagramsView->selectionModel()->currentIndex();
150 if ( dlg.isAllowedToEditDiagramLayerSettings() )
151 mModel->updateDiagramLayerSettings( dlg.diagramLayerSettings() );
152
153 // This call will emit dataChanged, which in turns triggers widgetChanged()
154 mModel->updateSubDiagram( index, dlg.renderer() );
155 }
156}
157
158void QgsStackedDiagramProperties::removeSubDiagramRenderer()
159{
160 const QItemSelection sel = mSubDiagramsView->selectionModel()->selection();
161 const auto constSel = sel;
162 for ( const QItemSelectionRange &range : constSel )
163 {
164 if ( range.isValid() )
165 mModel->removeRows( range.top(), range.bottom() - range.top() + 1, range.parent() );
166 }
167 // make sure that the selection is gone
168 mSubDiagramsView->selectionModel()->clear();
169}
170
172{
173 const QgsDiagramRenderer *dr = mLayer->diagramRenderer();
174
175 if ( dr && dr->diagram() )
176 {
177 const QList<QgsDiagramSettings> settingList = dr->diagramSettings();
178 mStackedDiagramModeComboBox->setCurrentIndex( settingList.at( 0 ).stackedDiagramMode );
179 mStackedDiagramSpacingSpinBox->setValue( settingList.at( 0 ).stackedDiagramSpacing() );
180 mStackedDiagramSpacingUnitComboBox->setUnit( settingList.at( 0 ).stackedDiagramSpacingUnit() );
181
183 {
184 const QgsStackedDiagramRenderer *stackedDiagramRenderer = static_cast<const QgsStackedDiagramRenderer *>( dr );
185 const QList<QgsDiagramRenderer *> renderers = stackedDiagramRenderer->renderers();
186 for ( const QgsDiagramRenderer *renderer : renderers )
187 {
188 appendSubDiagramRenderer( renderer->clone() );
189 }
190 }
191 else
192 {
193 // Take this single renderer as the first stacked renderer
194 appendSubDiagramRenderer( dr->clone() );
195 }
196
197 const QgsDiagramLayerSettings *dls = mLayer->diagramLayerSettings();
198 mModel->updateDiagramLayerSettings( *dls );
199 }
200}
201
203{
204 std::unique_ptr<QgsDiagramSettings> ds = std::make_unique<QgsDiagramSettings>();
205 ds->stackedDiagramMode = static_cast<QgsDiagramSettings::StackedDiagramMode>( mStackedDiagramModeComboBox->currentData().toInt() );
206 ds->setStackedDiagramSpacingUnit( mStackedDiagramSpacingUnitComboBox->unit() );
207 ds->setStackedDiagramSpacing( mStackedDiagramSpacingSpinBox->value() );
208
209 // Create diagram renderer for the StackedDiagram
211 dr->setDiagram( new QgsStackedDiagram() );
212
213 // Get DiagramSettings from each subdiagram
214 const QList<QgsDiagramRenderer *> renderers = mModel->subRenderers();
215 for ( const QgsDiagramRenderer *renderer : renderers )
216 {
217 const QList<QgsDiagramSettings> ds1 = renderer->diagramSettings();
218 if ( !ds1.isEmpty() )
219 {
220 ds->categoryAttributes += ds1.at( 0 ).categoryAttributes;
221 ds->categoryLabels += ds1.at( 0 ).categoryLabels;
222 ds->categoryColors += ds1.at( 0 ).categoryColors;
223 }
224 dr->addRenderer( renderer->clone() );
225 }
226
227 dr->setDiagramSettings( *ds );
228 mLayer->setDiagramRenderer( dr );
229
230 // Get DiagramLayerSettings from the model
232 mLayer->setDiagramLayerSettings( dls );
233
234 // refresh
236 mLayer->triggerRepaint();
237}
238
239bool QgsStackedDiagramProperties::couldBeFirstSubDiagram( const QModelIndex &index ) const
240{
241 if ( !index.isValid() )
242 return false;
243
244 if ( mModel->rowCount() == 1 )
245 return true;
246
247 // Is there any enabled subdiagram before our index.row()?
248 // If so, ours cannot be the first diagram.
249 const QList<QgsDiagramRenderer *> renderers = mModel->subRenderers();
250
251 for ( int i = 0; i < index.row(); i++ )
252 {
253 const QgsDiagramRenderer *renderer = renderers.at( i );
254 const QList<QgsDiagramSettings> ds = renderer->diagramSettings();
255 if ( !ds.isEmpty() && ds.at( 0 ).enabled )
256 {
257 // First enabled subdiagram found, and we know our row is after.
258 // Therefore, return false to disallow showing DLS settings for it.
259 return false;
260 }
261 }
262 // Either our row is the first subdiagram enabled or it's disabled,
263 // but there are no enabled ones before. So, ours could be the first
264 // enabled one after being edited.
265 // Therefore, we should allow DLS settings on its corresponding widget.
266 return true;
267}
268
269void QgsStackedDiagramProperties::subDiagramWidgetPanelAccepted( QgsPanelWidget *panel )
270{
271 QgsDiagramProperties *widget = qobject_cast<QgsDiagramProperties *>( panel );
272
273 std::unique_ptr<QgsDiagramRenderer> renderer = widget->createRenderer();
274
275 const QModelIndex index = mSubDiagramsView->selectionModel()->currentIndex();
277 mModel->updateDiagramLayerSettings( widget->createDiagramLayerSettings() );
278
279 mModel->updateSubDiagram( index, renderer.release() );
280}
281
282void QgsStackedDiagramProperties::liveUpdateSubDiagramFromPanel()
283{
284 subDiagramWidgetPanelAccepted( qobject_cast<QgsPanelWidget *>( sender() ) );
285}
286
288
289#include "qgsvscrollarea.h"
290
292 : QDialog( parent )
293{
294#ifdef Q_OS_MAC
295 setWindowModality( Qt::WindowModal );
296#endif
297
298 QVBoxLayout *layout = new QVBoxLayout( this );
299 QgsVScrollArea *scrollArea = new QgsVScrollArea( this );
300 scrollArea->setFrameShape( QFrame::NoFrame );
301 layout->addWidget( scrollArea );
302
303 buttonBox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok );
304 mPropsWidget = new QgsDiagramProperties( layer, this, mapCanvas );
305 mPropsWidget->setDockMode( false );
306
307 scrollArea->setWidget( mPropsWidget );
308 layout->addWidget( buttonBox );
309 this->setWindowTitle( "Edit Sub Diagram" );
311
312 connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsStackedDiagramPropertiesDialog::accept );
313 connect( buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject );
314 connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsStackedDiagramPropertiesDialog::showHelp );
315}
316
318{
319 mPropsWidget->syncToRenderer( dr );
320}
321
323{
324 mPropsWidget->syncToSettings( dls );
325}
326
328{
329 // Get renderer and diagram layer settings from widget
330 mRenderer = mPropsWidget->createRenderer();
331 mDiagramLayerSettings = mPropsWidget->createDiagramLayerSettings();
332 QDialog::accept();
333}
334
336{
337 return mRenderer.release();
338}
339
344
349
354
355void QgsStackedDiagramPropertiesDialog::showHelp()
356{
357 QgsHelp::openHelp( QStringLiteral( "working_with_vector/vector_properties.html#diagrams-properties" ) );
358}
359
361
363 : QAbstractTableModel( parent )
364{
365}
366
371
372Qt::ItemFlags QgsStackedDiagramPropertiesModel::flags( const QModelIndex &index ) const
373{
374 const Qt::ItemFlag checkable = ( index.column() == 0 ? Qt::ItemIsUserCheckable : Qt::NoItemFlags );
375
376 return Qt::ItemIsEnabled | Qt::ItemIsSelectable | checkable;
377}
378
379QVariant QgsStackedDiagramPropertiesModel::data( const QModelIndex &index, int role ) const
380{
381 if ( !index.isValid() )
382 return QVariant();
383
385
386 if ( role == Qt::DisplayRole || role == Qt::ToolTipRole )
387 {
388 switch ( index.column() )
389 {
390 case 1:
391 if ( dr && dr->diagram() )
392 {
394 {
395 return tr( "Pie Chart" );
396 }
398 {
399 return tr( "Text Diagram" );
400 }
402 {
403 return tr( "Histogram" );
404 }
406 {
407 return tr( "Stacked Bars" );
408 }
410 {
411 return tr( "Stacked Diagram" );
412 }
413 else
414 {
415 return dr->diagram()->diagramName();
416 }
417 }
418 else
419 {
420 return tr( "(no diagram)" );
421 }
422 case 2:
423 if ( !dr )
424 {
425 return tr( "(no renderer)" );
426 }
427 else
428 {
430 return tr( "Fixed" );
432 return tr( "Scaled" );
433 else
434 return tr( "Unknown" );
435 }
436 case 3:
437 if ( dr && dr->diagram() && !dr->diagramSettings().isEmpty() )
438 {
440 {
441 switch ( dr->diagramSettings().at( 0 ).diagramOrientation )
442 {
444 return tr( "Left" );
446 return tr( "Right" );
448 return tr( "Up" );
450 return tr( "Down" );
451 }
452 }
453 }
454 return QVariant();
455 case 0:
456 default:
457 return QVariant();
458 }
459 }
460 else if ( role == Qt::TextAlignmentRole )
461 {
462 return index.column() == 0 ? static_cast<Qt::Alignment::Int>( Qt::AlignCenter ) : static_cast<Qt::Alignment::Int>( Qt::AlignLeft );
463 }
464 else if ( role == Qt::CheckStateRole )
465 {
466 if ( index.column() != 0 )
467 return QVariant();
468
469 return ( dr && !dr->diagramSettings().isEmpty() && dr->diagramSettings().at( 0 ).enabled ) ? Qt::Checked : Qt::Unchecked;
470 }
471 else
472 {
473 return QVariant();
474 }
475}
476
477QVariant QgsStackedDiagramPropertiesModel::headerData( int section, Qt::Orientation orientation, int role ) const
478{
479 if ( orientation == Qt::Horizontal && role == Qt::DisplayRole && section >= 0 && section < 4 )
480 {
481 QStringList lst;
482 lst << tr( "Enabled" ) << tr( "Diagram type" ) << tr( "Size" ) << tr( "Orientation" );
483 return lst[section];
484 }
485
486 return QVariant();
487}
488
489int QgsStackedDiagramPropertiesModel::rowCount( const QModelIndex & ) const
490{
491 return mRenderers.size();
492}
493
494int QgsStackedDiagramPropertiesModel::columnCount( const QModelIndex & ) const
495{
496 return 4;
497}
498
499bool QgsStackedDiagramPropertiesModel::setData( const QModelIndex &index, const QVariant &value, int role )
500{
501 if ( !index.isValid() )
502 return false;
503
505
506 if ( role == Qt::CheckStateRole )
507 {
508 if ( dr && !dr->diagramSettings().isEmpty() )
509 {
510 QgsDiagramSettings ds = dr->diagramSettings().at( 0 );
511 ds.enabled = ( value.toInt() == Qt::Checked );
512
514 {
516 dsr->setDiagramSettings( ds );
517 }
518 else
519 {
521 dlir->setDiagramSettings( ds );
522 }
523
524 emit dataChanged( index, index );
525 return true;
526 }
527 }
528 return false;
529}
530
531bool QgsStackedDiagramPropertiesModel::removeRows( int row, int count, const QModelIndex &parent )
532{
533 if ( row < 0 || row >= mRenderers.size() )
534 return false;
535
536 beginRemoveRows( parent, row, row + count - 1 );
537 while ( count-- )
538 mRenderers.removeAt( row );
539 endRemoveRows();
540
541 return true;
542}
543
545{
546 if ( index.isValid() )
547 return mRenderers.at( index.row() );
548 return nullptr;
549}
550
552{
553 beginInsertRows( QModelIndex(), index, index );
554 mRenderers.insert( index, newSubDiagram );
555 endInsertRows();
556}
557
559{
560 if ( !index.isValid() )
561 return;
562
563 delete mRenderers.at( index.row() );
564 mRenderers.replace( index.row(), dr );
565 emit dataChanged( index, index );
566}
567
568QList<QgsDiagramRenderer *> QgsStackedDiagramPropertiesModel::subRenderers() const
569{
570 return mRenderers;
571}
572
577
@ Millimeters
Millimeters.
@ Points
Points (e.g., for font sizes)
@ MapUnits
Map units.
@ MetersInMapUnits
Meters value as Map units.
Stores the settings for rendering of all diagrams for a layer.
void syncToSettings(const QgsDiagramLayerSettings *dls)
Updates the widget to reflect the diagram layer settings.
void setDockMode(bool dockMode) override
Sets the widget in dock mode.
bool isAllowedToEditDiagramLayerSettings() const
Returns whether this widget is allowed to edit diagram layer settings.
void syncToRenderer(const QgsDiagramRenderer *dr)
Updates the widget to reflect the diagram renderer.
void setAllowedToEditDiagramLayerSettings(bool allowed)
Sets whether the widget should show diagram layer settings.
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
virtual QString rendererName() const =0
QgsDiagram * diagram() const
virtual QList< QgsDiagramSettings > diagramSettings() const =0
Returns list with all diagram settings in the renderer.
void setDiagram(QgsDiagram *d)
virtual QgsDiagramRenderer * clone() const =0
Returns new instance that is equivalent to this one.
Stores the settings for rendering a single diagram.
StackedDiagramMode
Orientation of the stacked diagrams.
virtual QString diagramName() const =0
Gets a descriptive name for this diagram type.
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
Definition qgsgui.cpp:210
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
Definition qgshelp.cpp:39
static const QString DIAGRAM_NAME_HISTOGRAM
Alters the size of rendered diagrams using a linear scaling.
void setDiagramSettings(const QgsDiagramSettings &s)
static const QString DIAGRAM_RENDERER_NAME_LINEARLY_INTERPOLATED
Map canvas is a class for displaying all GIS data types on a canvas.
void triggerRepaint(bool deferredUpdate=false)
Will advise the map canvas (and any other interested party) that this layer requires to be repainted.
Base class for any widget that can be shown as a inline panel.
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 panelAccepted(QgsPanelWidget *panel)
Emitted when the panel is accepted by the user.
void widgetChanged()
Emitted when the widget state changes.
static QgsPanelWidget * findParentPanel(QWidget *widget)
Traces through the parents of a widget to find if it is contained within a QgsPanelWidget widget.
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
bool dockMode()
Returns the dock mode state.
static const QString DIAGRAM_NAME_PIE
static QgsProject * instance()
Returns the QgsProject singleton instance.
void setDirty(bool b=true)
Flag the project as dirty (modified).
Renders the diagrams for all features with the same settings.
void setDiagramSettings(const QgsDiagramSettings &s)
static const QString DIAGRAM_RENDERER_NAME_SINGLE_CATEGORY
static const QString DIAGRAM_NAME_STACKED_BAR
QgsStackedDiagramPropertiesDialog(QgsVectorLayer *layer, QWidget *parent=nullptr, QgsMapCanvas *mapCanvas=nullptr)
Constructor for QgsStackedDiagramPropertiesDialog.
QgsDiagramLayerSettings diagramLayerSettings() const
Gets diagram layer settings built from the diagram properties widget.
void setAllowedToEditDiagramLayerSettings(bool allowed) const
Delegates to the main widget to set whether the widget should show diagram layer settings to be edite...
void syncToRenderer(const QgsDiagramRenderer *dr) const
Delegates to the diagram properties widget to sync with the given renderer.
void syncToSettings(const QgsDiagramLayerSettings *dls) const
Delegates to the diagram properties widget to sync with the given diagram layer settings.
bool isAllowedToEditDiagramLayerSettings() const
Returns whether the main widget is allowed to edit diagram layer settings.
void accept() override
Applies changes from the widget to the internal renderer and diagram layer settings.
QgsDiagramRenderer * renderer()
Gets a renderer object built from the diagram properties widget.
Model for sub diagrams in a stacked diagram view.
void updateSubDiagram(const QModelIndex &index, QgsDiagramRenderer *dr)
Replaces the diagram located at index by dr. Takes ownership.
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
void insertSubDiagram(const int index, QgsDiagramRenderer *newSubDiagram)
Inserts a new diagram at the specified position. Takes ownership.
QList< QgsDiagramRenderer * > mRenderers
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
QgsDiagramRenderer * subDiagramForIndex(const QModelIndex &index) const
Returns the diagram renderer at the specified index. Does not transfer ownership.
void updateDiagramLayerSettings(QgsDiagramLayerSettings dls)
Sets the diagram layer settings for the model.
Qt::ItemFlags flags(const QModelIndex &index) const override
QgsDiagramLayerSettings diagramLayerSettings() const
Returns the diagram layer settings from the model.
QList< QgsDiagramRenderer * > subRenderers() const
Returns the list of diagram renderers from the model. Does not transfer ownership.
int columnCount(const QModelIndex &=QModelIndex()) const override
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
QgsStackedDiagramPropertiesModel(QObject *parent=nullptr)
constructor
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
int rowCount(const QModelIndex &=QModelIndex()) const override
void syncToLayer()
Updates the widget to reflect the layer's current diagram settings.
QgsStackedDiagramProperties(QgsVectorLayer *layer, QWidget *parent, QgsMapCanvas *canvas)
Renders diagrams using mixed diagram render types.
void setDiagramSettings(const QgsDiagramSettings &s)
static const QString DIAGRAM_RENDERER_NAME_STACKED
void addRenderer(QgsDiagramRenderer *renderer)
Adds a renderer to the stacked renderer object.
QList< QgsDiagramRenderer * > renderers(bool sortByDiagramMode=false) const
Returns an ordered list with the renderers of the stacked renderer object.
A diagram composed of several subdiagrams, located side by side.
static const QString DIAGRAM_NAME_STACKED
static const QString DIAGRAM_NAME_TEXT
void changed()
Emitted when the selected unit is changed, or the definition of the map unit scale is changed.
QgsVScrollArea is a QScrollArea subclass which only displays a vertical scrollbar and fits the width ...
Represents a vector layer which manages a vector based data sets.
const QgsDiagramLayerSettings * diagramLayerSettings() const
void setDiagramLayerSettings(const QgsDiagramLayerSettings &s)
void setDiagramRenderer(QgsDiagramRenderer *r)
Sets diagram rendering object (takes ownership)
const QgsDiagramRenderer * diagramRenderer() const