void QgsUniqueValueDialog::resetColors() { QColor white; white.setRgb( 255, 255, 255 ); QList<QListWidgetItem *> selection = mClassListWidget->selectedItems(); if ( selection.size() == 0 ) selection = mClassListWidget->findItems( "", Qt::MatchContains ); for ( int i = 0; i < selection.size(); i++ ) { QListWidgetItem *item = selection[i]; if ( !item ) continue; if ( !mValues.contains( item->text() ) ) continue; QgsSymbol *symbol = mValues[ item->text()]; setSymbolColor( symbol, white ); updateEntryIcon( symbol, item ); } selectionChanged(); }
QgsSymbolV2SelectorDialog::QgsSymbolV2SelectorDialog( QgsSymbolV2* symbol, QgsStyleV2* style, const QgsVectorLayer* vl, QWidget* parent, bool embedded ) : QDialog( parent ), mAdvancedMenu( NULL ), mVectorLayer( vl ) { mStyle = style; mSymbol = symbol; setupUi( this ); btnAdvanced->hide(); // advanced button is hidden by default // can be embedded in renderer properties dialog if ( embedded ) { buttonBox->hide(); layout()->setContentsMargins( 0, 0, 0, 0 ); } connect( btnSymbolProperties, SIGNAL( clicked() ), this, SLOT( changeSymbolProperties() ) ); connect( btnStyleManager, SIGNAL( clicked() ), SLOT( openStyleManager() ) ); QStandardItemModel* model = new QStandardItemModel( viewSymbols ); viewSymbols->setModel( model ); connect( viewSymbols, SIGNAL( clicked( const QModelIndex & ) ), this, SLOT( setSymbolFromStyle( const QModelIndex & ) ) ); lblSymbolName->setText( "" ); populateSymbolView(); updateSymbolPreview(); updateSymbolInfo(); if ( mSymbol ) { // output unit mSymbolUnitComboBox->blockSignals( true ); mSymbolUnitComboBox->setCurrentIndex( mSymbol->outputUnit() ); mSymbolUnitComboBox->blockSignals( false ); mTransparencySlider->blockSignals( true ); double transparency = 1 - symbol->alpha(); mTransparencySlider->setValue( transparency * 255 ); displayTransparency( symbol->alpha() ); mTransparencySlider->blockSignals( false ); } // select correct page in stacked widget // there's a correspondence between symbol type number and page numbering => exploit it! stackedWidget->setCurrentIndex( symbol->type() ); connect( btnColor, SIGNAL( clicked() ), this, SLOT( setSymbolColor() ) ); connect( spinAngle, SIGNAL( valueChanged( double ) ), this, SLOT( setMarkerAngle( double ) ) ); connect( spinSize, SIGNAL( valueChanged( double ) ), this, SLOT( setMarkerSize( double ) ) ); connect( spinWidth, SIGNAL( valueChanged( double ) ), this, SLOT( setLineWidth( double ) ) ); connect( btnAddToStyle, SIGNAL( clicked() ), this, SLOT( addSymbolToStyle() ) ); btnSymbolProperties->setIcon( QIcon( QgsApplication::defaultThemePath() + "mActionOptions.png" ) ); btnAddToStyle->setIcon( QIcon( QgsApplication::defaultThemePath() + "symbologyAdd.png" ) ); }
void QgsUniqueValueDialog::addClass( QString value ) { QgsDebugMsg( "called." ); if ( mValues.contains( value ) ) { int i; for ( i = 0; mValues.contains( value + QString::number( i ) ); i++ ) ; value += QString::number( i ); } QgsSymbol *symbol = new QgsSymbol( mVectorLayer->geometryType(), value, value, value.isNull() ? tr( "default" ) : "" ); mValues.insert( value, symbol ); QListWidgetItem *item = new QListWidgetItem( value ); item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled ); item->setData( Qt::UserRole, value ); item->setToolTip( symbol->label() ); mClassListWidget->addItem( item ); setSymbolColor( symbol, randomColor() ); updateEntryIcon( symbol, item ); }