QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
22 #include <QColorDialog>
23 #include <QDialogButtonBox>
31 spinCount->setClearValue( 10 );
32 spinHue1->setClearValue( 0 );
33 spinHue2->setClearValue( 359 );
34 spinSat1->setClearValue( 100 );
35 spinSat2->setClearValue( 240 );
36 spinVal1->setClearValue( 200 );
37 spinVal2->setClearValue( 240 );
57 void QgsLimitedRandomColorRampWidget::updatePreview()
61 const QSize size( 300, 40 );
65 void QgsLimitedRandomColorRampWidget::updateUi()
67 spinCount->setValue( mRamp.
count() );
68 spinHue1->setValue( mRamp.
hueMin() );
69 spinHue2->setValue( mRamp.
hueMax() );
70 spinSat1->setValue( mRamp.
satMin() );
71 spinSat2->setValue( mRamp.
satMax() );
72 spinVal1->setValue( mRamp.
valMin() );
73 spinVal2->setValue( mRamp.
valMax() );
129 QVBoxLayout *vLayout =
new QVBoxLayout();
134 vLayout->addWidget( mWidget );
135 mButtonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok, Qt::Horizontal );
136 connect( mButtonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
137 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
138 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsLimitedRandomColorRampDialog::showHelp );
139 vLayout->addWidget( mButtonBox );
140 setLayout( vLayout );
141 setWindowTitle( tr(
"Random Color Ramp" ) );
150 void QgsLimitedRandomColorRampDialog::showHelp()
152 QgsHelp::openHelp( QStringLiteral(
"style_library/style_manager.html#setting-a-color-ramp" ) );
int hueMin() const
Returns the minimum hue for generated colors.
void changed()
Emitted when the dialog settings change.
QgsLimitedRandomColorRamp ramp
void setSatMax(int val)
Sets the maximum saturation for generated colors.
void setValMin(int val)
Sets the minimum value for generated colors.
Constrained random color ramp, which returns random colors based on preset parameters.
int satMax() const
Returns the maximum saturation for generated colors.
void setSatMin(int val)
Sets the minimum saturation for generated colors.
QDialogButtonBox * buttonBox() const
Returns a reference to the dialog's button box.
void setHueMax(int val)
Sets the maximum hue for generated colors.
void updateColors()
Must be called after changing the properties of the color ramp to regenerate the list of random color...
int valMax() const
Returns the maximum 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.
QgsLimitedRandomColorRampDialog(const QgsLimitedRandomColorRamp &ramp, QWidget *parent=nullptr)
Constructor for QgsLimitedRandomColorRampDialog.
void setCount(int val)
Sets the number of colors contained in the ramp.
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
int hueMax() const
Returns the maximum hue for generated colors.
void setHueMin(int val)
Sets 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.
int count() const override
Returns number of defined colors, or -1 if undefined.