Skip to content

Commit f67a48a

Browse files
committed
Set initial effect selection in layer effects widget to
first enabled effect Hopefully makes the widget a bit more user friendly - otherwise the initial settings shown may be for a disabled effect and the users is left wondering why changes have no impact
1 parent 4dbea7f commit f67a48a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/gui/effects/qgseffectstackpropertieswidget.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,18 @@ QgsEffectStackPropertiesWidget::QgsEffectStackPropertiesWidget( QgsEffectStack *
130130

131131
updateUi();
132132

133-
// set effect as active item in the tree
134-
QModelIndex newIndex = mEffectsList->model()->index( 0, 0 );
133+
// set first selected effect as active item in the tree
134+
int initialRow = 0;
135+
for ( int i = 0; i < stack->count(); ++i )
136+
{
137+
// list shows effects in opposite order to stack
138+
if ( stack->effect( stack->count() - i - 1 )->enabled() )
139+
{
140+
initialRow = i;
141+
break;
142+
}
143+
}
144+
QModelIndex newIndex = mEffectsList->model()->index( initialRow, 0 );
135145
mEffectsList->setCurrentIndex( newIndex );
136146

137147
setPanelTitle( tr( "Effects Properties" ) );

0 commit comments

Comments
 (0)