Skip to content

Commit

Permalink
Color ramp combo box: do not show "random colors" if gradients-only i…
Browse files Browse the repository at this point in the history
…s on

+ added option to query whether gradients-only option is enabled
  • Loading branch information
wonder-sk committed Feb 14, 2014
1 parent 277d274 commit 8b10eb0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions python/gui/symbology-ng/qgscolorrampcombobox.sip
Expand Up @@ -20,7 +20,10 @@ class QgsColorRampComboBox : QComboBox
//! @note not available in python bindings
// static QSize rampIconSize;

//! @note added in 2.2
void setShowGradientOnly( bool gradientOnly );
//! @note added in 2.2
bool showGradientOnly() const;

public slots:
void colorRampChanged( int index );
Expand Down
3 changes: 2 additions & 1 deletion src/gui/symbology-ng/qgscolorrampcombobox.cpp
Expand Up @@ -54,7 +54,8 @@ void QgsColorRampComboBox::populate( QgsStyleV2* style )
delete ramp;
}

addItem( tr( "Random colors" ) );
if ( !mShowGradientOnly )
addItem( tr( "Random colors" ) );
addItem( tr( "New color ramp..." ) );
connect( this, SIGNAL( activated( int ) ), SLOT( colorRampChanged( int ) ) );
}
Expand Down
3 changes: 3 additions & 0 deletions src/gui/symbology-ng/qgscolorrampcombobox.h
Expand Up @@ -40,7 +40,10 @@ class GUI_EXPORT QgsColorRampComboBox : public QComboBox
//! @note not available in python bindings
static QSize rampIconSize;

//! @note added in 2.2
void setShowGradientOnly( bool gradientOnly ) { mShowGradientOnly = gradientOnly; }
//! @note added in 2.2
bool showGradientOnly() const { return mShowGradientOnly; }

public slots:
void colorRampChanged( int index );
Expand Down

0 comments on commit 8b10eb0

Please sign in to comment.