QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsrasterbandcombobox.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterbandcombobox.h
3  -----------------------
4  begin : May 2017
5  copyright : (C) 2017 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 QGSRASTERBANDCOMBOBOX_H
17 #define QGSRASTERBANDCOMBOBOX_H
18 
19 #include "qgis_gui.h"
20 #include "qgis_sip.h"
21 #include "raster/qgsrasterlayer.h"
22 #include <QComboBox>
23 
24 class QgsMapLayer;
26 
33 class GUI_EXPORT QgsRasterBandComboBox : public QComboBox
34 {
35  Q_OBJECT
36  Q_PROPERTY( int band READ currentBand WRITE setBand NOTIFY bandChanged )
37 
38  public:
39 
43  QgsRasterBandComboBox( QWidget *parent SIP_TRANSFERTHIS = nullptr );
44 
49  QgsRasterLayer *layer() const;
50 
56  int currentBand() const;
57 
62  bool isShowingNotSetOption() const;
63 
70  void setShowNotSetOption( bool show, const QString &string = QString() );
71 
75  static QString displayBandName( QgsRasterDataProvider *provider, int band );
76 
77  public slots:
78 
84  void setLayer( QgsMapLayer *layer );
85 
90  void setBand( int band );
91 
92  signals:
93 
97  void bandChanged( int band );
98 
99  private:
100 
101  QPointer< QgsRasterLayer > mLayer;
102 
103  bool mShowNotSet = false;
104  QString mNotSetString;
105  int mPrevBand = -1;
106 
107 
108 
109 };
110 
111 #endif // QGSRASTERBANDCOMBOBOX_H
qgsrasterlayer.h
QgsRasterBandComboBox
Definition: qgsrasterbandcombobox.h:33
qgis_sip.h
QgsRasterLayer
Definition: qgsrasterlayer.h:72
QgsMapLayer
Definition: qgsmaplayer.h:81
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsRasterDataProvider
Definition: qgsrasterdataprovider.h:88