Skip to content

Commit f67a48a

Browse files
committedSep 23, 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
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

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" ) );

1 commit comments

Comments
 (1)

nirvn commented on Sep 23, 2016

@nirvn
Contributor

@nyalldawson , ah, I was victim of that quite a few times, thanks.

Also, what IMHO would help here is for the effect settings panel to switch to an effect that's just been activated via its checkbox. I've had countless "args" when realizing that I was changing the settings of a different effect when activating [x] drop shadow checkbox.

Please sign in to comment.