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 ed8807c commit 4963fa9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/gui/effects/qgseffectstackpropertieswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,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 );
}

Expand Down

0 comments on commit 4963fa9

Please sign in to comment.