Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #4520 from nyalldawson/raster_combo_box
QgsRasterBandComboBox
- Loading branch information
Showing
31 changed files
with
785 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/raster/qgsrasterbandcombobox.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsRasterBandComboBox : QComboBox | ||
{ | ||
%Docstring | ||
A combobox widget which displays the bands present in a raster layer. | ||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsrasterbandcombobox.h" | ||
%End | ||
public: | ||
|
||
QgsRasterBandComboBox( QWidget *parent /TransferThis/ = 0 ); | ||
%Docstring | ||
Constructor for QgsRasterBandComboBox. | ||
%End | ||
|
||
QgsRasterLayer *layer() const; | ||
%Docstring | ||
Returns the layer currently associated with the combobox. | ||
.. seealso:: setLayer() | ||
:rtype: QgsRasterLayer | ||
%End | ||
|
||
int currentBand() const; | ||
%Docstring | ||
Returns the current band number selected in the combobox, or -1 | ||
if no band is selected. | ||
.. seealso:: setBand() | ||
:rtype: int | ||
%End | ||
|
||
bool isShowingNotSetOption() const; | ||
%Docstring | ||
Returns true if the combo box is showing the "not set" option. | ||
.. seealso:: setShowNotSetOption() | ||
:rtype: bool | ||
%End | ||
|
||
void setShowNotSetOption( bool show, const QString &string = QString() ); | ||
%Docstring | ||
Sets whether the combo box should show the "not set" option. | ||
Optionally the built in "not set" text can be overridden by specifying | ||
a ``string``. | ||
.. seealso:: setShowNotSetOption() | ||
%End | ||
|
||
public slots: | ||
|
||
void setLayer( QgsMapLayer *layer ); | ||
%Docstring | ||
Sets the raster ``layer`` for which the bands are listed in the combobox. If no layer is set | ||
or a non-raster layer is set then the combobox will be empty. | ||
.. seealso:: layer() | ||
%End | ||
|
||
void setBand( int band ); | ||
%Docstring | ||
Sets the current ``band`` number selected in the combobox. | ||
.. seealso:: band() | ||
%End | ||
|
||
signals: | ||
|
||
void bandChanged( int band ); | ||
%Docstring | ||
This signal is emitted when the currently selected band changes. | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/raster/qgsrasterbandcombobox.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/*************************************************************************** | ||
qgsrasterbandcomboboxplugin.cpp | ||
-------------------------------------- | ||
Date : 09.05.2017 | ||
Copyright : (C) 2017 Nyall Dawson | ||
Email : nyall.dawson@gmail.com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgiscustomwidgets.h" | ||
#include "qgsrasterbandcombobox.h" | ||
#include "qgsrasterbandcomboboxplugin.h" | ||
|
||
|
||
QgsRasterBandComboBoxPlugin::QgsRasterBandComboBoxPlugin( QObject *parent ) | ||
: QObject( parent ) | ||
, mInitialized( false ) | ||
{ | ||
} | ||
|
||
|
||
QString QgsRasterBandComboBoxPlugin::name() const | ||
{ | ||
return "QgsRasterBandComboBox"; | ||
} | ||
|
||
QString QgsRasterBandComboBoxPlugin::group() const | ||
{ | ||
return QgisCustomWidgets::groupName(); | ||
} | ||
|
||
QString QgsRasterBandComboBoxPlugin::includeFile() const | ||
{ | ||
return "qgsrasterbandcombobox.h"; | ||
} | ||
|
||
QIcon QgsRasterBandComboBoxPlugin::icon() const | ||
{ | ||
return QIcon( ":/images/icons/qgis-icon-60x60.png" ); | ||
} | ||
|
||
bool QgsRasterBandComboBoxPlugin::isContainer() const | ||
{ | ||
return false; | ||
} | ||
|
||
QWidget *QgsRasterBandComboBoxPlugin::createWidget( QWidget *parent ) | ||
{ | ||
return new QgsRasterBandComboBox( parent ); | ||
} | ||
|
||
bool QgsRasterBandComboBoxPlugin::isInitialized() const | ||
{ | ||
return mInitialized; | ||
} | ||
|
||
void QgsRasterBandComboBoxPlugin::initialize( QDesignerFormEditorInterface *core ) | ||
{ | ||
Q_UNUSED( core ); | ||
if ( mInitialized ) | ||
return; | ||
mInitialized = true; | ||
} | ||
|
||
|
||
QString QgsRasterBandComboBoxPlugin::toolTip() const | ||
{ | ||
return tr( "A combo box to list the bands from a raster layer" ); | ||
} | ||
|
||
QString QgsRasterBandComboBoxPlugin::whatsThis() const | ||
{ | ||
return tr( "A combo box to list the bands from a raster layer." ); | ||
} | ||
|
||
QString QgsRasterBandComboBoxPlugin::domXml() const | ||
{ | ||
return QString( "<ui language=\"c++\">\n" | ||
" <widget class=\"%1\" name=\"mRasterBandComboBox\">\n" | ||
" <property name=\"geometry\">\n" | ||
" <rect>\n" | ||
" <x>0</x>\n" | ||
" <y>0</y>\n" | ||
" <width>160</width>\n" | ||
" <height>27</height>\n" | ||
" </rect>\n" | ||
" </property>\n" | ||
" </widget>\n" | ||
"</ui>\n" ) | ||
.arg( name() ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/*************************************************************************** | ||
qgsrasterbandcomboboxplugin.h | ||
-------------------------------------- | ||
Date : 09.05.2017 | ||
Copyright : (C) 2017 Nyall Dawson | ||
Email : nyall.dawson@gmail.com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSRASTERBANDCOMBOBOXPLUGIN_H | ||
#define QGSRASTERBANDCOMBOBOXPLUGIN_H | ||
|
||
|
||
#include <QtGlobal> | ||
#include <QtUiPlugin/QDesignerCustomWidgetInterface> | ||
#include <QtUiPlugin/QDesignerExportWidget> | ||
#include "qgis_customwidgets.h" | ||
|
||
|
||
class CUSTOMWIDGETS_EXPORT QgsRasterBandComboBoxPlugin : public QObject, public QDesignerCustomWidgetInterface | ||
{ | ||
Q_OBJECT | ||
Q_INTERFACES( QDesignerCustomWidgetInterface ) | ||
|
||
public: | ||
explicit QgsRasterBandComboBoxPlugin( QObject *parent = 0 ); | ||
|
||
private: | ||
bool mInitialized; | ||
|
||
// QDesignerCustomWidgetInterface interface | ||
public: | ||
QString name() const override; | ||
QString group() const override; | ||
QString includeFile() const override; | ||
QIcon icon() const override; | ||
bool isContainer() const override; | ||
QWidget *createWidget( QWidget *parent ) override; | ||
bool isInitialized() const override; | ||
void initialize( QDesignerFormEditorInterface *core ) override; | ||
QString toolTip() const override; | ||
QString whatsThis() const override; | ||
QString domXml() const override; | ||
}; | ||
#endif // QGSRASTERBANDCOMBOBOXPLUGIN_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.