24 #include <QColorDialog> 25 #include <QHeaderView> 26 #include <QInputDialog> 28 #include <QTableWidget> 32 #include <qwt_global.h> 33 #include <qwt_plot_canvas.h> 35 #include <qwt_plot_curve.h> 36 #include <qwt_plot_grid.h> 37 #include <qwt_plot_marker.h> 38 #include <qwt_plot_picker.h> 39 #include <qwt_picker_machine.h> 40 #include <qwt_plot_layout.h> 41 #include <qwt_symbol.h> 42 #include <qwt_legend.h> 47 , mCurrentPlotColorComponent( -1 )
48 , mCurrentPlotMarkerIndex( 0 )
51 connect( cboType,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsGradientColorRampDialog::cboType_currentIndexChanged );
52 connect( btnInformation, &QPushButton::pressed,
this, &QgsGradientColorRampDialog::btnInformation_pressed );
53 connect( mPositionSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientColorRampDialog::mPositionSpinBox_valueChanged );
54 connect( mPlotHueCheckbox, &QCheckBox::toggled,
this, &QgsGradientColorRampDialog::mPlotHueCheckbox_toggled );
55 connect( mPlotLightnessCheckbox, &QCheckBox::toggled,
this, &QgsGradientColorRampDialog::mPlotLightnessCheckbox_toggled );
56 connect( mPlotSaturationCheckbox, &QCheckBox::toggled,
this, &QgsGradientColorRampDialog::mPlotSaturationCheckbox_toggled );
57 connect( mPlotAlphaCheckbox, &QCheckBox::toggled,
this, &QgsGradientColorRampDialog::mPlotAlphaCheckbox_toggled );
59 setWindowModality( Qt::WindowModal );
62 mPositionSpinBox->setShowClearButton(
false );
63 btnColor1->setAllowOpacity(
true );
64 btnColor1->setColorDialogTitle( tr(
"Select Ramp Color" ) );
65 btnColor1->setContext( QStringLiteral(
"symbology" ) );
66 btnColor1->setShowNoColor(
true );
67 btnColor1->setNoColorString( tr(
"Transparent" ) );
68 btnColor2->setAllowOpacity(
true );
69 btnColor2->setColorDialogTitle( tr(
"Select Ramp Color" ) );
70 btnColor2->setContext( QStringLiteral(
"symbology" ) );
71 btnColor2->setShowNoColor(
true );
72 btnColor2->setNoColorString( tr(
"Transparent" ) );
78 cboType->blockSignals(
true );
79 cboType->addItem( tr(
"Discrete" ) );
80 cboType->addItem( tr(
"Continuous" ) );
82 cboType->setCurrentIndex( 0 );
84 cboType->setCurrentIndex( 1 );
85 cboType->blockSignals(
false );
87 if ( mRamp.
info().isEmpty() )
88 btnInformation->setEnabled(
false );
90 mStopEditor->setGradientRamp( mRamp );
97 restoreGeometry( settings.
value( QStringLiteral(
"Windows/GradientEditor/geometry" ) ).toByteArray() );
100 mPlot->setFrameStyle( QFrame::NoFrame );
101 QFrame *plotCanvasFrame =
dynamic_cast<QFrame *
>( mPlot->canvas() );
102 if ( plotCanvasFrame )
103 plotCanvasFrame->setFrameStyle( QFrame::NoFrame );
105 mPlot->setAxisScale( QwtPlot::yLeft, 0.0, 1.0 );
106 mPlot->enableAxis( QwtPlot::yLeft,
false );
109 QwtPlotGrid *grid =
new QwtPlotGrid();
110 QwtScaleDiv gridDiv( 0.0, 1.0, QList<double>(), QList<double>(), QList<double>() << 0.2 << 0.4 << 0.6 << 0.8 );
111 grid->setXDiv( gridDiv );
112 grid->setYDiv( gridDiv );
113 grid->setPen( QPen( QColor( 0, 0, 0, 50 ) ) );
114 grid->attach( mPlot );
116 mLightnessCurve =
new QwtPlotCurve();
117 mLightnessCurve->setTitle( QStringLiteral(
"Lightness" ) );
118 mLightnessCurve->setPen( QPen( QColor( 70, 150, 255 ), 0.0 ) ),
119 mLightnessCurve->setRenderHint( QwtPlotItem::RenderAntialiased,
true );
120 mLightnessCurve->attach( mPlot );
122 mHueCurve =
new QwtPlotCurve();
123 mHueCurve->setTitle( QStringLiteral(
"Hue" ) );
124 mHueCurve->setPen( QPen( QColor( 255, 215, 70 ), 0.0 ) ),
125 mHueCurve->setRenderHint( QwtPlotItem::RenderAntialiased,
true );
126 mHueCurve->attach( mPlot );
128 mSaturationCurve =
new QwtPlotCurve();
129 mSaturationCurve->setTitle( QStringLiteral(
"Saturation" ) );
130 mSaturationCurve->setPen( QPen( QColor( 255, 70, 150 ), 0.0 ) ),
131 mSaturationCurve->setRenderHint( QwtPlotItem::RenderAntialiased,
true );
132 mSaturationCurve->attach( mPlot );
134 mAlphaCurve =
new QwtPlotCurve();
135 mAlphaCurve->setTitle( QStringLiteral(
"Opacity" ) );
136 mAlphaCurve->setPen( QPen( QColor( 50, 50, 50 ), 0.0 ) ),
137 mAlphaCurve->setRenderHint( QwtPlotItem::RenderAntialiased,
true );
138 mAlphaCurve->attach( mPlot );
140 mPlotFilter =
new QgsGradientPlotEventFilter( mPlot );
141 connect( mPlotFilter, &QgsGradientPlotEventFilter::mousePress,
this, &QgsGradientColorRampDialog::plotMousePress );
142 connect( mPlotFilter, &QgsGradientPlotEventFilter::mouseRelease,
this, &QgsGradientColorRampDialog::plotMouseRelease );
143 connect( mPlotFilter, &QgsGradientPlotEventFilter::mouseMove,
this, &QgsGradientColorRampDialog::plotMouseMove );
145 mPlotHueCheckbox->setChecked( settings.
value( QStringLiteral(
"GradientEditor/plotHue" ),
false ).toBool() );
146 mPlotLightnessCheckbox->setChecked( settings.
value( QStringLiteral(
"GradientEditor/plotLightness" ),
true ).toBool() );
147 mPlotSaturationCheckbox->setChecked( settings.
value( QStringLiteral(
"GradientEditor/plotSaturation" ),
false ).toBool() );
148 mPlotAlphaCheckbox->setChecked( settings.
value( QStringLiteral(
"GradientEditor/plotAlpha" ),
false ).toBool() );
150 mHueCurve->setVisible( mPlotHueCheckbox->isChecked() );
151 mLightnessCurve->setVisible( mPlotLightnessCheckbox->isChecked() );
152 mSaturationCurve->setVisible( mPlotSaturationCheckbox->isChecked() );
153 mAlphaCurve->setVisible( mPlotAlphaCheckbox->isChecked() );
156 mStopEditor->selectStop( 0 );
158 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsGradientColorRampDialog::showHelp );
165 settings.
setValue( QStringLiteral(
"GradientEditor/plotHue" ), mPlotHueCheckbox->isChecked() );
166 settings.
setValue( QStringLiteral(
"GradientEditor/plotLightness" ), mPlotLightnessCheckbox->isChecked() );
167 settings.
setValue( QStringLiteral(
"GradientEditor/plotSaturation" ), mPlotSaturationCheckbox->isChecked() );
168 settings.
setValue( QStringLiteral(
"GradientEditor/plotAlpha" ), mPlotAlphaCheckbox->isChecked() );
176 updateColorButtons();
183 void QgsGradientColorRampDialog::cboType_currentIndexChanged(
int index )
189 updateColorButtons();
196 void QgsGradientColorRampDialog::btnInformation_pressed()
198 if ( mRamp.
info().isEmpty() )
202 QLabel *label =
nullptr;
205 QTableWidget *tableInfo =
new QTableWidget( dlg );
206 tableInfo->verticalHeader()->hide();
207 tableInfo->horizontalHeader()->hide();
208 tableInfo->setRowCount( mRamp.
info().count() );
209 tableInfo->setColumnCount( 2 );
212 for ( QgsStringMap::const_iterator it = rampInfo.constBegin();
213 it != rampInfo.constEnd(); ++it )
215 if ( it.key().startsWith( QLatin1String(
"cpt-city" ) ) )
217 tableInfo->setItem( i, 0,
new QTableWidgetItem( it.key() ) );
218 tableInfo->setItem( i, 1,
new QTableWidgetItem( it.value() ) );
219 tableInfo->resizeRowToContents( i );
222 tableInfo->resizeColumnToContents( 0 );
223 tableInfo->horizontalHeader()->setStretchLastSection(
true );
224 tableInfo->setRowCount( i );
225 tableInfo->setFixedHeight( tableInfo->rowHeight( 0 ) * i + 5 );
226 dlg->
layout()->addWidget( tableInfo );
227 dlg->resize( 600, 250 );
229 dlg->
layout()->addSpacing( 5 );
232 QString gradientFile = mRamp.
info().value( QStringLiteral(
"cpt-city-gradient" ) );
233 if ( ! gradientFile.isNull() )
235 QString fileName = gradientFile;
237 if ( ! QFile::exists( fileName ) )
239 fileName = gradientFile;
240 fileName.replace( QLatin1String(
"<cpt-city>" ), QLatin1String(
"http://soliton.vm.bytemark.co.uk/pub/cpt-city" ) );
242 label =
new QLabel( tr(
"Gradient file : %1" ).arg( fileName ), dlg );
243 label->setTextInteractionFlags( Qt::TextBrowserInteraction );
244 dlg->
layout()->addSpacing( 5 );
245 dlg->
layout()->addWidget( label );
249 QString licenseFile = mRamp.
info().value( QStringLiteral(
"cpt-city-license" ) );
250 if ( !licenseFile.isNull() )
252 QString fileName = licenseFile;
254 if ( ! QFile::exists( fileName ) )
256 fileName = licenseFile;
257 fileName.replace( QLatin1String(
"<cpt-city>" ), QLatin1String(
"http://soliton.vm.bytemark.co.uk/pub/cpt-city" ) );
259 label =
new QLabel( tr(
"License file : %1" ).arg( fileName ), dlg );
260 label->setTextInteractionFlags( Qt::TextBrowserInteraction );
261 dlg->
layout()->addSpacing( 5 );
262 dlg->
layout()->addWidget( label );
263 if ( QFile::exists( fileName ) )
265 QTextEdit *textEdit =
new QTextEdit( dlg );
266 textEdit->setReadOnly(
true );
267 QFile file( fileName );
268 if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) )
270 textEdit->setText( file.readAll() );
272 dlg->
layout()->addSpacing( 5 );
273 dlg->
layout()->addWidget( textEdit );
274 dlg->resize( 600, 500 );
282 void QgsGradientColorRampDialog::updateColorButtons()
284 btnColor1->blockSignals(
true );
285 btnColor1->setColor( mRamp.
color1() );
286 btnColor1->blockSignals(
false );
287 btnColor2->blockSignals(
true );
288 btnColor2->setColor( mRamp.
color2() );
289 btnColor2->blockSignals(
false );
292 void QgsGradientColorRampDialog::updateStopEditor()
294 mStopEditor->blockSignals(
true );
295 mStopEditor->setGradientRamp( mRamp );
296 mStopEditor->blockSignals(
false );
299 void QgsGradientColorRampDialog::selectedStopChanged(
const QgsGradientStop &stop )
301 mColorWidget->blockSignals(
true );
302 mColorWidget->setColor( stop.
color );
303 mColorWidget->blockSignals(
false );
304 mPositionSpinBox->blockSignals(
true );
305 mPositionSpinBox->setValue( stop.
offset * 100 );
306 mPositionSpinBox->blockSignals(
false );
311 mPositionSpinBox->setDisabled(
true );
312 mDeleteStopButton->setDisabled(
true );
316 mPositionSpinBox->setDisabled(
false );
317 mDeleteStopButton->setDisabled(
false );
323 void QgsGradientColorRampDialog::colorWidgetChanged(
const QColor &color )
325 mStopEditor->setSelectedStopColor( color );
328 void QgsGradientColorRampDialog::mPositionSpinBox_valueChanged(
double val )
330 mStopEditor->setSelectedStopOffset( val / 100.0 );
333 void QgsGradientColorRampDialog::mPlotHueCheckbox_toggled(
bool checked )
335 mHueCurve->setVisible( checked );
339 void QgsGradientColorRampDialog::mPlotLightnessCheckbox_toggled(
bool checked )
341 mLightnessCurve->setVisible( checked );
345 void QgsGradientColorRampDialog::mPlotSaturationCheckbox_toggled(
bool checked )
347 mSaturationCurve->setVisible( checked );
351 void QgsGradientColorRampDialog::mPlotAlphaCheckbox_toggled(
bool checked )
353 mAlphaCurve->setVisible( checked );
357 void QgsGradientColorRampDialog::plotMousePress( QPointF point )
362 mCurrentPlotColorComponent = -1;
363 mCurrentPlotMarkerIndex = -1;
366 for (
int i = 0; i < mRamp.
count(); ++i )
369 double currentOff = 0.0;
373 currentCol = mRamp.
color1();
375 else if ( i == mRamp.
count() - 1 )
378 currentCol = mRamp.
color2();
382 currentOff = mRamp.
stops().at( i - 1 ).offset;
383 currentCol = mRamp.
stops().at( i - 1 ).color;
387 if ( mPlotHueCheckbox->isChecked() )
389 currentDist = std::pow( point.x() - currentOff, 2.0 ) + std::pow( point.y() - currentCol.hslHueF(), 2.0 );
390 if ( currentDist < minDist )
392 minDist = currentDist;
393 mCurrentPlotColorComponent = 0;
394 mCurrentPlotMarkerIndex = i;
397 if ( mPlotLightnessCheckbox->isChecked() )
399 currentDist = std::pow( point.x() - currentOff, 2.0 ) + std::pow( point.y() - currentCol.lightnessF(), 2.0 );
400 if ( currentDist < minDist )
402 minDist = currentDist;
403 mCurrentPlotColorComponent = 1;
404 mCurrentPlotMarkerIndex = i;
407 if ( mPlotSaturationCheckbox->isChecked() )
409 currentDist = std::pow( point.x() - currentOff, 2.0 ) + std::pow( point.y() - currentCol.hslSaturationF(), 2.0 );
410 if ( currentDist < minDist )
412 minDist = currentDist;
413 mCurrentPlotColorComponent = 2;
414 mCurrentPlotMarkerIndex = i;
417 if ( mPlotAlphaCheckbox->isChecked() )
419 currentDist = std::pow( point.x() - currentOff, 2.0 ) + std::pow( point.y() - currentCol.alphaF(), 2.0 );
420 if ( currentDist < minDist )
422 minDist = currentDist;;
423 mCurrentPlotColorComponent = 3;
424 mCurrentPlotMarkerIndex = i;
430 if ( mCurrentPlotMarkerIndex >= 0 )
431 mStopEditor->selectStop( mCurrentPlotMarkerIndex );
434 void QgsGradientColorRampDialog::plotMouseRelease( QPointF )
436 mCurrentPlotColorComponent = -1;
439 void QgsGradientColorRampDialog::plotMouseMove( QPointF point )
441 QColor newColor = mStopEditor->selectedStop().color;
443 if ( mCurrentPlotColorComponent == 0 )
444 newColor = QColor::fromHslF( qBound( qreal( 0.0 ), point.y(), qreal( 1.0 ) ), newColor.hslSaturationF(), newColor.lightnessF(), newColor.alphaF() );
445 else if ( mCurrentPlotColorComponent == 1 )
446 newColor = QColor::fromHslF( newColor.hslHueF(), newColor.hslSaturationF(), qBound( qreal( 0.0 ), point.y(), qreal( 1.0 ) ), newColor.alphaF() );
447 else if ( mCurrentPlotColorComponent == 2 )
448 newColor = QColor::fromHslF( newColor.hslHueF(), qBound( qreal( 0.0 ), point.y(), qreal( 1.0 ) ), newColor.lightnessF(), newColor.alphaF() );
449 else if ( mCurrentPlotColorComponent == 3 )
450 newColor = QColor::fromHslF( newColor.hslHueF(), newColor.hslSaturationF(), newColor.lightnessF(), qBound( qreal( 0.0 ), point.y(), qreal( 1.0 ) ) );
452 mStopEditor->setSelectedStopDetails( newColor, qBound( qreal( 0.0 ), point.x(), qreal( 1.0 ) ) );
455 bool byX( QPointF p1, QPointF p2 )
457 return p1.x() < p2.x();
460 void QgsGradientColorRampDialog::addPlotMarker(
double x,
double y,
const QColor &color,
bool isSelected )
462 QColor borderColor = color.darker( 200 );
463 borderColor.setAlpha( 255 );
465 QColor brushColor = color;
466 brushColor.setAlpha( 255 );
468 QwtPlotMarker *marker =
new QwtPlotMarker();
469 marker->setSymbol(
new QwtSymbol( QwtSymbol::Ellipse, QBrush( brushColor ), QPen( borderColor, isSelected ? 2 : 1 ), QSize( 8, 8 ) ) );
470 marker->setValue( x, y );
471 marker->attach( mPlot );
472 marker->setRenderHint( QwtPlotItem::RenderAntialiased,
true );
476 void QgsGradientColorRampDialog::addMarkersForColor(
double x,
const QColor &color,
bool isSelected )
478 if ( mPlotHueCheckbox->isChecked() )
479 addPlotMarker( x, color.hslHueF(), color, isSelected && mCurrentPlotColorComponent == 0 );
480 if ( mPlotLightnessCheckbox->isChecked() )
481 addPlotMarker( x, color.lightnessF(), color, isSelected && mCurrentPlotColorComponent == 1 );
482 if ( mPlotSaturationCheckbox->isChecked() )
483 addPlotMarker( x, color.hslSaturationF(), color, isSelected && mCurrentPlotColorComponent == 2 );
484 if ( mPlotAlphaCheckbox->isChecked() )
485 addPlotMarker( x, color.alphaF(), color, isSelected && mCurrentPlotColorComponent == 3 );
488 void QgsGradientColorRampDialog::updatePlot()
491 Q_FOREACH ( QwtPlotMarker *marker, mMarkers )
498 QPolygonF lightnessPoints;
500 QPolygonF saturationPoints;
501 QPolygonF alphaPoints;
502 lightnessPoints << QPointF( 0.0, mRamp.
color1().lightnessF() );
503 huePoints << QPointF( 0.0, mRamp.
color1().hslHueF() );
504 saturationPoints << QPointF( 0.0, mRamp.
color1().hslSaturationF() );
505 alphaPoints << QPointF( 0.0, mRamp.
color1().alphaF() );
506 addMarkersForColor( 0, mRamp.
color1(), mCurrentPlotMarkerIndex == 0 );
511 lightnessPoints << QPointF( stop.
offset, stop.
color.lightnessF() );
512 huePoints << QPointF( stop.
offset, stop.
color.hslHueF() );
513 saturationPoints << QPointF( stop.
offset, stop.
color.hslSaturationF() );
514 alphaPoints << QPointF( stop.
offset, stop.
color.alphaF() );
516 addMarkersForColor( stop.
offset, stop.
color, mCurrentPlotMarkerIndex == i );
521 for (
double p = 0.001; p < 1.0; p += 0.001 )
523 QColor c = mRamp.
color( p );
524 lightnessPoints << QPointF( p, c.lightnessF() );
525 huePoints << QPointF( p, c.hslHueF() );
526 saturationPoints << QPointF( p, c.hslSaturationF() );
527 alphaPoints << QPointF( p, c.alphaF() );
530 lightnessPoints << QPointF( 1.0, mRamp.
color2().lightnessF() );
531 huePoints << QPointF( 1.0, mRamp.
color2().hslHueF() );
532 saturationPoints << QPointF( 1.0, mRamp.
color2().hslSaturationF() );
533 alphaPoints << QPointF( 1.0, mRamp.
color2().alphaF() );
534 addMarkersForColor( 1.0, mRamp.
color2(), mCurrentPlotMarkerIndex == i );
536 std::sort( lightnessPoints.begin(), lightnessPoints.end(),
byX );
537 std::sort( huePoints.begin(), huePoints.end(),
byX );
538 std::sort( saturationPoints.begin(), saturationPoints.end(),
byX );
539 std::sort( alphaPoints.begin(), alphaPoints.end(),
byX );
541 mLightnessCurve->setSamples( lightnessPoints );
542 mHueCurve->setSamples( huePoints );
543 mSaturationCurve->setSamples( saturationPoints );
544 mAlphaCurve->setSamples( alphaPoints );
548 void QgsGradientColorRampDialog::updateRampFromStopEditor()
550 mRamp = mStopEditor->gradientRamp();
551 mPositionSpinBox->blockSignals(
true );
552 mPositionSpinBox->setValue( mStopEditor->selectedStop().offset * 100 );
553 mPositionSpinBox->blockSignals(
false );
554 mColorWidget->blockSignals(
true );
555 mColorWidget->setColor( mStopEditor->selectedStop().color );
556 mColorWidget->blockSignals(
false );
558 updateColorButtons();
566 mStopEditor->setColor1( color );
567 updateColorButtons();
572 mStopEditor->setColor2( color );
573 updateColorButtons();
576 void QgsGradientColorRampDialog::showHelp()
578 QgsHelp::openHelp( QStringLiteral(
"working_with_vector/style_library.html#color-ramp" ) );
584 QgsGradientPlotEventFilter::QgsGradientPlotEventFilter( QwtPlot *plot )
588 mPlot->canvas()->installEventFilter(
this );
591 bool QgsGradientPlotEventFilter::eventFilter( QObject *
object, QEvent *event )
593 if ( !mPlot->isEnabled() )
594 return QObject::eventFilter(
object, event );
596 switch ( event->type() )
598 case QEvent::MouseButtonPress:
600 const QMouseEvent *mouseEvent =
static_cast<QMouseEvent *
>( event );
601 if ( mouseEvent->button() == Qt::LeftButton )
603 emit mousePress( mapPoint( mouseEvent->pos() ) );
607 case QEvent::MouseMove:
609 const QMouseEvent *mouseEvent =
static_cast<QMouseEvent *
>( event );
610 if ( mouseEvent->buttons() & Qt::LeftButton )
613 emit mouseMove( mapPoint( mouseEvent->pos() ) );
617 case QEvent::MouseButtonRelease:
619 const QMouseEvent *mouseEvent =
static_cast<QMouseEvent *
>( event );
620 if ( mouseEvent->button() == Qt::LeftButton )
622 emit mouseRelease( mapPoint( mouseEvent->pos() ) );
630 return QObject::eventFilter(
object, event );
633 QPointF QgsGradientPlotEventFilter::mapPoint( QPointF point )
const 638 return QPointF( mPlot->canvasMap( QwtPlot::xBottom ).invTransform( point.x() ),
639 mPlot->canvasMap( QwtPlot::yLeft ).invTransform( point.y() ) );
void setColor2(const QColor &color)
Sets the end color for the gradient ramp.
Represents a color stop within a QgsGradientColorRamp color ramp.
This class is a composition of two QSettings instances:
void changed()
Emitted when the gradient ramp is changed by a user.
bool byX(QPointF p1, QPointF p2)
QColor color2() const
Returns the gradient end color.
static QString defaultBaseDir()
void setRamp(const QgsGradientColorRamp &ramp)
Sets the color ramp to show in the dialog.
A generic dialog with layout and button box.
void convertToDiscrete(bool discrete)
Converts a gradient with existing color stops to or from discrete interpolation.
QMap< QString, QString > QgsStringMap
QgsGradientColorRampDialog(const QgsGradientColorRamp &ramp, QWidget *parent=nullptr)
Constructor for QgsGradientColorRampDialog.
void saveGeometry(QWidget *widget, const QString &keyName)
Save the wigget geometry into settings.
bool restoreGeometry(QWidget *widget, const QString &keyName)
Restore the wigget geometry from settings.
void deleteSelectedStop()
Deletes the current selected stop.
void setValue(const QString &key, const QVariant &value, const QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
QgsStringMap info() const
Returns any additional info attached to the gradient ramp (e.g., authorship notes) ...
double offset
Relative positional offset, between 0 and 1.
~QgsGradientColorRampDialog() override
bool isDiscrete() const
Returns true if the gradient is using discrete interpolation, rather than smoothly interpolating betw...
QgsGradientStopsList stops() const
Returns the list of intermediate gradient stops for the ramp.
void selectedStopChanged(const QgsGradientStop &stop)
Emitted when the current selected stop changes.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), const Section section=NoSection) const
Returns the value for setting key.
QVBoxLayout * layout()
Returns the central layout. Widgets added to it must have this dialog as parent.
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
QColor color(double value) const override
Returns the color corresponding to a specified value.
void changed()
Emitted when the dialog settings change.
Gradient color ramp, which smoothly interpolates between two colors and also supports optional extra ...
QColor color1() const
Returns the gradient start color.
QgsGradientColorRamp ramp() const
Returns a color ramp representing the current settings from the dialog.
void setColor1(const QColor &color)
Sets the start color for the gradient ramp.
QColor color
Gradient color at stop.
int count() const override
Returns number of defined colors, or -1 if undefined.