QGIS API Documentation 3.41.0-Master (3440c17df1d)
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 );
55 mStackedDiagramSpacingUnitComboBox->setUnits( { Qgis::RenderUnit::Millimeters,
61
62 connect( mStackedDiagramModeComboBox, qOverload< int >( &QComboBox::currentIndexChanged ), this, &QgsStackedDiagramProperties::widgetChanged );
63 connect( mStackedDiagramSpacingSpinBox, qOverload< double >( &QgsDoubleSpinBox::valueChanged ), this, &QgsStackedDiagramProperties::widgetChanged );
64 connect( mStackedDiagramSpacingUnitComboBox, &QgsUnitSelectionWidget::changed, this, &QgsStackedDiagramProperties::widgetChanged );
65
67 mSubDiagramsView->setModel( mModel );
68 mSubDiagramsView->resizeColumnToContents( 0 );
69
70 connect( mModel, &QAbstractItemModel::dataChanged, this, &QgsStackedDiagramProperties::widgetChanged );
71 connect( mModel, &QAbstractItemModel::rowsInserted, this, &QgsStackedDiagramProperties::widgetChanged );
72 connect( mModel, &QAbstractItemModel::rowsRemoved, this, &QgsStackedDiagramProperties::widgetChanged );
73
75}
76
77void QgsStackedDiagramProperties::addSubDiagramRenderer()
78{
79 // Create a single category renderer by default
80 std::unique_ptr< QgsDiagramRenderer > renderer;
81 std::unique_ptr< QgsSingleCategoryDiagramRenderer > dr = std::make_unique< QgsSingleCategoryDiagramRenderer >();
82 renderer = std::move( dr );
83
84 QItemSelectionModel *sel = mSubDiagramsView->selectionModel();
85 const QModelIndex index = sel->currentIndex();
86
87 if ( index.isValid() )
88 {
89 // add after this subDiagram
90 const QModelIndex currentIndex = mSubDiagramsView->selectionModel()->currentIndex();
91 mModel->insertSubDiagram( currentIndex.row() + 1, renderer.release() );
92 const QModelIndex newIndex = mModel->index( currentIndex.row() + 1, 0 );
93 mSubDiagramsView->selectionModel()->setCurrentIndex( newIndex, QItemSelectionModel::ClearAndSelect );
94 }
95 else
96 {
97 // append to root
98 appendSubDiagramRenderer( renderer.release() );
99 }
100 editSubDiagramRenderer();
101}
102
103void QgsStackedDiagramProperties::appendSubDiagramRenderer( QgsDiagramRenderer *dr )
104{
105 const int rows = mModel->rowCount();
106 mModel->insertSubDiagram( rows, dr ); // Transfers ownership
107 const QModelIndex newIndex = mModel->index( rows, 0 );
108 mSubDiagramsView->selectionModel()->setCurrentIndex( newIndex, QItemSelectionModel::ClearAndSelect );
109}
110
111void QgsStackedDiagramProperties::editSubDiagramRenderer()
112{
113 editSubDiagramRenderer( mSubDiagramsView->selectionModel()->currentIndex() );
114}
115
116void QgsStackedDiagramProperties::editSubDiagramRenderer( const QModelIndex &index )
117{
118 if ( !index.isValid() )
119 return;
120
121 QgsDiagramRenderer *renderer = mModel->subDiagramForIndex( index );
124
125 if ( panel && panel->dockMode() )
126 {
127 QgsDiagramProperties *widget = new QgsDiagramProperties( mLayer, this, mMapCanvas );
128 widget->setPanelTitle( tr( "Edit Sub Diagram" ) );
129 widget->layout()->setContentsMargins( 0, 0, 0, 0 );
130 widget->syncToRenderer( renderer );
131 widget->syncToSettings( &dls );
132 if ( !couldBeFirstSubDiagram( index ) )
133 {
135 }
136
138 connect( widget, &QgsPanelWidget::panelAccepted, this, &QgsStackedDiagramProperties::subDiagramWidgetPanelAccepted );
139 connect( widget, &QgsDiagramProperties::widgetChanged, this, &QgsStackedDiagramProperties::liveUpdateSubDiagramFromPanel );
140 openPanel( widget );
141 return;
142 }
143
144 QgsStackedDiagramPropertiesDialog dlg( mLayer, this, mMapCanvas );
145 dlg.syncToRenderer( renderer );
146 dlg.syncToSettings( &dls );
147 if ( !couldBeFirstSubDiagram( index ) )
148 {
149 dlg.setAllowedToEditDiagramLayerSettings( false );
150 }
151
152 if ( dlg.exec() )
153 {
154 const QModelIndex index = mSubDiagramsView->selectionModel()->currentIndex();
155 if ( dlg.isAllowedToEditDiagramLayerSettings() )
156 mModel->updateDiagramLayerSettings( dlg.diagramLayerSettings() );
157
158 // This call will emit dataChanged, which in turns triggers widgetChanged()
159 mModel->updateSubDiagram( index, dlg.renderer() );
160 }
161}
162
163void QgsStackedDiagramProperties::removeSubDiagramRenderer()
164{
165 const QItemSelection sel = mSubDiagramsView->selectionModel()->selection();
166 const auto constSel = sel;
167 for ( const QItemSelectionRange &range : constSel )
168 {
169 if ( range.isValid() )
170 mModel->removeRows( range.top(), range.bottom() - range.top() + 1, range.parent() );
171 }
172 // make sure that the selection is gone
173 mSubDiagramsView->selectionModel()->clear();
174}
175
177{
178 const QgsDiagramRenderer *dr = mLayer->diagramRenderer();
179
180 if ( dr && dr->diagram() )
181 {
182 const QList<QgsDiagramSettings> settingList = dr->diagramSettings();
183 mStackedDiagramModeComboBox->setCurrentIndex( settingList.at( 0 ).stackedDiagramMode );
184 mStackedDiagramSpacingSpinBox->setValue( settingList.at( 0 ).stackedDiagramSpacing() );
185 mStackedDiagramSpacingUnitComboBox->setUnit( settingList.at( 0 ).stackedDiagramSpacingUnit() );
186
188 {
189 const QgsStackedDiagramRenderer *stackedDiagramRenderer = static_cast< const QgsStackedDiagramRenderer * >( dr );
190 const QList< QgsDiagramRenderer * > renderers = stackedDiagramRenderer->renderers();
191 for ( const QgsDiagramRenderer *renderer : renderers )
192 {
193 appendSubDiagramRenderer( renderer->clone() );
194 }
195 }
196 else
197 {
198 // Take this single renderer as the first stacked renderer
199 appendSubDiagramRenderer( dr->clone() );
200 }
201
202 const QgsDiagramLayerSettings *dls = mLayer->diagramLayerSettings();
203 mModel->updateDiagramLayerSettings( *dls );
204 }
205}
206
208{
209 std::unique_ptr< QgsDiagramSettings> ds = std::make_unique< QgsDiagramSettings >();
210 ds->stackedDiagramMode = static_cast<QgsDiagramSettings::StackedDiagramMode>( mStackedDiagramModeComboBox->currentData().toInt() );
211 ds->setStackedDiagramSpacingUnit( mStackedDiagramSpacingUnitComboBox->unit() );
212 ds->setStackedDiagramSpacing( mStackedDiagramSpacingSpinBox->value() );
213
214 // Create diagram renderer for the StackedDiagram
216 dr->setDiagram( new QgsStackedDiagram() );
217
218 // Get DiagramSettings from each subdiagram
219 const QList< QgsDiagramRenderer *> renderers = mModel->subRenderers();
220 for ( const QgsDiagramRenderer *renderer : renderers )
221 {
222 const QList< QgsDiagramSettings > ds1 = renderer->diagramSettings();
223 if ( !ds1.isEmpty() )
224 {
225 ds->categoryAttributes += ds1.at( 0 ).categoryAttributes;
226 ds->categoryLabels += ds1.at( 0 ).categoryLabels;
227 ds->categoryColors += ds1.at( 0 ).categoryColors;
228 }
229 dr->addRenderer( renderer->clone() );
230 }
231
232 dr->setDiagramSettings( *ds );
233 mLayer->setDiagramRenderer( dr );
234
235 // Get DiagramLayerSettings from the model
237 mLayer->setDiagramLayerSettings( dls );
238
239 // refresh
241 mLayer->triggerRepaint();
242}
243
244bool QgsStackedDiagramProperties::couldBeFirstSubDiagram( const QModelIndex &index ) const
245{
246 if ( !index.isValid() )
247 return false;
248
249 if ( mModel->rowCount() == 1 )
250 return true;
251
252 // Is there any enabled subdiagram before our index.row()?
253 // If so, ours cannot be the first diagram.
254 const QList< QgsDiagramRenderer * > renderers = mModel->subRenderers();
255
256 for ( int i = 0; i < index.row(); i++ )
257 {
258 const QgsDiagramRenderer *renderer = renderers.at( i );
259 const QList< QgsDiagramSettings > ds = renderer->diagramSettings();
260 if ( !ds.isEmpty() && ds.at( 0 ).enabled )
261 {
262 // First enabled subdiagram found, and we know our row is after.
263 // Therefore, return false to disallow showing DLS settings for it.
264 return false;
265 }
266 }
267 // Either our row is the first subdiagram enabled or it's disabled,
268 // but there are no enabled ones before. So, ours could be the first
269 // enabled one after being edited.
270 // Therefore, we should allow DLS settings on its corresponding widget.
271 return true;
272}
273
274void QgsStackedDiagramProperties::subDiagramWidgetPanelAccepted( QgsPanelWidget *panel )
275{
276 QgsDiagramProperties *widget = qobject_cast<QgsDiagramProperties *>( panel );
277
278 std::unique_ptr< QgsDiagramRenderer > renderer = widget->createRenderer();
279
280 const QModelIndex index = mSubDiagramsView->selectionModel()->currentIndex();
282 mModel->updateDiagramLayerSettings( widget->createDiagramLayerSettings() );
283
284 mModel->updateSubDiagram( index, renderer.release() );
285}
286
287void QgsStackedDiagramProperties::liveUpdateSubDiagramFromPanel()
288{
289 subDiagramWidgetPanelAccepted( qobject_cast<QgsPanelWidget *>( sender() ) );
290}
291
293
294#include "qgsvscrollarea.h"
295
297 : QDialog( parent )
298{
299
300#ifdef Q_OS_MAC
301 setWindowModality( Qt::WindowModal );
302#endif
303
304 QVBoxLayout *layout = new QVBoxLayout( this );
305 QgsVScrollArea *scrollArea = new QgsVScrollArea( this );
306 scrollArea->setFrameShape( QFrame::NoFrame );
307 layout->addWidget( scrollArea );
308
309 buttonBox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok );
310 mPropsWidget = new QgsDiagramProperties( layer, this, mapCanvas );
311 mPropsWidget->setDockMode( false );
312
313 scrollArea->setWidget( mPropsWidget );
314 layout->addWidget( buttonBox );
315 this->setWindowTitle( "Edit Sub Diagram" );
317
318 connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsStackedDiagramPropertiesDialog::accept );
319 connect( buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject );
320 connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsStackedDiagramPropertiesDialog::showHelp );
321}
322
324{
325 mPropsWidget->syncToRenderer( dr );
326}
327
329{
330 mPropsWidget->syncToSettings( dls );
331}
332
334{
335 // Get renderer and diagram layer settings from widget
336 mRenderer = mPropsWidget->createRenderer();
337 mDiagramLayerSettings = mPropsWidget->createDiagramLayerSettings();
338 QDialog::accept();
339}
340
342{
343 return mRenderer.release();
344}
345
350
355
360
361void QgsStackedDiagramPropertiesDialog::showHelp()
362{
363 QgsHelp::openHelp( QStringLiteral( "working_with_vector/vector_properties.html#diagrams-properties" ) );
364}
365
367
369 : QAbstractTableModel( parent )
370{
371}
372
377
378Qt::ItemFlags QgsStackedDiagramPropertiesModel::flags( const QModelIndex &index ) const
379{
380 const Qt::ItemFlag checkable = ( index.column() == 0 ? Qt::ItemIsUserCheckable : Qt::NoItemFlags );
381
382 return Qt::ItemIsEnabled | Qt::ItemIsSelectable | checkable;
383}
384
385QVariant QgsStackedDiagramPropertiesModel::data( const QModelIndex &index, int role ) const
386{
387 if ( !index.isValid() )
388 return QVariant();
389
391
392 if ( role == Qt::DisplayRole || role == Qt::ToolTipRole )
393 {
394 switch ( index.column() )
395 {
396 case 1:
397 if ( dr && dr->diagram() )
398 {
400 {
401 return tr( "Pie Chart" );
402 }
404 {
405 return tr( "Text Diagram" );
406 }
408 {
409 return tr( "Histogram" );
410 }
412 {
413 return tr( "Stacked Bars" );
414 }
416 {
417 return tr( "Stacked Diagram" );
418 }
419 else
420 {
421 return dr->diagram()->diagramName();
422 }
423 }
424 else
425 {
426 return tr( "(no diagram)" );
427 }
428 case 2:
429 if ( !dr )
430 {
431 return tr( "(no renderer)" );
432 }
433 else
434 {
436 return tr( "Fixed" );
438 return tr( "Scaled" );
439 else
440 return tr( "Unknown" );
441 }
442 case 3:
443 if ( dr && dr->diagram() && !dr->diagramSettings().isEmpty() )
444 {
446 {
447 switch ( dr->diagramSettings().at( 0 ).diagramOrientation )
448 {
450 return tr( "Left" );
452 return tr( "Right" );
454 return tr( "Up" );
456 return tr( "Down" );
457 }
458 }
459 }
460 return QVariant();
461 case 0:
462 default:
463 return QVariant();
464 }
465 }
466 else if ( role == Qt::TextAlignmentRole )
467 {
468 return index.column() == 0 ? static_cast<Qt::Alignment::Int>( Qt::AlignCenter ) : static_cast<Qt::Alignment::Int>( Qt::AlignLeft );
469 }
470 else if ( role == Qt::CheckStateRole )
471 {
472 if ( index.column() != 0 )
473 return QVariant();
474
475 return ( dr && !dr->diagramSettings().isEmpty() && dr->diagramSettings().at( 0 ).enabled ) ? Qt::Checked : Qt::Unchecked;
476 }
477 else
478 {
479 return QVariant();
480 }
481}
482
483QVariant QgsStackedDiagramPropertiesModel::headerData( int section, Qt::Orientation orientation, int role ) const
484{
485 if ( orientation == Qt::Horizontal && role == Qt::DisplayRole && section >= 0 && section < 4 )
486 {
487 QStringList lst;
488 lst << tr( "Enabled" ) << tr( "Diagram type" ) << tr( "Size" ) << tr( "Orientation" );
489 return lst[section];
490 }
491
492 return QVariant();
493}
494
495int QgsStackedDiagramPropertiesModel::rowCount( const QModelIndex & ) const
496{
497 return mRenderers.size();
498}
499
500int QgsStackedDiagramPropertiesModel::columnCount( const QModelIndex & ) const
501{
502 return 4;
503}
504
505bool QgsStackedDiagramPropertiesModel::setData( const QModelIndex &index, const QVariant &value, int role )
506{
507 if ( !index.isValid() )
508 return false;
509
511
512 if ( role == Qt::CheckStateRole )
513 {
514 if ( dr && !dr->diagramSettings().isEmpty() )
515 {
516 QgsDiagramSettings ds = dr->diagramSettings().at( 0 );
517 ds.enabled = ( value.toInt() == Qt::Checked );
518
520 {
522 dsr->setDiagramSettings( ds );
523 }
524 else
525 {
527 dlir->setDiagramSettings( ds );
528 }
529
530 emit dataChanged( index, index );
531 return true;
532 }
533 }
534 return false;
535}
536
537bool QgsStackedDiagramPropertiesModel::removeRows( int row, int count, const QModelIndex &parent )
538{
539 if ( row < 0 || row >= mRenderers.size() )
540 return false;
541
542 beginRemoveRows( parent, row, row + count - 1 );
543 while ( count-- )
544 mRenderers.removeAt( row );
545 endRemoveRows();
546
547 return true;
548}
549
551{
552 if ( index.isValid() )
553 return mRenderers.at( index.row() );
554 return nullptr;
555}
556
558{
559 beginInsertRows( QModelIndex(), index, index );
560 mRenderers.insert( index, newSubDiagram );
561 endInsertRows();
562}
563
565{
566 if ( !index.isValid() )
567 return;
568
569 delete mRenderers.at( index.row() );
570 mRenderers.replace( index.row(), dr );
571 emit dataChanged( index, index );
572}
573
574QList< QgsDiagramRenderer *> QgsStackedDiagramPropertiesModel::subRenderers() const
575{
576 return mRenderers;
577}
578
583
@ 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:209
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.
QList< QgsDiagramRenderer * > mRenderers
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.
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