Skip to content

Commit f70eeaa

Browse files
committedSep 26, 2016
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 (cherry-picked from f67a48a)
1 parent 5baa9b7 commit f70eeaa

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed
 

‎src/gui/effects/qgseffectstackpropertieswidget.cpp

Lines changed: 12 additions & 2 deletions
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)
Please sign in to comment.