QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
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::editSubDiagramRenderer ) );
44
45 connect( mAddSubDiagramButton, &QPushButton::clicked, this, &QgsStackedDiagramProperties::addSubDiagramRenderer );
46 connect( mEditSubDiagramButton, &QAbstractButton::clicked, this, static_cast<void ( QgsStackedDiagramProperties::* )()>( &QgsStackedDiagramProperties::editSubDiagramRenderer ) );
47 connect( mRemoveSubDiagramButton, &QPushButton::clicked, this, &QgsStackedDiagramProperties::removeSubDiagramRenderer );
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::addSubDiagramRenderer()
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 appendSubDiagramRenderer( renderer.release() );
98 }
99 editSubDiagramRenderer();
100}
101
102void QgsStackedDiagramProperties::appendSubDiagramRenderer( QgsDiagramRenderer *dr )
103{
104 const int rows = mModel->rowCount();
105 mModel->insertSubDiagram( rows, dr ); // Transfers ownership
106 const QModelIndex newIndex = mModel->index( rows, 0 );
107 mSubDiagramsView->selectionModel()->setCurrentIndex( newIndex, QItemSelectionModel::ClearAndSelect );
108}
109
110void QgsStackedDiagramProperties::editSubDiagramRenderer()
111{
112 editSubDiagramRenderer( mSubDiagramsView->selectionModel()->currentIndex() );
113}
114
115void QgsStackedDiagramProperties::editSubDiagramRenderer( 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::removeSubDiagramRenderer()
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 QList< QgsDiagramRenderer * > renderers = stackedDiagramRenderer->renderers();
190 for ( const QgsDiagramRenderer *renderer : renderers )
191 {
192 appendSubDiagramRenderer( renderer->clone() );
193 }
194 }
195 else
196 {
197 // Take this single renderer as the first stacked renderer
198 appendSubDiagramRenderer( 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 QgsDiagramRenderer *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->clone() );
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 QgsDiagramRenderer *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
376
377Qt::ItemFlags QgsStackedDiagramPropertiesModel::flags( const QModelIndex &index ) const
378{
379 const Qt::ItemFlag checkable = ( index.column() == 0 ? Qt::ItemIsUserCheckable : Qt::NoItemFlags );
380
381 return Qt::ItemIsEnabled | Qt::ItemIsSelectable | checkable;
382}
383
384QVariant QgsStackedDiagramPropertiesModel::data( const QModelIndex &index, int role ) const
385{
386 if ( !index.isValid() )
387 return QVariant();
388
390
391 if ( role == Qt::DisplayRole || role == Qt::ToolTipRole )
392 {
393 switch ( index.column() )
394 {
395 case 1:
396 if ( dr && dr->diagram() )
397 {
399 {
400 return tr( "Pie Chart" );
401 }
403 {
404 return tr( "Text Diagram" );
405 }
407 {
408 return tr( "Histogram" );
409 }
411 {
412 return tr( "Stacked Bars" );
413 }
415 {
416 return tr( "Stacked Diagram" );
417 }
418 else
419 {
420 return dr->diagram()->diagramName();
421 }
422 }
423 else
424 {
425 return tr( "(no diagram)" );
426 }
427 case 2:
428 if ( !dr )
429 {
430 return tr( "(no renderer)" );
431 }
432 else
433 {
435 return tr( "Fixed" );
437 return tr( "Scaled" );
438 else
439 return tr( "Unknown" );
440 }
441 case 3:
442 if ( dr && dr->diagram() && !dr->diagramSettings().isEmpty() )
443 {
445 {
446 switch ( dr->diagramSettings().at( 0 ).diagramOrientation )
447 {
449 return tr( "Left" );
451 return tr( "Right" );
453 return tr( "Up" );
455 return tr( "Down" );
456 }
457 }
458 }
459 return QVariant();
460 case 0:
461 default:
462 return QVariant();
463 }
464 }
465 else if ( role == Qt::TextAlignmentRole )
466 {
467 return index.column() == 0 ? static_cast<Qt::Alignment::Int>( Qt::AlignCenter ) : static_cast<Qt::Alignment::Int>( Qt::AlignLeft );
468 }
469 else if ( role == Qt::CheckStateRole )
470 {
471 if ( index.column() != 0 )
472 return QVariant();
473
474 return ( dr && !dr->diagramSettings().isEmpty() && dr->diagramSettings().at( 0 ).enabled ) ? Qt::Checked : Qt::Unchecked;
475 }
476 else
477 {
478 return QVariant();
479 }
480}
481
482QVariant QgsStackedDiagramPropertiesModel::headerData( int section, Qt::Orientation orientation, int role ) const
483{
484 if ( orientation == Qt::Horizontal && role == Qt::DisplayRole && section >= 0 && section < 4 )
485 {
486 QStringList lst;
487 lst << tr( "Enabled" ) << tr( "Diagram type" ) << tr( "Size" ) << tr( "Orientation" );
488 return lst[section];
489 }
490
491 return QVariant();
492}
493
494int QgsStackedDiagramPropertiesModel::rowCount( const QModelIndex & ) const
495{
496 return mRenderers.size();
497}
498
499int QgsStackedDiagramPropertiesModel::columnCount( const QModelIndex & ) const
500{
501 return 4;
502}
503
504bool QgsStackedDiagramPropertiesModel::setData( const QModelIndex &index, const QVariant &value, int role )
505{
506 if ( !index.isValid() )
507 return false;
508
510
511 if ( role == Qt::CheckStateRole )
512 {
513 if ( dr && !dr->diagramSettings().isEmpty() )
514 {
515 QgsDiagramSettings ds = dr->diagramSettings().at( 0 );
516 ds.enabled = ( value.toInt() == Qt::Checked );
517
519 {
521 dsr->setDiagramSettings( ds );
522 }
523 else
524 {
526 dlir->setDiagramSettings( ds );
527 }
528
529 emit dataChanged( index, index );
530 return true;
531 }
532 }
533 return false;
534}
535
536bool QgsStackedDiagramPropertiesModel::removeRows( int row, int count, const QModelIndex &parent )
537{
538 if ( row < 0 || row >= mRenderers.size() )
539 return false;
540
541 beginRemoveRows( parent, row, row + count - 1 );
542 while ( count-- )
543 mRenderers.removeAt( row );
544 endRemoveRows();
545
546 return true;
547}
548
550{
551 if ( index.isValid() )
552 return mRenderers.at( index.row() );
553 return nullptr;
554}
555
557{
558 beginInsertRows( QModelIndex(), index, index );
559 mRenderers.insert( index, newSubDiagram );
560 endInsertRows();
561}
562
564{
565 if ( !index.isValid() )
566 return;
567
568 delete mRenderers.at( index.row() );
569 mRenderers.replace( index.row(), dr );
570 emit dataChanged( index, index );
571}
572
573QList< QgsDiagramRenderer *> QgsStackedDiagramPropertiesModel::subRenderers() const
574{
575 return mRenderers;
576}
577
582
@ 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 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