17#include "moc_qgslimitedrandomcolorrampdialog.cpp"
23#include <QColorDialog>
24#include <QDialogButtonBox>
32 spinCount->setClearValue( 10 );
33 spinHue1->setClearValue( 0 );
34 spinHue2->setClearValue( 359 );
35 spinSat1->setClearValue( 100 );
36 spinSat2->setClearValue( 240 );
37 spinVal1->setClearValue( 200 );
38 spinVal2->setClearValue( 240 );
58void QgsLimitedRandomColorRampWidget::updatePreview()
62 const QSize size( 300, 40 );
66void QgsLimitedRandomColorRampWidget::updateUi()
68 spinCount->setValue( mRamp.
count() );
69 spinHue1->setValue( mRamp.
hueMin() );
70 spinHue2->setValue( mRamp.
hueMax() );
71 spinSat1->setValue( mRamp.
satMin() );
72 spinSat2->setValue( mRamp.
satMax() );
73 spinVal1->setValue( mRamp.
valMin() );
74 spinVal2->setValue( mRamp.
valMax() );
130 QVBoxLayout *vLayout =
new QVBoxLayout();
135 vLayout->addWidget( mWidget );
136 mButtonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok, Qt::Horizontal );
137 connect( mButtonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
138 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
139 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsLimitedRandomColorRampDialog::showHelp );
140 vLayout->addWidget( mButtonBox );
141 setLayout( vLayout );
142 setWindowTitle( tr(
"Random Color Ramp" ) );
151void QgsLimitedRandomColorRampDialog::showHelp()
153 QgsHelp::openHelp( QStringLiteral(
"style_library/style_manager.html#setting-a-color-ramp" ) );
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
QDialogButtonBox * buttonBox() const
Returns a reference to the dialog's button box.
QgsLimitedRandomColorRamp ramp
void changed()
Emitted when the dialog settings change.
QgsLimitedRandomColorRampDialog(const QgsLimitedRandomColorRamp &ramp, QWidget *parent=nullptr)
Constructor for QgsLimitedRandomColorRampDialog.
Constrained random color ramp, which returns random colors based on preset parameters.
void updateColors()
Must be called after changing the properties of the color ramp to regenerate the list of random color...
void setSatMin(int val)
Sets the minimum saturation for generated colors.
int count() const override
Returns number of defined colors, or -1 if undefined.
void setHueMin(int val)
Sets the minimum hue for generated colors.
void setSatMax(int val)
Sets the maximum saturation for generated colors.
int valMax() const
Returns the maximum value for generated colors.
int satMax() const
Returns the maximum saturation for generated colors.
void setHueMax(int val)
Sets the maximum hue for generated colors.
void setCount(int val)
Sets the number of colors contained in the ramp.
int hueMax() const
Returns the maximum hue for generated colors.
int hueMin() const
Returns the minimum hue for generated colors.
void setValMax(int val)
Sets the maximum value for generated colors.
int valMin() const
Returns the minimum value for generated colors.
void setValMin(int val)
Sets the minimum value for generated colors.
int satMin() const
Returns the minimum saturation for generated colors.
static QPixmap colorRampPreviewPixmap(QgsColorRamp *ramp, QSize size, int padding=0, Qt::Orientation direction=Qt::Horizontal, bool flipDirection=false, bool drawTransparentBackground=true)
Returns a pixmap preview for a color ramp.