32 , mSourceColorRamp( nullptr )
33 , mShowGradientOnly( false )
56 if ( !mShowGradientOnly || ramp->
type() ==
"gradient" )
65 if ( !mShowGradientOnly )
75 if ( rampName ==
tr(
"Random colors" ) )
88 return index ==
count() - 1;
106 if ( index !=
count() - 1 )
111 if ( !mShowGradientOnly )
147 if ( newRamp->type() ==
"gradient" )
151 if ( dlg.
exec() && gradRamp )
157 else if ( newRamp->type() ==
"random" )
167 else if ( newRamp->type() ==
"colorbrewer" )
177 else if ( newRamp->type() ==
"cpt-city" )
181 if ( dlg.
exec() && cptCityRamp )
QgsVectorColorRampV2 * currentColorRamp()
return new instance of the current color ramp or NULL if there is no active color ramp ...
QgsVectorColorRampV2 * colorRamp(const QString &name)
return a NEW copy of color ramp
QgsColorRampComboBox(QWidget *parent=nullptr)
static QIcon colorRampPreviewIcon(QgsVectorColorRampV2 *ramp, QSize size)
virtual QString type() const =0
Returns a string representing the color ramp type.
void setIconSize(const QSize &size)
QString itemText(int index) const
QStringList colorRampNames()
return a list of names of color ramps
QString tr(const char *sourceText, const char *disambiguation, int n)
void insertItem(int index, const QString &text, const QVariant &userData)
bool save(QString filename=QString())
save style into a file (will use current filename if empty string is passed)
void addItem(const QString &text, const QVariant &userData)
virtual QgsVectorColorRampV2 * clone() const =0
Creates a clone of the color ramp.
bool createNewColorRampSelected() const
Returns true if the current selection in the combo box is the option for creating a new color ramp...
void activated(int index)
void colorRampChanged(int index)
void editSourceRamp()
Triggers a dialog which allows users to edit the current source ramp for the combo box...
bool blockSignals(bool block)
Random color ramp, which returns random colors based on preset parameters.
void setSourceColorRamp(QgsVectorColorRampV2 *sourceRamp)
add/select color ramp which was used previously by the renderer
QgsVectorColorRampV2 * mSourceColorRamp
void setItemIcon(int index, const QIcon &icon)
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
static QSize rampIconSize
QString currentText() const
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Abstract base class for color ramps.
Gradient color ramp, which smoothly interpolates between two colors and also supports optional extra ...
void sourceRampEdited()
Emitted when the user has edited the current source ramp.
void populate(QgsStyleV2 *style)
initialize the combo box with color ramps from the style