QGIS API Documentation  3.4.3-Madeira (2f64a3c)
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.h"
21 #include "qgspanelwidget.h"
22 #include "qgscolorramp.h"
23 #include "ui_qgslimitedrandomcolorrampwidgetbase.h"
24 #include "qgis_gui.h"
25 
32 class GUI_EXPORT QgsLimitedRandomColorRampWidget : public QgsPanelWidget, private Ui::QgsLimitedRandomColorRampWidgetBase
33 {
34  Q_OBJECT
35  Q_PROPERTY( QgsLimitedRandomColorRamp ramp READ ramp WRITE setRamp )
36 
37  public:
38 
44  QgsLimitedRandomColorRampWidget( const QgsLimitedRandomColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
45 
50  QgsLimitedRandomColorRamp ramp() const { return mRamp; }
51 
57  void setRamp( const QgsLimitedRandomColorRamp &ramp );
58 
59  signals:
60 
62  void changed();
63 
64  public slots:
65 
67  void setCount( int val );
69  void setHue1( int val );
71  void setHue2( int val );
73  void setSat1( int val );
75  void setSat2( int val );
77  void setVal1( int val );
79  void setVal2( int val );
80 
81  private:
82 
83  void updatePreview();
84  void updateUi();
85 
87 };
88 
89 
96 class GUI_EXPORT QgsLimitedRandomColorRampDialog : public QDialog
97 {
98  Q_OBJECT
99  Q_PROPERTY( QgsLimitedRandomColorRamp ramp READ ramp WRITE setRamp )
100 
101  public:
102 
108  QgsLimitedRandomColorRampDialog( const QgsLimitedRandomColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
109 
114  QgsLimitedRandomColorRamp ramp() const { return mWidget->ramp(); }
115 
121  void setRamp( const QgsLimitedRandomColorRamp &ramp ) { mWidget->setRamp( ramp ); }
122 
123  signals:
124 
126  void changed();
127 
128  private:
129 
130  QgsLimitedRandomColorRampWidget *mWidget = nullptr;
131 
132  private slots:
133 
134  void showHelp();
135 
136 };
137 
138 #endif
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
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.
Base class for any widget that can be shown as a inline panel.
A dialog which allows users to modify the properties of a QgsLimitedRandomColorRamp.
Constrained random color ramp, which returns random colors based on preset parameters.
Definition: qgscolorramp.h:283
void setRamp(const QgsLimitedRandomColorRamp &ramp)
Sets the color ramp to show in the dialog.
QgsLimitedRandomColorRamp ramp() const
Returns a color ramp representing the current settings from the dialog.