21 #include <QStandardItemModel> 22 #include <QStandardItem> 32 groupTree->setModel( model );
35 allSymbols->
setData(
"all", Qt::UserRole + 2 );
41 group->
setData(
"groupsheader", Qt::UserRole + 2 );
44 buildGroupTree( group );
48 ungrouped->
setData(
"group", Qt::UserRole + 2 );
55 tag->
setData(
"smartgroupsheader" , Qt::UserRole + 2 );
66 item->
setData(
"smartgroup" , Qt::UserRole + 2 );
74 for (
int i = 0; i < rows; i++ )
98 QModelIndexList selectedItems = selected.
indexes();
99 QModelIndexList deselectedItems = deselected.
indexes();
101 Q_FOREACH ( index, deselectedItems )
103 if ( index.
data( Qt::UserRole + 2 ).
toString() ==
"groupsheader" )
107 else if ( index.
data( Qt::UserRole + 2 ).
toString() ==
"all" )
111 else if ( index.
data( Qt::UserRole + 2 ).
toString() ==
"smartgroupsheader" )
115 else if ( index.
data( Qt::UserRole + 2 ).
toString() ==
"smartgroup" )
119 else if ( index.
data( Qt::UserRole + 2 ).
toString() ==
"group" )
124 Q_FOREACH ( index, selectedItems )
126 if ( index.
data( Qt::UserRole + 2 ).
toString() ==
"groupsheader" )
130 else if ( index.
data( Qt::UserRole + 2 ).
toString() ==
"all" )
134 else if ( index.
data( Qt::UserRole + 2 ).
toString() ==
"smartgroupsheader" )
138 else if ( index.
data( Qt::UserRole + 2 ).
toString() ==
"smartgroup" )
142 else if ( index.
data( Qt::UserRole + 2 ).
toString() ==
"group" )
158 item->
setData(
"group" , Qt::UserRole + 2 );
161 buildGroupTree( item );
QgsStyleV2GroupSelectionDialog(QgsStyleV2 *style, QWidget *parent=nullptr)
QModelIndexList indexes() const
QStandardItem * invisibleRootItem() const
void groupSelected(const QString &groupName)
group with groupName has been selected
Qt::ItemFlags flags() const
void groupDeselected(const QString &groupName)
group with groupName has been deselected
const_iterator constBegin() const
~QgsStyleV2GroupSelectionDialog()
void smartgroupDeselected(const QString &groupName)
smart group with groupName has been deselected
QString tr(const char *sourceText, const char *disambiguation, int n)
virtual void setData(const QVariant &value, int role)
void setBold(bool enable)
QgsSymbolGroupMap childGroupNames(const QString &parent="")
return a map of groupid and names for the given parent group
QModelIndex indexFromItem(const QStandardItem *item) const
void appendRow(const QList< QStandardItem * > &items)
void setFlags(QFlags< Qt::ItemFlag > flags)
const_iterator constEnd() const
QgsSymbolGroupMap smartgroupsListMap()
returns the smart groups map with id as key and name as value
void setFont(const QFont &font)
QStandardItem * item(int row, int column) const
void setBold(QStandardItem *item)
Set bold font for item.
void setText(const QString &text)
QVariant data(int role) const
void allDeselected()
all deselected
void allSelected()
all selected
virtual int rowCount(const QModelIndex &parent) const
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void appendRow(const QList< QStandardItem * > &items)
void setEditable(bool editable)
void smartgroupSelected(const QString &groupName)
smartgroup with groupName has been selected