20 : QAbstractListModel( parent )
25 mCategoryList = qgsEnumList<QgsMapLayer::StyleCategory>();
29 mCategoryList << QgsMapLayer::StyleCategory::Symbology << QgsMapLayer::StyleCategory::Labeling << QgsMapLayer::StyleCategory::AllStyleCategories;
64 mShowAllCategories = showAll;
70 int count = mCategoryList.count();
71 if ( !mShowAllCategories )
83 if ( !index.isValid() || index.row() >=
rowCount() )
88 if ( role == Qt::UserRole )
92 if ( role == Qt::CheckStateRole )
94 return mCategories.testFlag( category ) ? Qt::Checked : Qt::Unchecked;
99 case QgsMapLayer::StyleCategory::LayerConfiguration:
102 case Qt::DisplayRole:
103 return tr(
"Layer Configuration" );
104 case Qt::ToolTipRole:
105 return tr(
"Identifiable, removable, searchable, display expression, read-only, hidden" );
106 case Qt::DecorationRole:
110 case QgsMapLayer::StyleCategory::Symbology:
113 case Qt::DisplayRole:
114 return tr(
"Symbology" );
115 case Qt::ToolTipRole:
117 case Qt::DecorationRole:
121 case QgsMapLayer::StyleCategory::Symbology3D:
124 case Qt::DisplayRole:
125 return tr(
"3D Symbology" );
126 case Qt::ToolTipRole:
128 case Qt::DecorationRole:
132 case QgsMapLayer::StyleCategory::Labeling:
135 case Qt::DisplayRole:
136 return tr(
"Labels" );
137 case Qt::ToolTipRole:
139 case Qt::DecorationRole:
143 case QgsMapLayer::StyleCategory::Fields:
146 case Qt::DisplayRole:
147 return tr(
"Fields" );
148 case Qt::ToolTipRole:
149 return tr(
"Aliases, widgets, WMS/WFS, expressions, constraints, virtual fields" );
150 case Qt::DecorationRole:
154 case QgsMapLayer::StyleCategory::Forms:
157 case Qt::DisplayRole:
158 return tr(
"Forms" );
159 case Qt::ToolTipRole:
161 case Qt::DecorationRole:
165 case QgsMapLayer::StyleCategory::Actions:
168 case Qt::DisplayRole:
169 return tr(
"Actions" );
170 case Qt::ToolTipRole:
172 case Qt::DecorationRole:
176 case QgsMapLayer::StyleCategory::MapTips:
179 case Qt::DisplayRole:
180 return tr(
"Map Tips" );
181 case Qt::ToolTipRole:
183 case Qt::DecorationRole:
187 case QgsMapLayer::StyleCategory::Diagrams:
190 case Qt::DisplayRole:
191 return tr(
"Diagrams" );
192 case Qt::ToolTipRole:
194 case Qt::DecorationRole:
198 case QgsMapLayer::StyleCategory::AttributeTable:
201 case Qt::DisplayRole:
202 return tr(
"Attribute Table Settings" );
203 case Qt::ToolTipRole:
204 return tr(
"Choice and order of columns, conditional styling" );
205 case Qt::DecorationRole:
209 case QgsMapLayer::StyleCategory::Rendering:
212 case Qt::DisplayRole:
213 return tr(
"Rendering" );
214 case Qt::ToolTipRole:
215 return tr(
"Scale visibility, simplify method, opacity" );
216 case Qt::DecorationRole:
220 case QgsMapLayer::StyleCategory::CustomProperties:
223 case Qt::DisplayRole:
224 return tr(
"Custom Properties" );
225 case Qt::ToolTipRole:
227 case Qt::DecorationRole:
231 case QgsMapLayer::StyleCategory::GeometryOptions:
234 case Qt::DisplayRole:
235 return tr(
"Geometry Options" );
236 case Qt::ToolTipRole:
237 return tr(
"Geometry constraints and validity checks" );
238 case Qt::DecorationRole:
242 case QgsMapLayer::StyleCategory::Relations:
245 case Qt::DisplayRole:
246 return tr(
"Relations" );
247 case Qt::ToolTipRole:
248 return tr(
"Relations with other layers" );
249 case Qt::DecorationRole:
254 case QgsMapLayer::StyleCategory::Temporal:
257 case Qt::DisplayRole:
258 return tr(
"Temporal Properties" );
259 case Qt::ToolTipRole:
260 return tr(
"Temporal properties" );
261 case Qt::DecorationRole:
266 case QgsMapLayer::StyleCategory::Legend:
269 case Qt::DisplayRole:
270 return tr(
"Legend Settings" );
271 case Qt::ToolTipRole:
272 return tr(
"Legend settings" );
273 case Qt::DecorationRole:
278 case QgsMapLayer::StyleCategory::Elevation:
281 case Qt::DisplayRole:
282 return tr(
"Elevation Properties" );
283 case Qt::ToolTipRole:
284 return tr(
"Elevation properties" );
285 case Qt::DecorationRole:
290 case QgsMapLayer::StyleCategory::Notes:
293 case Qt::DisplayRole:
294 case Qt::ToolTipRole:
295 return tr(
"Notes" );
296 case Qt::DecorationRole:
301 case QgsMapLayer::StyleCategory::AllStyleCategories:
304 case Qt::DisplayRole:
305 return tr(
"All Style Categories" );
306 case Qt::ToolTipRole:
308 case Qt::DecorationRole:
319 if ( !index.isValid() || index.row() >=
rowCount() )
322 if ( role == Qt::CheckStateRole )
325 if ( value.value<Qt::CheckState>() == Qt::Checked )
327 mCategories |= category;
328 emit dataChanged( index, index );
331 else if ( value.value<Qt::CheckState>() == Qt::Unchecked )
333 mCategories &= ~category;
334 emit dataChanged( index, index );
344 return Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;