QGIS API Documentation 3.39.0-Master (0c9320c8adc)
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 "qgsvectorlayer.h"
30#include "qgshelp.h"
31
33 : QgsPanelWidget( parent )
34 , mLayer( layer )
35 , mMapCanvas( canvas )
36{
37 if ( !layer )
38 {
39 return;
40 }
41
42 setupUi( this );
43 connect( mSubDiagramsView, &QAbstractItemView::doubleClicked, this, static_cast<void ( QgsStackedDiagramProperties::* )( const QModelIndex & )>( &QgsStackedDiagramProperties::editSubDiagram ) );
44
45 connect( mAddSubDiagramButton, &QPushButton::clicked, this, &QgsStackedDiagramProperties::addSubDiagram );
46 connect( mEditSubDiagramButton, &QAbstractButton::clicked, this, static_cast<void ( QgsStackedDiagramProperties::* )()>( &QgsStackedDiagramProperties::editSubDiagram ) );
47 connect( mRemoveSubDiagramButton, &QPushButton::clicked, this, &QgsStackedDiagramProperties::removeSubDiagram );
48
49 // Initialize stacked diagram controls
50 mStackedDiagramModeComboBox->addItem( tr( "Horizontal" ), QgsDiagramSettings::Horizontal );
51 mStackedDiagramModeComboBox->addItem( tr( "Vertical" ), QgsDiagramSettings::Vertical );
52
53 mStackedDiagramSpacingSpinBox->setClearValue( 0 );
54 mStackedDiagramSpacingUnitComboBox->setUnits( { Qgis::RenderUnit::Millimeters,
60
61 connect( mStackedDiagramModeComboBox, qOverload< int >( &QComboBox::currentIndexChanged ), this, &QgsStackedDiagramProperties::widgetChanged );
62 connect( mStackedDiagramSpacingSpinBox, qOverload< double >( &QgsDoubleSpinBox::valueChanged ), this, &QgsStackedDiagramProperties::widgetChanged );
63 connect( mStackedDiagramSpacingUnitComboBox, &QgsUnitSelectionWidget::changed, this, &QgsStackedDiagramProperties::widgetChanged );
64
66 mSubDiagramsView->setModel( mModel );
67 mSubDiagramsView->resizeColumnToContents( 0 );
68
69 connect( mModel, &QAbstractItemModel::dataChanged, this, &QgsStackedDiagramProperties::widgetChanged );
70 connect( mModel, &QAbstractItemModel::rowsInserted, this, &QgsStackedDiagramProperties::widgetChanged );
71 connect( mModel, &QAbstractItemModel::rowsRemoved, this, &QgsStackedDiagramProperties::widgetChanged );
72
74}
75
76void QgsStackedDiagramProperties::addSubDiagram()
77{
78 // Create a single category renderer by default
79 std::unique_ptr< QgsDiagramRenderer > renderer;
80 std::unique_ptr< QgsSingleCategoryDiagramRenderer > dr = std::make_unique< QgsSingleCategoryDiagramRenderer >();
81 renderer = std::move( dr );
82
83 QItemSelectionModel *sel = mSubDiagramsView->selectionModel();
84 const QModelIndex index = sel->currentIndex();
85
86 if ( index.isValid() )
87 {
88 // add after this subDiagram
89 const QModelIndex currentIndex = mSubDiagramsView->selectionModel()->currentIndex();
90 mModel->insertSubDiagram( currentIndex.row() + 1, renderer.release() );
91 const QModelIndex newIndex = mModel->index( currentIndex.row() + 1, 0 );
92 mSubDiagramsView->selectionModel()->setCurrentIndex( newIndex, QItemSelectionModel::ClearAndSelect );
93 }
94 else
95 {
96 // append to root
97 appendSubDiagram( renderer.release() );
98 }
99 editSubDiagram();
100}
101
102void QgsStackedDiagramProperties::appendSubDiagram( QgsDiagramRenderer *dr )
103{
104 const int rows = mModel->rowCount();
105 mModel->insertSubDiagram( rows, dr );
106 const QModelIndex newIndex = mModel->index( rows, 0 );
107 mSubDiagramsView->selectionModel()->setCurrentIndex( newIndex, QItemSelectionModel::ClearAndSelect );
108}
109
110void QgsStackedDiagramProperties::editSubDiagram()
111{
112 editSubDiagram( mSubDiagramsView->selectionModel()->currentIndex() );
113}
114
115void QgsStackedDiagramProperties::editSubDiagram( const QModelIndex &index )
116{
117 if ( !index.isValid() )
118 return;
119
120 QgsDiagramRenderer *renderer = mModel->subDiagramForIndex( index );
123
124 if ( panel && panel->dockMode() )
125 {
126 QgsDiagramProperties *widget = new QgsDiagramProperties( mLayer, this, mMapCanvas );
127 widget->setPanelTitle( tr( "Edit Sub Diagram" ) );
128 widget->layout()->setContentsMargins( 0, 0, 0, 0 );
129 widget->syncToRenderer( renderer );
130 widget->syncToSettings( &dls );
131 if ( !couldBeFirstSubDiagram( index ) )
132 {
134 }
135
137 connect( widget, &QgsPanelWidget::panelAccepted, this, &QgsStackedDiagramProperties::subDiagramWidgetPanelAccepted );
138 connect( widget, &QgsDiagramProperties::widgetChanged, this, &QgsStackedDiagramProperties::liveUpdateSubDiagramFromPanel );
139 openPanel( widget );
140 return;
141 }
142
143 QgsStackedDiagramPropertiesDialog dlg( mLayer, this, mMapCanvas );
144 dlg.syncToRenderer( renderer );
145 dlg.syncToSettings( &dls );
146 if ( !couldBeFirstSubDiagram( index ) )
147 {
148 dlg.setAllowedToEditDiagramLayerSettings( false );
149 }
150
151 if ( dlg.exec() )
152 {
153 const QModelIndex index = mSubDiagramsView->selectionModel()->currentIndex();
154 if ( dlg.isAllowedToEditDiagramLayerSettings() )
155 mModel->updateDiagramLayerSettings( dlg.diagramLayerSettings() );
156
157 // This call will emit dataChanged, which in turns triggers widgetChanged()
158 mModel->updateSubDiagram( index, dlg.renderer() );
159 }
160}
161
162void QgsStackedDiagramProperties::removeSubDiagram()
163{
164 const QItemSelection sel = mSubDiagramsView->selectionModel()->selection();
165 const auto constSel = sel;
166 for ( const QItemSelectionRange &range : constSel )
167 {
168 if ( range.isValid() )
169 mModel->removeRows( range.top(), range.bottom() - range.top() + 1, range.parent() );
170 }
171 // make sure that the selection is gone
172 mSubDiagramsView->selectionModel()->clear();
173}
174
176{
177 const QgsDiagramRenderer *dr = mLayer->diagramRenderer();
178
179 if ( dr && dr->diagram() )
180 {
181 const QList<QgsDiagramSettings> settingList = dr->diagramSettings();
182 mStackedDiagramModeComboBox->setCurrentIndex( settingList.at( 0 ).stackedDiagramMode );
183 mStackedDiagramSpacingSpinBox->setValue( settingList.at( 0 ).stackedDiagramSpacing() );
184 mStackedDiagramSpacingUnitComboBox->setUnit( settingList.at( 0 ).stackedDiagramSpacingUnit() );
185
187 {
188 const QgsStackedDiagramRenderer *stackedDiagramRenderer = static_cast< const QgsStackedDiagramRenderer * >( dr );
189 const auto renderers = stackedDiagramRenderer->renderers();
190 for ( const auto &renderer : renderers )
191 {
192 appendSubDiagram( renderer );
193 }
194 }
195 else
196 {
197 // Take this single renderer as the first stacked renderer
198 appendSubDiagram( dr->clone() );
199 }
200
201 const QgsDiagramLayerSettings *dls = mLayer->diagramLayerSettings();
202 mModel->updateDiagramLayerSettings( *dls );
203 }
204}
205
207{
208 std::unique_ptr< QgsDiagramSettings> ds = std::make_unique< QgsDiagramSettings >();
209 ds->stackedDiagramMode = static_cast<QgsDiagramSettings::StackedDiagramMode>( mStackedDiagramModeComboBox->currentData().toInt() );
210 ds->setStackedDiagramSpacingUnit( mStackedDiagramSpacingUnitComboBox->unit() );
211 ds->setStackedDiagramSpacing( mStackedDiagramSpacingSpinBox->value() );
212
213 // Create diagram renderer for the StackedDiagram
215 dr->setDiagram( new QgsStackedDiagram() );
216
217 // Get DiagramSettings from each subdiagram
218 const QList< QgsDiagramRenderer *> renderers = mModel->subRenderers();
219 for ( const auto &renderer : renderers )
220 {
221 const QList< QgsDiagramSettings > ds1 = renderer->diagramSettings();
222 if ( !ds1.isEmpty() )
223 {
224 ds->categoryAttributes += ds1.at( 0 ).categoryAttributes;
225 ds->categoryLabels += ds1.at( 0 ).categoryLabels;
226 ds->categoryColors += ds1.at( 0 ).categoryColors;
227 }
228 dr->addRenderer( renderer );
229 }
230
231 dr->setDiagramSettings( *ds );
232 mLayer->setDiagramRenderer( dr );
233
234 // Get DiagramLayerSettings from the model
236 mLayer->setDiagramLayerSettings( dls );
237
238 // refresh
240 mLayer->triggerRepaint();
241}
242
243bool QgsStackedDiagramProperties::couldBeFirstSubDiagram( const QModelIndex &index ) const
244{
245 if ( !index.isValid() )
246 return false;
247
248 if ( mModel->rowCount() == 1 )
249 return true;
250
251 // Is there any enabled subdiagram before our index.row()?
252 // If so, ours cannot be the first diagram.
253 const QList< QgsDiagramRenderer * > renderers = mModel->subRenderers();
254
255 for ( int i = 0; i < index.row(); i++ )
256 {
257 const auto &renderer = renderers.at( i );
258 const QList< QgsDiagramSettings > ds = renderer->diagramSettings();
259 if ( !ds.isEmpty() && ds.at( 0 ).enabled )
260 {
261 // First enabled subdiagram found, and we know our row is after.
262 // Therefore, return false to disallow showing DLS settings for it.
263 return false;
264 }
265 }
266 // Either our row is the first subdiagram enabled or it's disabled,
267 // but there are no enabled ones before. So, ours could be the first
268 // enabled one after being edited.
269 // Therefore, we should allow DLS settings on its corresponding widget.
270 return true;
271}
272
273void QgsStackedDiagramProperties::subDiagramWidgetPanelAccepted( QgsPanelWidget *panel )
274{
275 QgsDiagramProperties *widget = qobject_cast<QgsDiagramProperties *>( panel );
276
277 std::unique_ptr< QgsDiagramRenderer > renderer = widget->createRenderer();
278
279 const QModelIndex index = mSubDiagramsView->selectionModel()->currentIndex();
281 mModel->updateDiagramLayerSettings( widget->createDiagramLayerSettings() );
282
283 mModel->updateSubDiagram( index, renderer.release() );
284}
285
286void QgsStackedDiagramProperties::liveUpdateSubDiagramFromPanel()
287{
288 subDiagramWidgetPanelAccepted( qobject_cast<QgsPanelWidget *>( sender() ) );
289}
290
292
293#include "qgsvscrollarea.h"
294
296 : QDialog( parent )
297{
298
299#ifdef Q_OS_MAC
300 setWindowModality( Qt::WindowModal );
301#endif
302
303 QVBoxLayout *layout = new QVBoxLayout( this );
304 QgsVScrollArea *scrollArea = new QgsVScrollArea( this );
305 scrollArea->setFrameShape( QFrame::NoFrame );
306 layout->addWidget( scrollArea );
307
308 buttonBox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok );
309 mPropsWidget = new QgsDiagramProperties( layer, this, mapCanvas );
310 mPropsWidget->setDockMode( false );
311
312 scrollArea->setWidget( mPropsWidget );
313 layout->addWidget( buttonBox );
314 this->setWindowTitle( "Edit Sub Diagram" );
316
317 connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsStackedDiagramPropertiesDialog::accept );
318 connect( buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject );
319 connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsStackedDiagramPropertiesDialog::showHelp );
320}
321
323{
324 mPropsWidget->syncToRenderer( dr );
325}
326
328{
329 mPropsWidget->syncToSettings( dls );
330}
331
333{
334 // Get renderer and diagram layer settings from widget
335 mRenderer = mPropsWidget->createRenderer();
336 mDiagramLayerSettings = mPropsWidget->createDiagramLayerSettings();
337 QDialog::accept();
338}
339
341{
342 return mRenderer.release();
343}
344
349
354
359
360void QgsStackedDiagramPropertiesDialog::showHelp()
361{
362 QgsHelp::openHelp( QStringLiteral( "working_with_vector/vector_properties.html#diagrams-properties" ) );
363}
364
366
368 : QAbstractTableModel( parent )
369{
370}
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 return ( !dr || !dr->diagram() ) ? tr( "(no diagram)" ) : dr->diagram()->diagramName();
392 case 2:
393 if ( !dr )
394 {
395 return tr( "(no renderer)" );
396 }
397 else
398 {
400 return tr( "Fixed" );
402 return tr( "Scaled" );
403 else
404 return tr( "Unknown" );
405 }
406 case 3:
407 if ( dr && dr->diagram() && !dr->diagramSettings().isEmpty() )
408 {
410 {
411 switch ( dr->diagramSettings().at( 0 ).diagramOrientation )
412 {
414 return tr( "Left" );
416 return tr( "Right" );
418 return tr( "Up" );
420 return tr( "Down" );
421 }
422 }
423 }
424 return QVariant();
425 case 0:
426 default:
427 return QVariant();
428 }
429 }
430 else if ( role == Qt::TextAlignmentRole )
431 {
432 return index.column() == 0 ? static_cast<Qt::Alignment::Int>( Qt::AlignCenter ) : static_cast<Qt::Alignment::Int>( Qt::AlignLeft );
433 }
434 else if ( role == Qt::CheckStateRole )
435 {
436 if ( index.column() != 0 )
437 return QVariant();
438
439 return ( dr && !dr->diagramSettings().isEmpty() && dr->diagramSettings().at( 0 ).enabled ) ? Qt::Checked : Qt::Unchecked;
440 }
441 else
442 {
443 return QVariant();
444 }
445}
446
447QVariant QgsStackedDiagramPropertiesModel::headerData( int section, Qt::Orientation orientation, int role ) const
448{
449 if ( orientation == Qt::Horizontal && role == Qt::DisplayRole && section >= 0 && section < 4 )
450 {
451 QStringList lst;
452 lst << tr( "Enabled" ) << tr( "Diagram type" ) << tr( "Size" ) << tr( "Orientation" );
453 return lst[section];
454 }
455
456 return QVariant();
457}
458
459int QgsStackedDiagramPropertiesModel::rowCount( const QModelIndex & ) const
460{
461 return mRenderers.size();
462}
463
464int QgsStackedDiagramPropertiesModel::columnCount( const QModelIndex & ) const
465{
466 return 4;
467}
468
469bool QgsStackedDiagramPropertiesModel::setData( const QModelIndex &index, const QVariant &value, int role )
470{
471 if ( !index.isValid() )
472 return false;
473
475
476 if ( role == Qt::CheckStateRole )
477 {
478 if ( dr && !dr->diagramSettings().isEmpty() )
479 {
480 QgsDiagramSettings ds = dr->diagramSettings().at( 0 );
481 ds.enabled = ( value.toInt() == Qt::Checked );
482
484 {
486 dsr->setDiagramSettings( ds );
487 }
488 else
489 {
491 dlir->setDiagramSettings( ds );
492 }
493
494 emit dataChanged( index, index );
495 return true;
496 }
497 }
498 return false;
499}
500
501bool QgsStackedDiagramPropertiesModel::removeRows( int row, int count, const QModelIndex &parent )
502{
503 if ( row < 0 || row >= mRenderers.size() )
504 return false;
505
506 beginRemoveRows( parent, row, row + count - 1 );
507 while ( count-- )
508 mRenderers.removeAt( row );
509 endRemoveRows();
510
511 return true;
512}
513
515{
516 if ( index.isValid() )
517 return mRenderers.at( index.row() );
518 return nullptr;
519}
520
522{
523 beginInsertRows( QModelIndex(), index, index );
524 mRenderers.insert( index, newSubDiagram );
525 endInsertRows();
526}
527
529{
530 mRenderers.replace( index.row(), dr );
531 emit dataChanged( index, index );
532}
533
534QList< QgsDiagramRenderer *> QgsStackedDiagramPropertiesModel::subRenderers() const
535{
536 QList<QgsDiagramRenderer *> subRenderers;
538 return subRenderers;
539}
540
545
@ 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:208
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 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.
QList< QgsDiagramRenderer * > mRenderers
void updateSubDiagram(const QModelIndex &index, QgsDiagramRenderer *dr)
Replaces the diagram located at index by dr.
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.
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.
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.
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.
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