QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
qgspresetcolorrampdialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspresetcolorrampdialog.h
3  ---------------------
4  begin : September 2016
5  copyright : (C) 2016 by Nyall Dawson
6  email : nyall dot dawson 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 QGSPRESETCOLORRAMPDIALOG_H
17 #define QGSPRESETCOLORRAMPDIALOG_H
18 
19 #include <QDialog>
20 #include "qgis_sip.h"
21 #include "qgspanelwidget.h"
22 #include "qgscolorramp.h"
23 #include "ui_qgspresetcolorrampwidgetbase.h"
24 #include "qgis_gui.h"
25 
26 class QDialogButtonBox;
27 
34 class GUI_EXPORT QgsPresetColorRampWidget : public QgsPanelWidget, private Ui::QgsPresetColorRampWidgetBase
35 {
36  Q_OBJECT
37  Q_PROPERTY( QgsPresetSchemeColorRamp ramp READ ramp WRITE setRamp )
38 
39  public:
40 
46  QgsPresetColorRampWidget( const QgsPresetSchemeColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
47 
52  QgsPresetSchemeColorRamp ramp() const;
53 
59  void setRamp( const QgsPresetSchemeColorRamp &ramp );
60 
61  signals:
62 
64  void changed();
65 
66  private slots:
67  void setColors();
68 
69  void mButtonAddColor_clicked();
70 
71  void newColorChanged( const QColor &color );
72  void schemeChanged();
73 
74  private:
75 
76  void updatePreview();
78 };
79 
86 class GUI_EXPORT QgsPresetColorRampDialog : public QDialog
87 {
88  Q_OBJECT
89  Q_PROPERTY( QgsPresetSchemeColorRamp ramp READ ramp WRITE setRamp )
90 
91  public:
92 
98  QgsPresetColorRampDialog( const QgsPresetSchemeColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
99 
104  QgsPresetSchemeColorRamp ramp() const { return mWidget->ramp(); }
105 
111  void setRamp( const QgsPresetSchemeColorRamp &ramp ) { mWidget->setRamp( ramp ); }
112 
117  QDialogButtonBox *buttonBox() const;
118 
119  signals:
120 
122  void changed();
123 
124  private:
125 
126  QgsPresetColorRampWidget *mWidget = nullptr;
127  QDialogButtonBox *mButtonBox = nullptr;
128 
129  private slots:
130 
131  void showHelp();
132 
133 };
134 
135 #endif //QGSPRESETCOLORRAMPDIALOG_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
A widget which allows users to modify the properties of a QgsPresetSchemeColorRamp.
QgsPresetSchemeColorRamp ramp() const
Returns a color ramp representing the current settings from the dialog.
Base class for any widget that can be shown as a inline panel.
A dialog which allows users to modify the properties of a QgsPresetSchemeColorRamp.
A scheme based color ramp consisting of a list of predefined colors.
Definition: qgscolorramp.h:471
void setRamp(const QgsPresetSchemeColorRamp &ramp)
Sets the color ramp to show in the dialog.