QGIS API Documentation  3.2.0-Bonn (bc43194)
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.h"
25 
27 
34 class GUI_EXPORT QgsColorBrewerColorRampWidget : public QgsPanelWidget, private Ui::QgsColorBrewerColorRampWidgetBase
35 {
36  Q_OBJECT
37  Q_PROPERTY( QgsColorBrewerColorRamp ramp READ ramp WRITE setRamp )
38 
39  public:
40 
46  QgsColorBrewerColorRampWidget( const QgsColorBrewerColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
47 
52  QgsColorBrewerColorRamp ramp() const { return mRamp; }
53 
59  void setRamp( const QgsColorBrewerColorRamp &ramp );
60 
61  signals:
62 
64  void changed();
65 
66  private slots:
67  void setSchemeName();
68  void setColors();
69  void populateVariants();
70 
71  private:
72 
73  void updatePreview();
74  void updateUi();
75 
77 };
78 
85 class GUI_EXPORT QgsColorBrewerColorRampDialog : public QDialog
86 {
87  Q_OBJECT
88  Q_PROPERTY( QgsColorBrewerColorRamp ramp READ ramp WRITE setRamp )
89 
90  public:
91 
97  QgsColorBrewerColorRampDialog( const QgsColorBrewerColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
98 
103  QgsColorBrewerColorRamp ramp() const { return mWidget->ramp(); }
104 
110  void setRamp( const QgsColorBrewerColorRamp &ramp ) { mWidget->setRamp( ramp ); }
111 
112  signals:
113 
115  void changed();
116 
117  private:
118 
119  QgsColorBrewerColorRampWidget *mWidget = nullptr;
120 
121  private slots:
122 
123  void showHelp();
124 
125 };
126 
127 #endif
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
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