mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-30 00:29:39 -05:00
Show style name in style panel title. Fix #25724.
This commit is contained in:
parent
a00889b0a7
commit
e8ca757b06
@ -1286,6 +1286,28 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipBadLayers
|
||||
mMapStyleWidget = new QgsLayerStylingWidget( mMapCanvas, mInfoBar, mMapLayerPanelFactories );
|
||||
mMapStylingDock->setWidget( mMapStyleWidget );
|
||||
connect( mMapStyleWidget, &QgsLayerStylingWidget::styleChanged, this, &QgisApp::updateLabelToolButtons );
|
||||
connect( mMapStyleWidget, &QgsLayerStylingWidget::layerChanged, this, [ = ]( QgsMapLayer * layer )
|
||||
{
|
||||
if ( !layer->styleManager()->isDefault( layer->styleManager()->currentStyle() ) )
|
||||
{
|
||||
mMapStylingDock->setWindowTitle( tr( "Layer Styling (%1)" ).arg( layer->styleManager()->currentStyle() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
mMapStylingDock->setWindowTitle( tr( "Layer Styling" ) );
|
||||
}
|
||||
} );
|
||||
connect( mMapStyleWidget, &QgsLayerStylingWidget::layerStyleChanged, this, [ = ]( QString styleName )
|
||||
{
|
||||
if ( tr( "default" ) != styleName )
|
||||
{
|
||||
mMapStylingDock->setWindowTitle( tr( "Layer Styling (%1)" ).arg( styleName ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
mMapStylingDock->setWindowTitle( tr( "Layer Styling" ) );
|
||||
}
|
||||
} );
|
||||
connect( mMapStylingDock, &QDockWidget::visibilityChanged, mActionStyleDock, &QAction::setChecked );
|
||||
|
||||
addDockWidget( Qt::RightDockWidgetArea, mMapStylingDock );
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#include "qgsrasterrendererwidget.h"
|
||||
#include "qgsmapcanvas.h"
|
||||
#include "qgsmaplayer.h"
|
||||
#include "qgsmaplayerstylemanager.h"
|
||||
#include "qgsstyle.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgspointcloudlayer.h"
|
||||
@ -157,6 +158,7 @@ void QgsLayerStylingWidget::setLayer( QgsMapLayer *layer )
|
||||
if ( mCurrentLayer )
|
||||
{
|
||||
disconnect( mCurrentLayer, &QgsMapLayer::styleChanged, this, &QgsLayerStylingWidget::updateCurrentWidgetLayer );
|
||||
disconnect( mCurrentLayer->styleManager(), &QgsMapLayerStyleManager::currentStyleChanged, this, &QgsLayerStylingWidget::emitLayerStyleChanged );
|
||||
}
|
||||
|
||||
if ( !layer || !layer->isSpatial() || !QgsProject::instance()->layerIsEmbedded( layer->id() ).isEmpty() )
|
||||
@ -180,6 +182,7 @@ void QgsLayerStylingWidget::setLayer( QgsMapLayer *layer )
|
||||
mUndoWidget->setUndoStack( layer->undoStackStyles() );
|
||||
|
||||
connect( mCurrentLayer, &QgsMapLayer::styleChanged, this, &QgsLayerStylingWidget::updateCurrentWidgetLayer );
|
||||
connect( mCurrentLayer->styleManager(), &QgsMapLayerStyleManager::currentStyleChanged, this, &QgsLayerStylingWidget::emitLayerStyleChanged );
|
||||
|
||||
int lastPage = mOptionsListWidget->currentIndex().row();
|
||||
mOptionsListWidget->blockSignals( true );
|
||||
@ -300,6 +303,7 @@ void QgsLayerStylingWidget::setLayer( QgsMapLayer *layer )
|
||||
mLastStyleXml = doc.createElement( QStringLiteral( "style" ) );
|
||||
doc.appendChild( mLastStyleXml );
|
||||
mCurrentLayer->writeStyle( mLastStyleXml, doc, errorMsg, QgsReadWriteContext() );
|
||||
emit layerChanged( layer );
|
||||
}
|
||||
|
||||
void QgsLayerStylingWidget::apply()
|
||||
|
||||
@ -116,6 +116,8 @@ class APP_EXPORT QgsLayerStylingWidget : public QWidget, private Ui::QgsLayerSty
|
||||
|
||||
signals:
|
||||
void styleChanged( QgsMapLayer *layer );
|
||||
void layerChanged( QgsMapLayer *layer );
|
||||
void layerStyleChanged( const QString ¤tStyleName );
|
||||
|
||||
public slots:
|
||||
void setLayer( QgsMapLayer *layer );
|
||||
@ -153,6 +155,7 @@ class APP_EXPORT QgsLayerStylingWidget : public QWidget, private Ui::QgsLayerSty
|
||||
|
||||
private:
|
||||
void pushUndoItem( const QString &name, bool triggerRepaint = true );
|
||||
void emitLayerStyleChanged( const QString ¤tStyleName ) {emit layerStyleChanged( currentStyleName );};
|
||||
int mNotSupportedPage;
|
||||
int mLayerPage;
|
||||
QTimer *mAutoApplyTimer = nullptr;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user