22 #include <QColorDialog> 38 for (
int i = 1; i <= nBands; ++i )
54 int nColors = mTreeWidget->topLevelItemCount();
57 for (
int i = 0; i < nColors; ++i )
59 colorArray[i] = mTreeWidget->topLevelItem( i )->background( 1 ).color();
60 QString label = mTreeWidget->topLevelItem( i )->text( 2 );
63 if ( i >= labels.
size() ) labels.
resize( i + 1 );
67 int bandNumber = mBandComboBox->itemData( mBandComboBox->currentIndex() ).toInt();
71 void QgsPalettedRendererWidget::on_mTreeWidget_itemDoubleClicked(
QTreeWidgetItem * item,
int column )
73 if ( column == 1 && item )
75 item->
setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
82 else if ( column == 2 && item )
84 item->
setFlags( Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable );
96 for (
int i = 0; i < nColors; ++i )
114 for ( ; itemIt != itemList.
constEnd(); ++itemIt )
119 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
Raster renderer pipe that applies colors to a raster.
Base class for raster data providers.