22 #include <QColorDialog> 38 for (
int i = 1; i <= nBands; ++i )
55 int nColors = mTreeWidget->topLevelItemCount();
58 for (
int i = 0; i < nColors; ++i )
60 colorArray[i] = mTreeWidget->topLevelItem( i )->background( 1 ).color();
61 QString label = mTreeWidget->topLevelItem( i )->text( 2 );
64 if ( i >= labels.
size() ) labels.
resize( i + 1 );
68 int bandNumber = mBandComboBox->itemData( mBandComboBox->currentIndex() ).toInt();
72 void QgsPalettedRendererWidget::on_mTreeWidget_itemDoubleClicked(
QTreeWidgetItem * item,
int column )
74 if ( column == 1 && item )
76 item->
setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
84 else if ( column == 2 && item )
86 item->
setFlags( Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable );
90 void QgsPalettedRendererWidget::on_mTreeWidget_itemChanged(
QTreeWidgetItem * item,
int column )
92 if ( column == 2 && item )
106 for (
int i = 0; i < nColors; ++i )
124 for ( ; itemIt != itemList.
constEnd(); ++itemIt )
129 item->
setText( 2, itemIt->label );
virtual int bandCount() const =0
Get number of bands.
A rectangle specified with double values.
Renderer for paletted raster images.
virtual QList< QgsColorRampShader::ColorRampItem > colorTable(int bandNo) const
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
QgsRasterRenderer * renderer() const
int nColors() const
Returns number of colors.
const QColor & color() const
QString number(int n, int base)
QString label(int idx) const
Return optional category label.
QColor * colors() const
Returns copy of color array (caller takes ownership)
static QColor getColor(const QColor &initialColor, QWidget *parent, const QString &title=QString(), const bool allowAlpha=false)
Return a color selection from a color dialog.
void setText(int column, const QString &text)
QgsRasterDataProvider * dataProvider()
Returns the data provider.
const_iterator constEnd() const
const_iterator constBegin() const
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Raster renderer pipe that applies colors to a raster.
Base class for raster data providers.