22#include <QColorDialog>
23#include <QDialogButtonBox>
26#include "moc_qgslimitedrandomcolorrampdialog.cpp"
28using namespace Qt::StringLiterals;
35 spinCount->setClearValue( 10 );
36 spinHue1->setClearValue( 0 );
37 spinHue2->setClearValue( 359 );
38 spinSat1->setClearValue( 100 );
39 spinSat2->setClearValue( 240 );
40 spinVal1->setClearValue( 200 );
41 spinVal2->setClearValue( 240 );
61void QgsLimitedRandomColorRampWidget::updatePreview()
65 const QSize size( 300, 40 );
69void QgsLimitedRandomColorRampWidget::updateUi()
71 spinCount->setValue( mRamp.count() );
72 spinHue1->setValue( mRamp.hueMin() );
73 spinHue2->setValue( mRamp.hueMax() );
74 spinSat1->setValue( mRamp.satMin() );
75 spinSat2->setValue( mRamp.satMax() );
76 spinVal1->setValue( mRamp.valMin() );
77 spinVal2->setValue( mRamp.valMax() );
83 mRamp.setCount( val );
90 mRamp.setHueMin( val );
97 mRamp.setHueMax( val );
104 mRamp.setSatMin( val );
111 mRamp.setSatMax( val );
118 mRamp.setValMin( val );
125 mRamp.setValMax( val );
133 QVBoxLayout *vLayout =
new QVBoxLayout();
138 vLayout->addWidget( mWidget );
139 mButtonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok, Qt::Horizontal );
140 connect( mButtonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
141 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
142 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsLimitedRandomColorRampDialog::showHelp );
143 vLayout->addWidget( mButtonBox );
144 setLayout( vLayout );
145 setWindowTitle( tr(
"Random Color Ramp" ) );
154void QgsLimitedRandomColorRampDialog::showHelp()
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.