20 : QAbstractListModel( parent )
25 mCategoryList = qgsEnumMap<QgsMapLayer::StyleCategory>().keys();
29 mCategoryList << QgsMapLayer::StyleCategory::Symbology << QgsMapLayer::StyleCategory::Labeling << QgsMapLayer::StyleCategory::AllStyleCategories;
62 mShowAllCategories = showAll;
68 int count = mCategoryList.count();
69 if ( !mShowAllCategories )
81 if ( !index.isValid() || index.row() >=
rowCount() )
86 if ( role == Qt::UserRole )
90 if ( role == Qt::CheckStateRole )
92 return mCategories.testFlag( category ) ? Qt::Checked : Qt::Unchecked;
97 case QgsMapLayer::StyleCategory::LayerConfiguration:
100 case Qt::DisplayRole:
101 return tr(
"Layer Configuration" );
102 case Qt::ToolTipRole:
103 return tr(
"Identifiable, removable, searchable, display expression, read-only" );
104 case Qt::DecorationRole:
108 case QgsMapLayer::StyleCategory::Symbology:
111 case Qt::DisplayRole:
112 return tr(
"Symbology" );
113 case Qt::ToolTipRole:
115 case Qt::DecorationRole:
119 case QgsMapLayer::StyleCategory::Symbology3D:
122 case Qt::DisplayRole:
123 return tr(
"3D Symbology" );
124 case Qt::ToolTipRole:
126 case Qt::DecorationRole:
130 case QgsMapLayer::StyleCategory::Labeling:
133 case Qt::DisplayRole:
134 return tr(
"Labels" );
135 case Qt::ToolTipRole:
137 case Qt::DecorationRole:
141 case QgsMapLayer::StyleCategory::Fields:
144 case Qt::DisplayRole:
145 return tr(
"Fields" );
146 case Qt::ToolTipRole:
147 return tr(
"Aliases, widgets, WMS/WFS, expressions, constraints, virtual fields" );
148 case Qt::DecorationRole:
152 case QgsMapLayer::StyleCategory::Forms:
155 case Qt::DisplayRole:
156 return tr(
"Forms" );
157 case Qt::ToolTipRole:
159 case Qt::DecorationRole:
163 case QgsMapLayer::StyleCategory::Actions:
166 case Qt::DisplayRole:
167 return tr(
"Actions" );
168 case Qt::ToolTipRole:
170 case Qt::DecorationRole:
174 case QgsMapLayer::StyleCategory::MapTips:
177 case Qt::DisplayRole:
178 return tr(
"Map Tips" );
179 case Qt::ToolTipRole:
181 case Qt::DecorationRole:
185 case QgsMapLayer::StyleCategory::Diagrams:
188 case Qt::DisplayRole:
189 return tr(
"Diagrams" );
190 case Qt::ToolTipRole:
192 case Qt::DecorationRole:
196 case QgsMapLayer::StyleCategory::AttributeTable:
199 case Qt::DisplayRole:
200 return tr(
"Attribute Table Settings" );
201 case Qt::ToolTipRole:
202 return tr(
"Choice and order of columns, conditional styling" );
203 case Qt::DecorationRole:
207 case QgsMapLayer::StyleCategory::Rendering:
210 case Qt::DisplayRole:
211 return tr(
"Rendering" );
212 case Qt::ToolTipRole:
213 return tr(
"Scale visibility, simplify method, opacity" );
214 case Qt::DecorationRole:
218 case QgsMapLayer::StyleCategory::CustomProperties:
221 case Qt::DisplayRole:
222 return tr(
"Custom Properties" );
223 case Qt::ToolTipRole:
225 case Qt::DecorationRole:
229 case QgsMapLayer::StyleCategory::GeometryOptions:
232 case Qt::DisplayRole:
233 return tr(
"Geometry Options" );
234 case Qt::ToolTipRole:
235 return tr(
"Geometry constraints and validity checks" );
236 case Qt::DecorationRole:
240 case QgsMapLayer::StyleCategory::Relations:
243 case Qt::DisplayRole:
244 return tr(
"Relations" );
245 case Qt::ToolTipRole:
246 return tr(
"Relations with other layers" );
247 case Qt::DecorationRole:
252 case QgsMapLayer::StyleCategory::Temporal:
255 case Qt::DisplayRole:
256 return tr(
"Temporal Properties" );
257 case Qt::ToolTipRole:
258 return tr(
"Temporal properties" );
259 case Qt::DecorationRole:
264 case QgsMapLayer::StyleCategory::Legend:
267 case Qt::DisplayRole:
268 return tr(
"Legend Settings" );
269 case Qt::ToolTipRole:
270 return tr(
"Legend settings" );
271 case Qt::DecorationRole:
276 case QgsMapLayer::StyleCategory::AllStyleCategories:
279 case Qt::DisplayRole:
280 return tr(
"All Style Categories" );
281 case Qt::ToolTipRole:
283 case Qt::DecorationRole:
294 if ( !index.isValid() || index.row() >=
rowCount() )
297 if ( role == Qt::CheckStateRole )
300 if ( value.value<Qt::CheckState>() == Qt::Checked )
302 mCategories |= category;
303 emit dataChanged( index, index );
306 else if ( value.value<Qt::CheckState>() == Qt::Unchecked )
308 mCategories &= ~category;
309 emit dataChanged( index, index );
319 return Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;