Skip to content

Commit 8b10eb0

Browse files
committedFeb 14, 2014
Color ramp combo box: do not show "random colors" if gradients-only is on
+ added option to query whether gradients-only option is enabled
1 parent 277d274 commit 8b10eb0

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed
 

‎python/gui/symbology-ng/qgscolorrampcombobox.sip

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ class QgsColorRampComboBox : QComboBox
2020
//! @note not available in python bindings
2121
// static QSize rampIconSize;
2222

23+
//! @note added in 2.2
2324
void setShowGradientOnly( bool gradientOnly );
25+
//! @note added in 2.2
26+
bool showGradientOnly() const;
2427

2528
public slots:
2629
void colorRampChanged( int index );

‎src/gui/symbology-ng/qgscolorrampcombobox.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ void QgsColorRampComboBox::populate( QgsStyleV2* style )
5454
delete ramp;
5555
}
5656

57-
addItem( tr( "Random colors" ) );
57+
if ( !mShowGradientOnly )
58+
addItem( tr( "Random colors" ) );
5859
addItem( tr( "New color ramp..." ) );
5960
connect( this, SIGNAL( activated( int ) ), SLOT( colorRampChanged( int ) ) );
6061
}

‎src/gui/symbology-ng/qgscolorrampcombobox.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ class GUI_EXPORT QgsColorRampComboBox : public QComboBox
4040
//! @note not available in python bindings
4141
static QSize rampIconSize;
4242

43+
//! @note added in 2.2
4344
void setShowGradientOnly( bool gradientOnly ) { mShowGradientOnly = gradientOnly; }
45+
//! @note added in 2.2
46+
bool showGradientOnly() const { return mShowGradientOnly; }
4447

4548
public slots:
4649
void colorRampChanged( int index );

0 commit comments

Comments
 (0)
Please sign in to comment.