QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgslimitedrandomcolorrampdialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslimitedrandomcolorrampdialog.h
3  ---------------------
4  begin : December 2009
5  copyright : (C) 2009 by Martin Dobias
6  email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGsLIMITEDRANDOMCOLORRAMPDIALOG_H
17 #define QGsLIMITEDRANDOMCOLORRAMPDIALOG_H
18 
19 #include <QDialog>
20 #include "qgis_sip.h"
21 #include "qgspanelwidget.h"
22 #include "qgscolorramp.h"
23 #include "ui_qgslimitedrandomcolorrampwidgetbase.h"
24 #include "qgis_gui.h"
25 
26 class QDialogButtonBox;
27 
34 class GUI_EXPORT QgsLimitedRandomColorRampWidget : public QgsPanelWidget, private Ui::QgsLimitedRandomColorRampWidgetBase
35 {
36  Q_OBJECT
37  Q_PROPERTY( QgsLimitedRandomColorRamp ramp READ ramp WRITE setRamp )
38 
39  public:
40 
46  QgsLimitedRandomColorRampWidget( const QgsLimitedRandomColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
47 
52  QgsLimitedRandomColorRamp ramp() const { return mRamp; }
53 
59  void setRamp( const QgsLimitedRandomColorRamp &ramp );
60 
61  signals:
62 
64  void changed();
65 
66  public slots:
67 
69  void setCount( int val );
71  void setHue1( int val );
73  void setHue2( int val );
75  void setSat1( int val );
77  void setSat2( int val );
79  void setVal1( int val );
81  void setVal2( int val );
82 
83  private:
84 
85  void updatePreview();
86  void updateUi();
87 
89 };
90 
91 
98 class GUI_EXPORT QgsLimitedRandomColorRampDialog : public QDialog
99 {
100  Q_OBJECT
101  Q_PROPERTY( QgsLimitedRandomColorRamp ramp READ ramp WRITE setRamp )
102 
103  public:
104 
110  QgsLimitedRandomColorRampDialog( const QgsLimitedRandomColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
111 
116  QgsLimitedRandomColorRamp ramp() const { return mWidget->ramp(); }
117 
123  void setRamp( const QgsLimitedRandomColorRamp &ramp ) { mWidget->setRamp( ramp ); }
124 
129  QDialogButtonBox *buttonBox() const;
130 
131  signals:
132 
134  void changed();
135 
136  private:
137 
138  QgsLimitedRandomColorRampWidget *mWidget = nullptr;
139  QDialogButtonBox *mButtonBox = nullptr;
140 
141  private slots:
142 
143  void showHelp();
144 
145 };
146 
147 #endif
A dialog which allows users to modify the properties of a QgsLimitedRandomColorRamp.
void setRamp(const QgsLimitedRandomColorRamp &ramp)
Sets the color ramp to show in the dialog.
void changed()
Emitted when the dialog settings change.
QgsLimitedRandomColorRamp ramp() const
Returns a color ramp representing the current settings from the dialog.
A widget which allows users to modify the properties of a QgsLimitedRandomColorRamp.
void changed()
Emitted when the dialog settings change.
QgsLimitedRandomColorRamp ramp() const
Returns a color ramp representing the current settings from the dialog.
Constrained random color ramp, which returns random colors based on preset parameters.
Definition: qgscolorramp.h:303
Base class for any widget that can be shown as a inline panel.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53