22 #include <QColorDialog> 23 #include <QDialogButtonBox> 50 void QgsLimitedRandomColorRampWidget::updatePreview()
54 QSize size( 300, 40 );
58 void QgsLimitedRandomColorRampWidget::updateUi()
60 spinCount->setValue( mRamp.
count() );
61 spinHue1->setValue( mRamp.
hueMin() );
62 spinHue2->setValue( mRamp.
hueMax() );
63 spinSat1->setValue( mRamp.
satMin() );
64 spinSat2->setValue( mRamp.
satMax() );
65 spinVal1->setValue( mRamp.
valMin() );
66 spinVal2->setValue( mRamp.
valMax() );
122 QVBoxLayout *vLayout =
new QVBoxLayout();
124 vLayout->addWidget( mWidget );
125 QDialogButtonBox *bbox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok, Qt::Horizontal );
126 connect( bbox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
127 connect( bbox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
128 connect( bbox, &QDialogButtonBox::helpRequested,
this, &QgsLimitedRandomColorRampDialog::showHelp );
129 vLayout->addWidget( bbox );
130 setLayout( vLayout );
131 setWindowTitle( tr(
"Random Color Ramp" ) );
135 void QgsLimitedRandomColorRampDialog::showHelp()
137 QgsHelp::openHelp( QStringLiteral(
"working_with_vector/style_library.html#color-ramp" ) );
int satMax() const
Returns the maximum saturation for generated colors.
void setCount(int val)
Sets the number of colors contained in the ramp.
QgsLimitedRandomColorRampDialog(const QgsLimitedRandomColorRamp &ramp, QWidget *parent=nullptr)
Constructor for QgsLimitedRandomColorRampDialog.
void setHueMax(int val)
Sets the maximum hue for generated colors.
void setHueMin(int val)
Sets the minimum hue for generated colors.
int satMin() const
Returns the minimum saturation for generated colors.
int hueMin() const
Returns the minimum hue for generated colors.
Constrained random color ramp, which returns random colors based on preset parameters.
int hueMax() const
Returns the maximum hue for generated colors.
int count() const override
Returns number of defined colors, or -1 if undefined.
void setSatMax(int val)
Sets the maximum saturation for generated colors.
static QPixmap colorRampPreviewPixmap(QgsColorRamp *ramp, QSize size, int padding=0)
Returns a pixmap preview for a color ramp.
void setValMin(int val)
Sets the minimum value for generated colors.
void changed()
Emitted when the dialog settings change.
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
void setSatMin(int val)
Sets the minimum saturation for generated colors.
int valMin() const
Returns the minimum value for generated colors.
int valMax() const
Returns the maximum value for generated colors.
void updateColors()
Must be called after changing the properties of the color ramp to regenerate the list of random color...
void setValMax(int val)
Sets the maximum value for generated colors.