Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nyalldawson committed Sep 23, 2016
1 parent 4dbea7f commit f67a48a
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

1 comment on commit f67a48a

@nirvn
Copy link
Contributor

@nirvn nirvn commented on f67a48a Sep 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.