QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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.h"
21 #include "qgspanelwidget.h"
22 #include "qgscolorramp.h"
23 #include "ui_qgspresetcolorrampwidgetbase.h"
24 #include "qgis_gui.h"
25 
32 class GUI_EXPORT QgsPresetColorRampWidget : public QgsPanelWidget, private Ui::QgsPresetColorRampWidgetBase
33 {
34  Q_OBJECT
35  Q_PROPERTY( QgsPresetSchemeColorRamp ramp READ ramp WRITE setRamp )
36 
37  public:
38 
44  QgsPresetColorRampWidget( const QgsPresetSchemeColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
45 
50  QgsPresetSchemeColorRamp ramp() const;
51 
57  void setRamp( const QgsPresetSchemeColorRamp &ramp );
58 
59  signals:
60 
62  void changed();
63 
64  private slots:
65  void setColors();
66 
67  void mButtonAddColor_clicked();
68 
69  void newColorChanged( const QColor &color );
70  void schemeChanged();
71 
72  private:
73 
74  void updatePreview();
76 };
77 
84 class GUI_EXPORT QgsPresetColorRampDialog : public QDialog
85 {
86  Q_OBJECT
87  Q_PROPERTY( QgsPresetSchemeColorRamp ramp READ ramp WRITE setRamp )
88 
89  public:
90 
96  QgsPresetColorRampDialog( const QgsPresetSchemeColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
97 
102  QgsPresetSchemeColorRamp ramp() const { return mWidget->ramp(); }
103 
109  void setRamp( const QgsPresetSchemeColorRamp &ramp ) { mWidget->setRamp( ramp ); }
110 
111  signals:
112 
114  void changed();
115 
116  private:
117 
118  QgsPresetColorRampWidget *mWidget = nullptr;
119 
120  private slots:
121 
122  void showHelp();
123 
124 };
125 
126 #endif //QGSPRESETCOLORRAMPDIALOG_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
A widget which allows users to modify the properties of a QgsPresetSchemeColorRamp.
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
QgsPresetSchemeColorRamp ramp() const
Returns a color ramp representing the current settings from the dialog.
void setRamp(const QgsPresetSchemeColorRamp &ramp)
Sets the color ramp to show in the dialog.