25#include "moc_qgsdiagramwidget.cpp"
51 mDiagramTypeComboBox->addItem(
QgsApplication::getThemeIcon( QStringLiteral(
"stacked-bar.svg" ) ), tr(
"Stacked Bars" ), ModeStackedBar );
52 mDiagramTypeComboBox->addItem(
QgsApplication::getThemeIcon( QStringLiteral(
"stacked-diagram.svg" ) ), tr(
"Stacked Diagram" ), ModeStacked );
54 connect( mEngineSettingsButton, &QAbstractButton::clicked,
this, &QgsDiagramWidget::showEngineConfigDialog );
56 connect( mDiagramTypeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsDiagramWidget::mDiagramTypeComboBox_currentIndexChanged );
59 mEngineSettingsButton->setIconSize( QSize( iconSize16, iconSize16 ) );
64 const Mode mode =
static_cast<Mode
>( mDiagramTypeComboBox->currentData().toInt() );
104 whileBlocking( mDiagramTypeComboBox )->setCurrentIndex( -1 );
113 mDiagramTypeComboBox->setCurrentIndex( ModeStacked );
120 mDiagramTypeComboBox->setCurrentIndex( ModePie );
124 mDiagramTypeComboBox->setCurrentIndex( ModeText );
128 mDiagramTypeComboBox->setCurrentIndex( ModeStackedBar );
133 mDiagramTypeComboBox->setCurrentIndex( ModeHistogram );
142 mDiagramTypeComboBox->setCurrentIndex( ModeNone );
146void QgsDiagramWidget::mDiagramTypeComboBox_currentIndexChanged(
int index )
149 mStackedWidget->removeWidget( mWidget );
157 const Mode mode =
static_cast<Mode
>( mDiagramTypeComboBox->currentData().toInt() );
167 singleWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
171 if ( mode == ModePie )
173 else if ( mode == ModeText )
175 else if ( mode == ModeHistogram )
177 else if ( mode == ModeStackedBar )
184 mWidget = singleWidget;
185 mStackedWidget->addWidget( mWidget );
186 mStackedWidget->setCurrentWidget( mWidget );
196 mWidget = stackedWidget;
197 mStackedWidget->addWidget( mWidget );
198 mStackedWidget->setCurrentWidget( mWidget );
207void QgsDiagramWidget::showEngineConfigDialog()
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
Stores the settings for rendering of all diagrams for a layer.
void setDockMode(bool dockMode) override
Sets the widget in dock mode.
void syncToLayer()
Updates the widget to reflect the layer's current diagram settings.
void setDiagramType(const QString diagramType)
Defines the widget's diagram type and lets it know it should hide the type comboBox.
void auxiliaryFieldCreated()
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
virtual QString rendererName() const =0
QgsDiagram * diagram() const
virtual QString diagramName() const =0
Gets a descriptive name for this diagram type.
static const QString DIAGRAM_NAME_HISTOGRAM
Dialog for configuring the labeling engine.
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.
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).
static const QString DIAGRAM_NAME_STACKED_BAR
static const QString DIAGRAM_RENDERER_NAME_STACKED
static const QString DIAGRAM_NAME_TEXT
Represents a vector layer which manages a vector based data sets.
void setDiagramLayerSettings(const QgsDiagramLayerSettings &s)
void setDiagramRenderer(QgsDiagramRenderer *r)
Sets diagram rendering object (takes ownership)
const QgsDiagramRenderer * diagramRenderer() const
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly,...
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.