QGIS API Documentation  3.13.0-Master (5a3b1ced84)
qgscolorbrewercolorrampdialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscolorbrewercolorrampdialog.h
3  ---------------------
4  begin : November 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 QGSCOLORBREWERCOLORRAMPDIALOG_H
17 #define QGSCOLORBREWERCOLORRAMPDIALOG_H
18 
19 #include <QDialog>
20 #include "qgspanelwidget.h"
21 #include "qgscolorramp.h"
22 #include "ui_qgscolorbrewercolorrampwidgetbase.h"
23 #include "qgis_gui.h"
24 #include "qgis_sip.h"
25 
27 class QDialogButtonBox;
28 
35 class GUI_EXPORT QgsColorBrewerColorRampWidget : public QgsPanelWidget, private Ui::QgsColorBrewerColorRampWidgetBase
36 {
37  Q_OBJECT
38  Q_PROPERTY( QgsColorBrewerColorRamp ramp READ ramp WRITE setRamp )
39 
40  public:
41 
47  QgsColorBrewerColorRampWidget( const QgsColorBrewerColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
48 
53  QgsColorBrewerColorRamp ramp() const { return mRamp; }
54 
60  void setRamp( const QgsColorBrewerColorRamp &ramp );
61 
62  signals:
63 
65  void changed();
66 
67  private slots:
68  void setSchemeName();
69  void setColors();
70  void populateVariants();
71 
72  private:
73 
74  void updatePreview();
75  void updateUi();
76 
78 };
79 
86 class GUI_EXPORT QgsColorBrewerColorRampDialog : public QDialog
87 {
88  Q_OBJECT
89  Q_PROPERTY( QgsColorBrewerColorRamp ramp READ ramp WRITE setRamp )
90 
91  public:
92 
98  QgsColorBrewerColorRampDialog( const QgsColorBrewerColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
99 
104  QgsColorBrewerColorRamp ramp() const { return mWidget->ramp(); }
105 
111  void setRamp( const QgsColorBrewerColorRamp &ramp ) { mWidget->setRamp( ramp ); }
112 
117  QDialogButtonBox *buttonBox() const;
118 
119  signals:
120 
122  void changed();
123 
124  private:
125 
126  QgsColorBrewerColorRampWidget *mWidget = nullptr;
127  QDialogButtonBox *mButtonBox = nullptr;
128 
129  private slots:
130 
131  void showHelp();
132 
133 };
134 
135 #endif
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
Base class for any widget that can be shown as a inline panel.
A dialog which allows users to modify the properties of a QgsColorBrewerColorRamp.
QgsColorBrewerColorRamp ramp() const
Returns a color ramp representing the current settings from the dialog.
QgsColorBrewerColorRamp ramp() const
Returns a color ramp representing the current settings from the dialog.
void setRamp(const QgsColorBrewerColorRamp &ramp)
Sets the color ramp to show in the dialog.
A widget which allows users to modify the properties of a QgsColorBrewerColorRamp.
Color ramp utilising "Color Brewer" preset color schemes.
Definition: qgscolorramp.h:535