32 #include <QFileDialog> 33 #include <QInputDialog> 34 #include <QMessageBox> 36 #include <QStandardItemModel> 45 : QDialog( parent ), mStyle( style ), mModified( false )
49 setWindowModality( Qt::WindowModal );
53 restoreGeometry( settings.value(
"/Windows/StyleV2Manager/geometry" ).toByteArray() );
54 mSplitter->setSizes( QList<int>() << 170 << 540 );
55 mSplitter->restoreState( settings.value(
"/Windows/StyleV2Manager/splitter" ).toByteArray() );
57 tabItemType->setDocumentMode(
true );
58 searchBox->setPlaceholderText(
tr(
"Type here to filter symbols..." ) );
66 connect(
this, SIGNAL( finished(
int ) ),
this, SLOT(
onFinished() ) );
68 connect( listItems, SIGNAL( doubleClicked(
const QModelIndex & ) ),
this, SLOT(
editItem() ) );
70 connect( btnAddItem, SIGNAL( clicked() ),
this, SLOT(
addItem() ) );
71 connect( btnEditItem, SIGNAL( clicked() ),
this, SLOT(
editItem() ) );
72 connect( btnRemoveItem, SIGNAL( clicked() ),
this, SLOT(
removeItem() ) );
74 QMenu *shareMenu =
new QMenu(
tr(
"Share Menu" ),
this );
75 QAction *exportAction = shareMenu->addAction(
tr(
"Export" ) );
76 QAction *importAction = shareMenu->addAction(
tr(
"Import" ) );
77 connect( exportAction, SIGNAL( triggered() ),
this, SLOT(
exportItems() ) );
78 connect( importAction, SIGNAL( triggered() ),
this, SLOT(
importItems() ) );
79 btnShare->setMenu( shareMenu );
84 QStandardItemModel* model =
new QStandardItemModel( listItems );
85 listItems->setModel( model );
86 listItems->setSelectionMode( QAbstractItemView::ExtendedSelection );
89 connect( listItems->selectionModel(), SIGNAL( currentChanged(
const QModelIndex&,
const QModelIndex& ) ),
94 QStandardItemModel* groupModel =
new QStandardItemModel( groupTree );
95 groupTree->setModel( groupModel );
96 groupTree->setHeaderHidden(
true );
98 connect( groupTree->selectionModel(), SIGNAL( currentChanged(
const QModelIndex&,
const QModelIndex& ) ),
100 connect( groupModel, SIGNAL(
itemChanged( QStandardItem* ) ),
103 QMenu *groupMenu =
new QMenu(
tr(
"Group Actions" ),
this );
104 QAction *groupSymbols = groupMenu->addAction(
tr(
"Group Symbols" ) );
105 QAction *editSmartgroup = groupMenu->addAction(
tr(
"Edit Smart Group" ) );
106 btnManageGroups->setMenu( groupMenu );
110 connect( btnAddGroup, SIGNAL( clicked() ),
this, SLOT(
addGroup() ) );
111 connect( btnRemoveGroup, SIGNAL( clicked() ),
this, SLOT(
removeGroup() ) );
115 connect( searchBox, SIGNAL( textChanged( QString ) ),
this, SLOT(
filterSymbols( QString ) ) );
116 tagsLineEdit->installEventFilter(
this );
119 groupTree->setContextMenuPolicy( Qt::CustomContextMenu );
120 connect( groupTree, SIGNAL( customContextMenuRequested(
const QPoint& ) ),
124 listItems->setContextMenuPolicy( Qt::CustomContextMenu );
125 connect( listItems, SIGNAL( customContextMenuRequested(
const QPoint& ) ),
138 settings.setValue(
"/Windows/StyleV2Manager/geometry", saveGeometry() );
139 settings.setValue(
"/Windows/StyleV2Manager/splitter", mSplitter->saveState() );
146 int current = ( tabItemType->count() > 0 ? tabItemType->currentIndex() : 0 );
149 int markerCount = 0, lineCount = 0, fillCount = 0;
152 for (
int i = 0; i < symbolNames.count(); ++i )
165 default: Q_ASSERT( 0 &&
"unknown symbol type" );
170 cboItemType->clear();
171 cboItemType->addItem(
tr(
"Marker symbol (%1)" ).arg( markerCount ), QVariant(
QgsSymbolV2::Marker ) );
172 cboItemType->addItem(
tr(
"Line symbol (%1)" ).arg( lineCount ), QVariant(
QgsSymbolV2::Line ) );
173 cboItemType->addItem(
tr(
"Fill symbol (%1)" ).arg( fillCount ), QVariant(
QgsSymbolV2::Fill ) );
178 cboItemType->setCurrentIndex( current );
187 QStringList rampTypes;
188 rampTypes <<
tr(
"Gradient" ) <<
tr(
"Random" ) <<
tr(
"ColorBrewer" );
189 rampTypes <<
tr(
"cpt-city" );
190 QMenu* menu =
new QMenu( btnAddItem );
191 foreach ( QString rampType, rampTypes )
193 menu->addAction( rampType );
195 btnAddItem->setMenu( menu );
196 connect( menu, SIGNAL( triggered( QAction* ) ),
201 if ( btnAddItem->menu() )
203 disconnect( btnAddItem->menu(), SIGNAL( triggered( QAction* ) ),
205 btnAddItem->setMenu( 0 );
212 listItems->setIconSize( QSize( 75, 50 ) );
213 listItems->setGridSize( QSize( 100, 80 ) );
217 listItems->setIconSize( QSize( 50, 50 ) );
218 listItems->setGridSize( QSize( 75, 80 ) );
228 Q_ASSERT( 0 &&
"not implemented" );
231 groupChanged( groupTree->selectionModel()->currentIndex() );
236 QStandardItemModel* model = qobject_cast<QStandardItemModel*>( listItems->model() );
241 for (
int i = 0; i < symbolNames.count(); ++i )
243 QString name = symbolNames[i];
245 if ( symbol && symbol->
type() == type )
247 QStandardItem* item =
new QStandardItem( name );
249 item->setIcon( icon );
250 item->setData( name );
251 item->setCheckable( check );
252 item->setToolTip( name );
254 model->appendRow( item );
263 QStandardItemModel* model = qobject_cast<QStandardItemModel*>( listItems->model() );
266 for (
int i = 0; i < colorRamps.count(); ++i )
268 QString name = colorRamps[i];
271 QStandardItem* item =
new QStandardItem( name );
273 item->setIcon( icon );
274 item->setData( name );
275 item->setCheckable( check );
276 item->setToolTip( name );
277 model->appendRow( item );
284 switch ( tabItemType->currentIndex() )
296 QModelIndex
index = listItems->selectionModel()->currentIndex();
297 if ( !index.isValid() )
299 return index.model()->data( index, 0 ).toString();
304 bool changed =
false;
315 Q_ASSERT( 0 &&
"not implemented" );
329 QString name =
tr(
"new symbol" );
334 name =
tr(
"new marker" );
338 name =
tr(
"new line" );
342 name =
tr(
"new fill symbol" );
345 Q_ASSERT( 0 &&
"unknown symbol type" );
355 if ( dlg.exec() == 0 )
362 bool nameInvalid =
true;
364 while ( nameInvalid )
367 name = QInputDialog::getText(
this,
tr(
"Symbol Name" ),
368 tr(
"Please enter a name for new symbol:" ),
369 QLineEdit::Normal, name, &ok );
376 if ( name.isEmpty() )
378 QMessageBox::warning(
this,
tr(
"Save symbol" ),
379 tr(
"Cannot save symbol without name. Enter a name." ) );
383 int res = QMessageBox::warning(
this,
tr(
"Save symbol" ),
384 tr(
"Symbol with name '%1' already exists. Overwrite?" )
386 QMessageBox::Yes | QMessageBox::No );
387 if ( res == QMessageBox::Yes )
411 if ( rampType.isEmpty() )
413 QStringList rampTypes;
414 rampTypes <<
tr(
"Gradient" ) <<
tr(
"Random" ) <<
tr(
"ColorBrewer" );
415 rampTypes <<
tr(
"cpt-city" );
416 rampType = QInputDialog::getItem( parent,
tr(
"Color ramp type" ),
417 tr(
"Please select color ramp type:" ), rampTypes, 0,
false, &ok );
419 if ( !ok || rampType.isEmpty() )
422 QString name =
tr(
"new ramp" );
425 if ( rampType ==
tr(
"Gradient" ) )
435 name =
tr(
"new gradient ramp" );
437 else if ( rampType ==
tr(
"Random" ) )
447 name =
tr(
"new random ramp" );
449 else if ( rampType ==
tr(
"ColorBrewer" ) )
461 else if ( rampType ==
tr(
"cpt-city" ) )
491 bool nameInvalid =
true;
493 while ( nameInvalid )
496 name = QInputDialog::getText( parent,
tr(
"Color Ramp Name" ),
497 tr(
"Please enter a name for new color ramp:" ),
498 QLineEdit::Normal, name, &ok );
505 if ( name.isEmpty() )
507 QMessageBox::warning( parent,
tr(
"Save Color Ramp" ),
508 tr(
"Cannot save color ramp without name. Enter a name." ) );
512 int res = QMessageBox::warning( parent,
tr(
"Save color ramp" ),
513 tr(
"Color ramp with name '%1' already exists. Overwrite?" )
515 QMessageBox::Yes | QMessageBox::No );
516 if ( res == QMessageBox::Yes )
544 action ? action->text() : QString() );
545 if ( !rampName.isEmpty() )
557 bool changed =
false;
568 Q_ASSERT( 0 &&
"not implemented" );
578 if ( symbolName.isEmpty() )
585 if ( dlg.exec() == 0 )
600 if ( name.isEmpty() )
605 if ( ramp->
type() ==
"gradient" )
615 else if ( ramp->
type() ==
"random" )
625 else if ( ramp->
type() ==
"colorbrewer" )
635 else if ( ramp->
type() ==
"cpt-city" )
652 Q_ASSERT( 0 &&
"invalid ramp type" );
663 bool changed =
false;
674 Q_ASSERT( 0 &&
"not implemented" );
686 QModelIndexList indexes = listItems->selectionModel()->selectedIndexes();
687 foreach ( QModelIndex
index, indexes )
689 QString symbolName = index.data().toString();
691 if ( !symbolName.isEmpty() )
701 if ( rampName.isEmpty() )
712 QString oldName = item->data().toString();
714 bool changed =
false;
731 QMessageBox::critical(
this,
tr(
"Cannot rename item" ),
732 tr(
"Name is already taken by another item. Choose a different name." ) );
733 item->setText( oldName );
753 QFont font = item->font();
754 font.setBold(
true );
755 item->setFont( font );
760 QStandardItemModel *model = qobject_cast<QStandardItemModel*>( groupTree->model() );
763 QStandardItem *allSymbols =
new QStandardItem(
tr(
"All Symbols" ) );
764 allSymbols->setData(
"all" );
765 allSymbols->setEditable(
false );
767 model->appendRow( allSymbols );
769 QStandardItem *group =
new QStandardItem(
"" );
770 group->setData(
"groups" );
771 group->setEditable(
false );
773 group->setText(
tr(
"Groups" ) );
774 QStandardItem *ungrouped =
new QStandardItem(
tr(
"Ungrouped" ) );
775 ungrouped->setData( 0 );
778 group->appendRow( ungrouped );
779 model->appendRow( group );
781 QStandardItem *tag =
new QStandardItem(
tr(
"Smart Groups" ) );
782 tag->setData(
"smartgroups" );
783 tag->setEditable(
false );
786 QgsSymbolGroupMap::const_iterator i = sgMap.constBegin();
787 while ( i != sgMap.constEnd() )
789 QStandardItem *item =
new QStandardItem( i.value() );
790 item->setData( i.key() );
791 tag->appendRow( item );
794 model->appendRow( tag );
797 int rows = model->rowCount( model->indexFromItem( model->invisibleRootItem() ) );
798 for (
int i = 0; i < rows; i++ )
800 groupTree->setExpanded( model->indexFromItem( model->item( i ) ),
true );
807 QgsSymbolGroupMap::const_iterator i = groups.constBegin();
808 while ( i != groups.constEnd() )
810 QStandardItem *item =
new QStandardItem( i.value() );
811 item->setData( i.key() );
812 parent->appendRow( item );
820 QStringList symbolNames;
821 QStringList groupSymbols;
830 QString category = index.data( Qt::UserRole + 1 ).toString();
831 if ( category ==
"all" || category ==
"groups" || category ==
"smartgroups" )
834 if ( category ==
"groups" || category ==
"smartgroups" )
836 btnAddGroup->setEnabled(
true );
843 if ( index.parent().data( Qt::UserRole + 1 ) ==
"smartgroups" )
845 btnAddGroup->setEnabled(
false );
846 btnRemoveGroup->setEnabled(
true );
847 btnManageGroups->setEnabled(
true );
848 int groupId = index.data( Qt::UserRole + 1 ).toInt();
853 if (( !index.data( Qt::UserRole + 1 ).toInt() && ( index.data() ==
"Ungrouped" ) ) ||
mGrouppingMode )
857 int groupId = index.data( Qt::UserRole + 1 ).toInt();
861 groupSymbols = symbolNames;
881 QStandardItemModel *model = qobject_cast<QStandardItemModel*>( groupTree->model() );
882 QModelIndex parentIndex = groupTree->currentIndex();
885 QString parentData = parentIndex.data( Qt::UserRole + 1 ).toString();
886 if ( parentData ==
"all" || ( parentIndex.data() ==
"Ungrouped" && parentData ==
"0" ) )
888 int err = QMessageBox::critical(
this,
tr(
"Invalid Selection" ),
889 tr(
"The parent group you have selected is not user editable.\n" 890 "Kindly select a user defined group." ) );
896 if ( parentIndex.parent().data( Qt::UserRole + 1 ).toString() ==
"smartgroups" )
898 int err = QMessageBox::critical(
this,
tr(
"Operation Not Allowed" ),
899 tr(
"Creation of nested smart groups are not allowed\n" 900 "Select the 'Smart Group' to create a new group." ) );
910 if ( parentIndex.data( Qt::UserRole + 1 ).toString() ==
"smartgroups" )
913 if ( dlg.exec() == QDialog::Rejected )
918 itemData = QVariant(
id );
924 itemName = QString(
tr(
"New Group" ) );
925 itemData = QVariant(
"newgroup" );
929 QStandardItem *parentItem = model->itemFromIndex( parentIndex );
930 QStandardItem *childItem =
new QStandardItem( itemName );
931 childItem->setData( itemData );
932 parentItem->appendRow( childItem );
934 groupTree->setCurrentIndex( childItem->index() );
937 groupTree->edit( childItem->index() );
943 QStandardItemModel *model = qobject_cast<QStandardItemModel*>( groupTree->model() );
944 QModelIndex
index = groupTree->currentIndex();
947 QString data = index.data( Qt::UserRole + 1 ).toString();
948 if ( data ==
"all" || data ==
"groups" || data ==
"smartgroups" || index.data() ==
"Ungrouped" )
950 int err = QMessageBox::critical(
this,
tr(
"Invalid selection" ),
951 tr(
"Cannot delete system defined categories.\n" 952 "Kindly select a group or smart group you might want to delete." ) );
957 QStandardItem *parentItem = model->itemFromIndex( index.parent() );
958 if ( parentItem->data( Qt::UserRole + 1 ).toString() ==
"smartgroups" )
965 QStandardItem *item = model->itemFromIndex( index );
966 if ( item->hasChildren() )
968 QStandardItem *parent = item->parent();
969 for (
int i = 0; i < item->rowCount(); i++ )
971 parent->appendRow( item->takeChild( i ) );
975 parentItem->removeRow( index.row() );
980 QString data = item->data( Qt::UserRole + 1 ).toString();
981 QgsDebugMsg(
"Symbol group edited: data=" + data +
" text=" + item->text() );
982 if ( data ==
"newgroup" )
985 if ( item->parent()->data( Qt::UserRole + 1 ).toString() ==
"groups" )
991 int parentid = item->parent()->data( Qt::UserRole + 1 ).toInt();
996 QMessageBox::critical(
this,
tr(
"Error!" ),
997 tr(
"New group could not be created.\n" 998 "There was a problem with your symbol database." ) );
999 item->parent()->removeRow( item->row() );
1004 item->setData(
id );
1009 int id = item->data( Qt::UserRole + 1 ).toInt();
1010 QString name = item->text();
1011 if ( item->parent()->data( Qt::UserRole + 1 ) ==
"smartgroups" )
1025 QStandardItemModel *treeModel = qobject_cast<QStandardItemModel*>( groupTree->model() );
1026 QStandardItemModel *model = qobject_cast<QStandardItemModel*>( listItems->model() );
1027 QAction *senderAction = qobject_cast<QAction*>( sender() );
1032 senderAction->setText(
tr(
"Group Symbols" ) );
1034 disconnect( model, SIGNAL(
itemChanged( QStandardItem* ) ),
1035 this, SLOT(
regrouped( QStandardItem* ) ) );
1042 connect( treeModel, SIGNAL(
itemChanged( QStandardItem* ) ),
1044 connect( model, SIGNAL(
itemChanged( QStandardItem* ) ),
1047 listItems->setSelectionMode( QAbstractItemView::ExtendedSelection );
1051 bool validGroup =
false;
1053 QModelIndex present = groupTree->currentIndex();
1054 while ( present.parent().isValid() )
1056 if ( present.parent().data() ==
"Groups" )
1062 present = present.parent();
1069 senderAction->setText(
tr(
"Finish Grouping" ) );
1071 disconnect( treeModel, SIGNAL(
itemChanged( QStandardItem* ) ),
1073 disconnect( model, SIGNAL(
itemChanged( QStandardItem* ) ),
1079 btnManageGroups->setEnabled(
true );
1083 connect( model, SIGNAL(
itemChanged( QStandardItem* ) ),
1084 this, SLOT(
regrouped( QStandardItem* ) ) );
1087 listItems->setSelectionMode( QAbstractItemView::NoSelection );
1099 int groupid = groupTree->currentIndex().data( Qt::UserRole + 1 ).toInt();
1100 QString symbolName = item->text();
1102 if ( item->checkState() == Qt::Checked )
1103 regrouped =
mStyle->
group( type, symbolName, groupid );
1108 int er = QMessageBox::critical(
this,
tr(
"Database Error" ),
1109 tr(
"There was a problem with the Symbols database while regrouping." ) );
1118 QStandardItemModel *model = qobject_cast<QStandardItemModel*>( listItems->model() );
1119 foreach (
const QString symbol, symbols )
1121 QList<QStandardItem*> items = model->findItems( symbol );
1122 foreach ( QStandardItem* item, items )
1123 item->setCheckState( Qt::Checked );
1144 QModelIndexList indexes = listItems->selectionModel()->selection().indexes();
1145 QStringList addtags;
1146 QStringList removetags;
1149 QStringList newtags = tagsLineEdit->text().split(
",", QString::SkipEmptyParts );
1166 foreach (
const QString &tag, oldtags )
1168 if ( !newtags.contains( tag ) )
1169 removetags.append( tag );
1171 if ( removetags.size() > 0 )
1173 foreach ( QModelIndex
index, indexes )
1179 foreach (
const QString &tag, newtags )
1181 if ( !oldtags.contains( tag ) )
1182 addtags.append( tag );
1184 if ( addtags.size() > 0 )
1186 foreach ( QModelIndex
index, indexes )
1196 tagsLineEdit->clear();
1197 QStandardItem *item =
static_cast<QStandardItemModel*
>( listItems->model() )->itemFromIndex( index );
1200 tagsLineEdit->setText(
mTagList.join(
"," ) );
1205 groupTree->setEnabled( enable );
1206 btnAddGroup->setEnabled( enable );
1207 btnRemoveGroup->setEnabled( enable );
1208 btnManageGroups->setEnabled( enable );
1209 searchBox->setEnabled( enable );
1210 tagsLineEdit->setEnabled( enable );
1215 btnAddGroup->setEnabled( enable );
1216 btnRemoveGroup->setEnabled( enable );
1217 btnManageGroups->setEnabled( enable );
1222 QStandardItemModel *treeModel = qobject_cast<QStandardItemModel*>( groupTree->model() );
1223 for (
int i = 0; i < treeModel->rowCount(); i++ )
1225 if ( treeModel->item( i )->data() !=
"groups" )
1227 treeModel->item( i )->setEnabled( enable );
1229 if ( treeModel->item( i )->data() ==
"groups" )
1231 treeModel->item( i )->setEnabled( enable );
1232 for (
int k = 0; k < treeModel->item( i )->rowCount(); k++ )
1234 if ( !treeModel->item( i )->child( k )->data().toInt() )
1235 treeModel->item( i )->child( k )->setEnabled( enable );
1238 if ( treeModel->item( i )->data() ==
"smartgroups" )
1240 for (
int j = 0; j < treeModel->item( i )->rowCount(); j++ )
1242 treeModel->item( i )->child( j )->setEnabled( enable );
1249 for (
int i = 0; i < symbolBtnsLayout->count(); i++ )
1251 symbolBtnsLayout->itemAt( i )->widget()->setEnabled( enable );
1258 QPoint globalPos = groupTree->viewport()->mapToGlobal( point );
1260 QModelIndex
index = groupTree->indexAt( point );
1261 QgsDebugMsg(
"Now you clicked: " + index.data().toString() );
1265 if ( index.parent().isValid() && ( index.data().toString() !=
"Ungrouped" ) )
1267 if ( index.parent().data( Qt::UserRole + 1 ).toString() ==
"smartgroups" )
1269 groupMenu.addAction(
tr(
"Edit Group" ) );
1273 groupMenu.addAction(
tr(
"Add Group" ) );
1275 groupMenu.addAction(
tr(
"Remove Group" ) );
1277 else if ( index.data( Qt::UserRole + 1 ) ==
"groups" || index.data( Qt::UserRole + 1 ) ==
"smartgroups" )
1279 groupMenu.addAction(
tr(
"Add Group" ) );
1283 QAction* selectedItem = groupMenu.exec( globalPos );
1287 if ( selectedItem->text() ==
tr(
"Add Group" ) )
1289 else if ( selectedItem->text() ==
tr(
"Remove Group" ) )
1291 else if ( selectedItem->text() ==
tr(
"Edit Group" ) )
1298 QPoint globalPos = listItems->viewport()->mapToGlobal( point );
1300 QMenu *groupMenu =
new QMenu(
this );
1301 QMenu *groupList =
new QMenu(
this );
1302 groupList->setTitle(
tr(
"Apply Group" ) );
1305 foreach ( QString group, groups )
1307 groupList->addAction( group );
1309 groupMenu->addMenu( groupList );
1310 groupMenu->addAction(
tr(
"Un-group" ) );
1312 QAction* selectedItem = groupMenu->exec( globalPos );
1323 if ( selectedItem->text() !=
tr(
"Un-group" ) )
1327 QModelIndexList indexes = listItems->selectionModel()->selectedIndexes();
1328 foreach ( QModelIndex
index, indexes )
1330 mStyle->
group( type, index.data().toString(), groupId );
1334 QgsDebugMsg(
"Selected Action: " + selectedItem->text() );
1340 QStandardItemModel *treeModel = qobject_cast<QStandardItemModel*>( groupTree->model() );
1343 QModelIndex present = groupTree->currentIndex();
1344 if ( present.parent().data( Qt::UserRole + 1 ) !=
"smartgroups" )
1346 QMessageBox::critical(
this,
tr(
"Invalid Selection" ),
1347 tr(
"You have not selected a Smart Group. Kindly select a Smart Group to edit." ) );
1350 QStandardItem* item = treeModel->itemFromIndex( present );
1358 if ( dlg.exec() == QDialog::Rejected )
1365 QMessageBox::critical(
this,
tr(
"Database Error!" ),
1366 tr(
"There was some error while editing the smart group." ) );
1370 item->setData(
id );
1378 if (( obj == tagsLineEdit ) && ( event->type() == QEvent::FocusOut ) )
QString smartgroupOperator(int id)
returns the operator for the smartgroup
void remove(StyleEntity type, int id)
remove the specified entity from the db
QStringList tagsOfSymbol(StyleEntity type, QString symbol)
return the tags associated with the symbol
int addSmartgroup(QString name, QString op, QgsSmartConditionMap conditions)
adds new smartgroup to the database and returns the id
static QIcon colorRampPreviewIcon(QgsVectorColorRampV2 *ramp, QSize size)
virtual QString type() const =0
void filterSymbols(QString)
filter the symbols based on input search term
QgsSmartConditionMap conditionMap()
returns the condition map
void itemChanged(QStandardItem *item)
void groupChanged(const QModelIndex &)
bool group(StyleEntity type, QString name, int groupid)
applies the specified group to the symbol or colorramp specified by StyleEntity
static QString iconPath(QString iconFile)
Returns path to the desired icon file.
void enableItemsForGroupingMode(bool)
Enables or diables the groupTree items for grouping mode.
void setSymbolsChecked(QStringList)
to set symbols checked when in editing mode
QMultiMap< QString, QString > QgsSmartConditionMap
void tagsChanged()
Listen to tag changes.
QStringList symbolsOfGroup(StyleEntity type, int groupid)
returns the symbolnames of a given groupid
void populateSymbols(QStringList symbolNames, bool checkable=false)
populate list view with symbols of the current type with the given names
QgsStyleV2ManagerDialog(QgsStyleV2 *style, QWidget *parent=NULL)
bool saveAsGradientRamp() const
QgsSymbolV2 * symbol(QString name)
return a NEW copy of symbol
void rename(StyleEntity type, int id, QString newName)
rename the given entity with the specified id
QString smartgroupName()
returns the value from mNameLineEdit
QStringList colorRampNames()
return a list of names of color ramps
bool renameSymbol(QString oldName, QString newName)
change symbol's name
QgsSymbolGroupMap childGroupNames(QString parent="")
return a map of groupid and names for the given parent group
bool addSymbol(QString name, QgsSymbolV2 *symbol, bool update=false)
add symbol to style. takes symbol's ownership
bool save(QString filename=QString())
save style into a file (will use current filename if empty string is passed)
void setConditionMap(QgsSmartConditionMap)
sets up the GUI for the given conditionmap
QString variantName() const
static QIcon symbolPreviewIcon(QgsSymbolV2 *symbol, QSize size)
bool addSymbol()
add a new symbol to style
const QgsSymbolV2 * symbolRef(QString name) const
return a const pointer to a symbol (doesn't create new instance)
int colorRampCount()
return count of color ramps
void populateGroups()
populate the groups
QStringList mTagList
space to store symbol tags
bool renameColorRamp(QString oldName, QString newName)
change ramp's name
void groupRenamed(QStandardItem *)
void buildGroupTree(QStandardItem *&parent)
build the groups tree
QStringList symbolsOfSmartgroup(StyleEntity type, int id)
returns the symbols for the smartgroup
void grouptreeContextMenu(const QPoint &)
Context menu for the groupTree.
void setOperator(QString)
sets the operator AND/OR
void populateTypes()
populate combo box with known style items (symbols, color ramps)
QStringList symbolNames()
return a list of names of symbols
QMap< int, QString > QgsSymbolGroupMap
QgsSymbolGroupMap smartgroupsListMap()
returns the smart groups map with id as key and name as value
QString schemeName() const
void setSmartgroupName(QString)
sets the smart group Name
void on_tabItemType_currentChanged(int)
bool eventFilter(QObject *, QEvent *) override
Event filter to capture tagsLineEdit out of focus.
bool mGrouppingMode
Mode to display the symbol list.
void setBold(QStandardItem *)
sets the text of the item with bold font
QgsVectorGradientColorRampV2 * cloneGradientRamp() const
void symbolSelected(const QModelIndex &)
Perform symbol specific tasks when selected.
void groupSymbolsAction()
carryout symbol grouping using check boxes
bool detagSymbol(StyleEntity type, QString symbol, QStringList tags)
detags the symbol with the given list
bool removeSymbol(QString name)
remove symbol from style (and delete it)
bool addColorRamp(QString name, QgsVectorColorRampV2 *colorRamp, bool update=false)
add color ramp to style. takes ramp's ownership
void listitemsContextMenu(const QPoint &)
Context menu for the listItems ( symbols list )
bool tagSymbol(StyleEntity type, QString symbol, QStringList tags)
tags the symbol with the tags in the list
bool removeColorRamp(QString name)
remove color ramp from style (and delete it)
void editSmartgroupAction()
edit the selected smart group
void populateColorRamps(QStringList colorRamps, bool checkable=false)
populate list view with color ramps
int addGroup(QString groupName, int parent=0)
adds a new group and returns the group's id
static QString addColorRampStatic(QWidget *parent, QgsStyleV2 *style, QString RampType=QString())
open add color ramp dialog, return color ramp's name if the ramp has been added
void enableGroupInputs(bool)
Enables or disables the groupTree specific inputs.
void enableSymbolInputs(bool)
Enables or disbables the symbol specific inputs.
QgsVectorColorRampV2 * colorRamp(QString name)
return a NEW copy of color ramp
void onFinished()
called when the dialog is going to be closed
StyleEntity
Enum for Entities involved in a style.
QString schemeName() const
QStringList findSymbols(StyleEntity type, QString qword)
return the names of the symbols which have a matching 'substring' in its defintion ...
bool isGroup(QgsLayerTreeNode *node)
Check whether the node is a valid group node.
void regrouped(QStandardItem *)
symbol changed from one group
QStringList groupNames()
return the all the groups in the style
QgsSmartConditionMap smartgroup(int id)
returns the QgsSmartConditionMap for the given id
QString currentItemName()
QString conditionOperator()
returns the AND/OR condition
bool addColorRamp()
add a new color ramp to style
int groupId(QString group)
return the DB id for the given group name
void populateList()
adds symbols of some type to list