22#include <QColorDialog>
23#include <QDialogButtonBox>
25#include "moc_qgslimitedrandomcolorrampdialog.cpp"
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() );
80 mRamp.setCount( val );
87 mRamp.setHueMin( val );
94 mRamp.setHueMax( val );
101 mRamp.setSatMin( val );
108 mRamp.setSatMax( val );
115 mRamp.setValMin( val );
122 mRamp.setValMax( val );
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...
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.