mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
[ui] Fix single feat. renderer symbol levels reset when changing style (fixes #26547)
This commit is contained in:
parent
10c5b2f9db
commit
648af3ed89
@ -76,6 +76,11 @@ This method should be called whenever the renderer is actually set on the layer.
|
||||
Emitted when expression context variables on the associated
|
||||
vector layers have been changed. Will request the parent dialog
|
||||
to re-synchronize with the variables.
|
||||
%End
|
||||
|
||||
void symbolLevelsChanged();
|
||||
%Docstring
|
||||
Emitted when the symbol levels settings have been changed.
|
||||
%End
|
||||
|
||||
protected:
|
||||
|
@ -71,6 +71,7 @@ Returns the symbol that is currently active in the widget. Can be ``None``.
|
||||
:return: The active symbol.
|
||||
%End
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
void loadSymbol();
|
||||
@ -78,7 +79,6 @@ Returns the symbol that is currently active in the widget. Can be ``None``.
|
||||
Reload the current symbol in the view.
|
||||
%End
|
||||
|
||||
|
||||
void updateUi();
|
||||
%Docstring
|
||||
Update the state of the UI based on the currently set symbol layer.
|
||||
|
@ -320,7 +320,7 @@ void QgsRendererWidget::showSymbolLevelsDialog( QgsFeatureRenderer *r )
|
||||
QgsSymbolLevelsWidget *widget = new QgsSymbolLevelsWidget( r, r->usingSymbolLevels(), panel );
|
||||
widget->setPanelTitle( tr( "Symbol Levels" ) );
|
||||
connect( widget, &QgsPanelWidget::widgetChanged, widget, &QgsSymbolLevelsWidget::apply );
|
||||
connect( widget, &QgsPanelWidget::widgetChanged, this, &QgsPanelWidget::widgetChanged );
|
||||
connect( widget, &QgsPanelWidget::widgetChanged, [ = ]() { emit widgetChanged(); emit symbolLevelsChanged(); } );
|
||||
panel->openPanel( widget );
|
||||
return;
|
||||
}
|
||||
@ -329,6 +329,7 @@ void QgsRendererWidget::showSymbolLevelsDialog( QgsFeatureRenderer *r )
|
||||
if ( dlg.exec() )
|
||||
{
|
||||
emit widgetChanged();
|
||||
emit symbolLevelsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,6 +88,11 @@ class GUI_EXPORT QgsRendererWidget : public QgsPanelWidget
|
||||
*/
|
||||
void layerVariablesChanged();
|
||||
|
||||
/**
|
||||
* Emitted when the symbol levels settings have been changed.
|
||||
*/
|
||||
void symbolLevelsChanged();
|
||||
|
||||
protected:
|
||||
QgsVectorLayer *mLayer = nullptr;
|
||||
QgsStyle *mStyle = nullptr;
|
||||
|
@ -57,6 +57,12 @@ QgsSingleSymbolRendererWidget::QgsSingleSymbolRendererWidget( QgsVectorLayer *la
|
||||
mSelector = new QgsSymbolSelectorWidget( mSingleSymbol, mStyle, mLayer, nullptr );
|
||||
connect( mSelector, &QgsSymbolSelectorWidget::symbolModified, this, &QgsSingleSymbolRendererWidget::changeSingleSymbol );
|
||||
connect( mSelector, &QgsPanelWidget::showPanel, this, &QgsPanelWidget::openPanel );
|
||||
connect( this, &QgsRendererWidget::symbolLevelsChanged, [ = ]()
|
||||
{
|
||||
delete mSingleSymbol;
|
||||
mSingleSymbol = mRenderer->symbol()->clone();
|
||||
mSelector->loadSymbol( mSingleSymbol );
|
||||
} );
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout( this );
|
||||
layout->setContentsMargins( 0, 0, 0, 0 );
|
||||
|
@ -385,6 +385,13 @@ QgsSymbolWidgetContext QgsSymbolSelectorWidget::context() const
|
||||
|
||||
void QgsSymbolSelectorWidget::loadSymbol( QgsSymbol *symbol, SymbolLayerItem *parent )
|
||||
{
|
||||
if ( !parent )
|
||||
{
|
||||
mSymbol = symbol;
|
||||
model->clear();
|
||||
parent = static_cast<SymbolLayerItem *>( model->invisibleRootItem() );
|
||||
}
|
||||
|
||||
SymbolLayerItem *symbolItem = new SymbolLayerItem( symbol );
|
||||
QFont boldFont = symbolItem->font();
|
||||
boldFont.setBold( true );
|
||||
|
@ -127,6 +127,14 @@ class GUI_EXPORT QgsSymbolSelectorWidget: public QgsPanelWidget, private Ui::Qgs
|
||||
*/
|
||||
QgsSymbol *symbol() { return mSymbol; }
|
||||
|
||||
/**
|
||||
* Load the given symbol into the widget.
|
||||
* \param symbol The symbol to load.
|
||||
* \param parent The parent symbol layer item. If the parent parameter is null, the whole symbol and model will be reset.
|
||||
* \note not available in Python bindings
|
||||
*/
|
||||
void loadSymbol( QgsSymbol *symbol, SymbolLayerItem *parent = nullptr ) SIP_SKIP;
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
@ -134,14 +142,6 @@ class GUI_EXPORT QgsSymbolSelectorWidget: public QgsPanelWidget, private Ui::Qgs
|
||||
*/
|
||||
void loadSymbol();
|
||||
|
||||
/**
|
||||
* Load the given symbol into the widget.
|
||||
* \param symbol The symbol to load.
|
||||
* \param parent The parent symbol layer item.
|
||||
* \note not available in Python bindings
|
||||
*/
|
||||
void loadSymbol( QgsSymbol *symbol, SymbolLayerItem *parent ) SIP_SKIP;
|
||||
|
||||
/**
|
||||
* Update the state of the UI based on the currently set symbol layer.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user