Skip to content

Commit

Permalink
Set initial effect selection in layer effects widget to
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
nyalldawson committed Sep 26, 2016
1 parent 5baa9b7 commit f70eeaa
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/gui/effects/qgseffectstackpropertieswidget.cpp
Expand Up @@ -130,8 +130,18 @@ QgsEffectStackPropertiesWidget::QgsEffectStackPropertiesWidget( QgsEffectStack *

updateUi();

// set effect as active item in the tree
QModelIndex newIndex = mEffectsList->model()->index( 0, 0 );
// set first selected effect as active item in the tree
int initialRow = 0;
for ( int i = 0; i < stack->count(); ++i )
{
// list shows effects in opposite order to stack
if ( stack->effect( stack->count() - i - 1 )->enabled() )
{
initialRow = i;
break;
}
}
QModelIndex newIndex = mEffectsList->model()->index( initialRow, 0 );
mEffectsList->setCurrentIndex( newIndex );

setPanelTitle( tr( "Effects Properties" ) );
Expand Down

0 comments on commit f70eeaa

Please sign in to comment.