[gui] In QgsStackedDiagramProperties, make tabs movable to redefine subdiagrams order

This commit is contained in:
Germán Carrillo 2024-08-27 11:24:25 -05:00
parent fd7d8ed6da
commit 4a3dfd79ec
4 changed files with 16 additions and 1 deletions

View File

@ -40,6 +40,7 @@ QgsStackedDiagramProperties::QgsStackedDiagramProperties( QgsVectorLayer *layer,
connect( mDiagramTypeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsStackedDiagramProperties::mDiagramTypeComboBox_currentIndexChanged );
connect( mAddSubDiagramButton, &QPushButton::clicked, this, &QgsStackedDiagramProperties::addSubDiagram );
connect( mRemoveSubDiagramButton, &QPushButton::clicked, this, &QgsStackedDiagramProperties::removeSubDiagram );
connect( mSubDiagramsTabWidget->tabBar(), &QTabBar::tabMoved, this, &QgsStackedDiagramProperties::mSubDiagramsTabWidget_tabMoved );
// Initialize stacked diagram controls
mDiagramTypeComboBox->addItem( tr( "Single diagram" ), QgsDiagramLayerSettings::Single );
@ -87,6 +88,16 @@ void QgsStackedDiagramProperties::removeSubDiagram()
}
}
void QgsStackedDiagramProperties::mSubDiagramsTabWidget_tabMoved( int from, int to )
{
Q_UNUSED( from )
Q_UNUSED( to )
for ( int i = 0; i < mSubDiagramsTabWidget->count(); i++ )
{
mSubDiagramsTabWidget->setTabText( i, tr( "Diagram %1" ).arg( i + 1 ) );
}
}
void QgsStackedDiagramProperties::apply()
{
if ( mDiagramTypeComboBox->currentData( Qt::UserRole ) == QgsDiagramLayerSettings::Single )

View File

@ -56,6 +56,7 @@ class GUI_EXPORT QgsStackedDiagramProperties : public QWidget, private Ui::QgsSt
public slots:
void apply();
void mDiagramTypeComboBox_currentIndexChanged( int index );
void mSubDiagramsTabWidget_tabMoved( int from, int to );
private slots:

View File

@ -201,6 +201,9 @@
<property name="currentIndex">
<number>-1</number>
</property>
<property name="movable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>

View File

@ -285,7 +285,7 @@ ACCEPTABLE_MISSING_DOCS = {
"QgsEffectStack": ["QgsEffectStack(const QgsEffectStack &other)"],
"QgsRelationReferenceWidget": ["setRelation(const QgsRelation &relation, bool allowNullValue)", "CanvasExtent", "setOpenFormButtonVisible(bool openFormButtonVisible)", "QgsRelationReferenceWidget(QWidget *parent)", "setReadOnlySelector(bool readOnly)", "setRelationEditable(bool editable)", "init()", "setAllowMapIdentification(bool allowMapIdentification)", "setEmbedForm(bool display)"],
"QgsDiagramProperties": ["mAttributesTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)", "scalingTypeChanged()", "mAddCategoryPushButton_clicked()", "mEngineSettingsButton_clicked()", "apply()", "mRemoveCategoryPushButton_clicked()", "showSizeLegendDialog()", "QgsDiagramProperties(QgsVectorLayer *layer, QWidget *parent, QgsMapCanvas *canvas)", "mDiagramAttributesTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)", "mDiagramStackedWidget_currentChanged(int index)", "mDiagramTypeComboBox_currentIndexChanged(int index)", "mFindMaximumValueButton_clicked()", "showAddAttributeExpressionDialog()", "auxiliaryFieldCreated()", "updatePlacementWidgets()"],
"QgsStackedDiagramProperties": ["mDiagramTypeComboBox_currentIndexChanged(int index)", "apply()", "auxiliaryFieldCreated()", "QgsStackedDiagramProperties(QgsVectorLayer *layer, QWidget *parent, QgsMapCanvas *canvas)"],
"QgsStackedDiagramProperties": ["mDiagramTypeComboBox_currentIndexChanged(int index)", "apply()", "mSubDiagramsTabWidget_tabMoved(int from, int to)", "auxiliaryFieldCreated()", "QgsStackedDiagramProperties(QgsVectorLayer *layer, QWidget *parent, QgsMapCanvas *canvas)"],
"QgsFeatureListView": ["repaintRequested()", "repaintRequested(const QModelIndexList &indexes)"],
"QgsGradientFillSymbolLayerWidget": ["setGradientSpread(int index)", "setColor(const QColor &color)", "setCoordinateMode(int index)", "setColor2(const QColor &color)", "setGradientType(int index)"],
"QgsFillSymbol": ["setAngle(double angle) const"],