Skip to content
Permalink
Browse files

added groups support to symbolslist widget

  • Loading branch information
tecoholic committed Aug 4, 2012
1 parent d5f0da5 commit fe50e11c8c40124e39ce9ea828839bcb9b909271
@@ -49,6 +49,13 @@ QgsSymbolsListWidget::QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* sty
btnAdvanced->show();
}

// Populate the symbol groups
QStringList groups = style->groupNames();
foreach ( QString group, groups )
{
groupsCombo->addItem( group );
}

QStandardItemModel* model = new QStandardItemModel( viewSymbols );
viewSymbols->setModel( model );
connect( viewSymbols->selectionModel(), SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), this, SLOT( setSymbolFromStyle( const QModelIndex & ) ) );
@@ -91,11 +98,9 @@ QgsSymbolsListWidget::QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* sty

// Set symbol color in btnColor
updateSymbolColor();

}


void QgsSymbolsListWidget::populateSymbolView()
void QgsSymbolsListWidget::populateSymbolView( QStringList names )
{
QSize previewSize = viewSymbols->iconSize();
QPixmap p( previewSize );
@@ -108,7 +113,11 @@ void QgsSymbolsListWidget::populateSymbolView()
}
model->clear();

QStringList names = mStyle->symbolNames();
if ( names.isEmpty() )
{
names = mStyle->symbolNames();
}

for ( int i = 0; i < names.count(); i++ )
{
QgsSymbolV2* s = mStyle->symbol( names[i] );
@@ -285,3 +294,15 @@ void QgsSymbolsListWidget::setSymbolFromStyle( const QModelIndex & index )
emit changed();
}

void QgsSymbolsListWidget::on_groupsCombo_currentIndexChanged( const QString &text )
{
int groupid = mStyle->groupId( text );
QStringList symbols = mStyle->symbolsOfGroup( SymbolEntity, groupid );
populateSymbolView( symbols );
}

void QgsSymbolsListWidget::on_groupsCombo_editTextChanged( const QString &text )
{
QStringList symbols = mStyle->findSymbols( text );
populateSymbolView( symbols );
}
@@ -42,6 +42,9 @@ class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::SymbolsListW
void on_mSymbolUnitComboBox_currentIndexChanged( const QString & text );
void on_mTransparencySlider_valueChanged( int value );

void on_groupsCombo_currentIndexChanged( const QString &text );
void on_groupsCombo_editTextChanged( const QString &text );

void openStyleManager();

signals:
@@ -51,7 +54,7 @@ class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::SymbolsListW
QgsSymbolV2* mSymbol;
QgsStyleV2* mStyle;

void populateSymbolView();
void populateSymbolView( QStringList symbols = QStringList() );
void updateSymbolColor();
void updateSymbolInfo();

@@ -250,6 +250,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="groupsCombo">
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">

0 comments on commit fe50e11

Please sign in to comment.
You can’t perform that action at this time.