50 mDiagramTypeComboBox->addItem(
QgsApplication::getThemeIcon( QStringLiteral(
"stacked-bar.svg" ) ), tr(
"Stacked Bars" ), ModeStackedBar );
51 mDiagramTypeComboBox->addItem(
QgsApplication::getThemeIcon( QStringLiteral(
"stacked-diagram.svg" ) ), tr(
"Stacked Diagram" ), ModeStacked );
53 connect( mEngineSettingsButton, &QAbstractButton::clicked,
this, &QgsDiagramWidget::showEngineConfigDialog );
55 connect( mDiagramTypeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsDiagramWidget::mDiagramTypeComboBox_currentIndexChanged );
58 mEngineSettingsButton->setIconSize( QSize( iconSize16, iconSize16 ) );
63 const Mode mode =
static_cast< Mode
>( mDiagramTypeComboBox->currentData().toInt() );
103 whileBlocking( mDiagramTypeComboBox )->setCurrentIndex( -1 );
112 mDiagramTypeComboBox->setCurrentIndex( ModeStacked );
119 mDiagramTypeComboBox->setCurrentIndex( ModePie ) ;
123 mDiagramTypeComboBox->setCurrentIndex( ModeText ) ;
127 mDiagramTypeComboBox->setCurrentIndex( ModeStackedBar ) ;
132 mDiagramTypeComboBox->setCurrentIndex( ModeHistogram );
141 mDiagramTypeComboBox->setCurrentIndex( ModeNone );
145void QgsDiagramWidget::mDiagramTypeComboBox_currentIndexChanged(
int index )
148 mStackedWidget->removeWidget( mWidget );
156 const Mode mode =
static_cast< Mode
>( mDiagramTypeComboBox->currentData().toInt() );
166 singleWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
170 if ( mode == ModePie )
172 else if ( mode == ModeText )
174 else if ( mode == ModeHistogram )
176 else if ( mode == ModeStackedBar )
183 mWidget = singleWidget;
184 mStackedWidget->addWidget( mWidget );
185 mStackedWidget->setCurrentWidget( mWidget );
195 mWidget = stackedWidget;
196 mStackedWidget->addWidget( mWidget );
197 mStackedWidget->setCurrentWidget( mWidget );
206void 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.