QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
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 mButtonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok, Qt::Horizontal );
126 connect( mButtonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
127 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
128 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsLimitedRandomColorRampDialog::showHelp );
129 vLayout->addWidget( mButtonBox );
130 setLayout( vLayout );
131 setWindowTitle( tr(
"Random Color Ramp" ) );
140 void QgsLimitedRandomColorRampDialog::showHelp()
142 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.
static QPixmap colorRampPreviewPixmap(QgsColorRamp *ramp, QSize size, int padding=0)
Returns a pixmap preview for a color ramp.
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.
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.