21 #include <QColorDialog>
37 for (
int i = 1; i <= nBands; ++i )
53 int nColors = mTreeWidget->topLevelItemCount();
54 QColor* colorArray =
new QColor[nColors];
55 for (
int i = 0; i < nColors; ++i )
57 colorArray[i] = mTreeWidget->topLevelItem( i )->background( 1 ).color();
59 int bandNumber = mBandComboBox->itemData( mBandComboBox->currentIndex() ).toInt();
65 if ( column == 1 && item )
67 QColor c = QColorDialog::getColor( item->background( column ).color() );
70 item->setBackground( column, QBrush( c ) );
82 QColor* colors = pr->
colors();
83 for (
int i = 0; i < nColors; ++i )
85 QTreeWidgetItem* item =
new QTreeWidgetItem( mTreeWidget );
86 item->setText( 0, QString::number( i ) );
87 item->setBackground( 1, QBrush( colors[i] ) );
97 QList<QgsColorRampShader::ColorRampItem> itemList = provider->
colorTable( mBandComboBox->itemData( mBandComboBox->currentIndex() ).toInt() );
98 QList<QgsColorRampShader::ColorRampItem>::const_iterator itemIt = itemList.constBegin();
100 for ( ; itemIt != itemList.constEnd(); ++itemIt )
102 QTreeWidgetItem* item =
new QTreeWidgetItem( mTreeWidget );
103 item->setText( 0, QString::number( index ) );
104 item->setBackground( 1, QBrush( itemIt->color ) );
virtual int bandCount() const =0
Get number of bands.
A rectangle specified with double values.
Renderer for paletted raster images.
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
QgsRasterRenderer * renderer() const
int nColors() const
Returns number of colors.
QgsRasterDataProvider * dataProvider()
Returns the data provider.
virtual QList< QgsColorRampShader::ColorRampItem > colorTable(int bandNo) const
Raster renderer pipe that applies colors to a raster.
QColor * colors() const
Returns copy of color array (caller takes ownership)
Base class for raster data providers.