25 QComboBox( parent ), mStyle( NULL ), mSourceColorRamp( NULL ), mShowGradientOnly( false )
44 for ( QStringList::iterator it = rampNames.begin(); it != rampNames.end(); ++it )
48 if ( !mShowGradientOnly || ramp->
type() ==
"gradient" )
57 if ( !mShowGradientOnly )
58 addItem(
tr(
"Random colors" ) );
59 addItem(
tr(
"New color ramp..." ) );
60 connect(
this, SIGNAL( activated(
int ) ), SLOT(
colorRampChanged(
int ) ) );
65 QString rampName = currentText();
67 if ( rampName ==
tr(
"Random colors" ) )
79 int index = currentIndex();
80 return index == count() - 1;
88 if ( itemText( 0 ) ==
"[source]" )
89 setItemIcon( 0, icon );
91 insertItem( 0, icon,
"[source]" );
97 if ( index != count() - 1 )
102 if ( !mShowGradientOnly )
110 if ( rampName.isEmpty() )
117 blockSignals(
true );
118 insertItem( index, icon, rampName );
119 blockSignals(
false );
124 setCurrentIndex( index );
QgsVectorColorRampV2 * currentColorRamp()
return new instance of the current color ramp or NULL if there is no active color ramp ...
static QIcon colorRampPreviewIcon(QgsVectorColorRampV2 *ramp, QSize size)
virtual QString type() const =0
QStringList colorRampNames()
return a list of names of color ramps
bool save(QString filename=QString())
save style into a file (will use current filename if empty string is passed)
virtual QgsVectorColorRampV2 * clone() const =0
void colorRampChanged(int index)
QgsColorRampComboBox(QWidget *parent=0)
void setSourceColorRamp(QgsVectorColorRampV2 *sourceRamp)
add/select color ramp which was used previously by the renderer
bool createNewColorRampSelected() const
Returns true if the current selection in the combo box is the option for creating a new color ramp...
QgsVectorColorRampV2 * mSourceColorRamp
static QString addColorRampStatic(QWidget *parent, QgsStyleV2 *style, QString RampType=QString())
open add color ramp dialog, return color ramp's name if the ramp has been added
QgsVectorColorRampV2 * colorRamp(QString name)
return a NEW copy of color ramp
static QSize rampIconSize
void populate(QgsStyleV2 *style)
initialize the combo box with color ramps from the style