QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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
QgsPresetColorRampDialog
Definition: qgspresetcolorrampdialog.h:86
QgsPresetSchemeColorRamp
A scheme based color ramp consisting of a list of predefined colors.
Definition: qgscolorramp.h:471
QgsPresetColorRampWidget
Definition: qgspresetcolorrampdialog.h:34
QgsPresetColorRampDialog::ramp
QgsPresetSchemeColorRamp ramp() const
Returns a color ramp representing the current settings from the dialog.
Definition: qgspresetcolorrampdialog.h:104
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:29
qgscolorramp.h
QgsPresetColorRampDialog::setRamp
void setRamp(const QgsPresetSchemeColorRamp &ramp)
Sets the color ramp to show in the dialog.
Definition: qgspresetcolorrampdialog.h:111
qgis_sip.h
qgspanelwidget.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53