146 const int filteredRowCount =
rowCount();
148 if ( !index.isValid() || index.row() >= filteredRowCount )
151 const QgsMapLayer::StyleCategory category = mCategoryList.at( index.row() + ( mShowAllCategories ? 0 : mCategoryList.count() - filteredRowCount ) );
153 if ( role == Qt::UserRole )
157 if ( role == Qt::CheckStateRole )
159 return mCategories.testFlag( category ) ? Qt::Checked : Qt::Unchecked;
162 QString htmlStylePattern = u
"<p><b>%1</b><br/><span style='color:gray;'>%2</span></p>"_s;
167 QString name = tr(
"Layer Configuration" );
168 QString description = tr(
"The layers display expression and the datasource flags: identifiable, removable, searchable, read-only and hidden from the project settings" );
173 case Qt::DisplayRole:
174 return htmlStylePattern.arg( name ).arg( description );
175 case Qt::ToolTipRole:
177 case Qt::DecorationRole:
184 QString name = tr(
"Symbology" );
185 QString description = tr(
"Everything from the symbology section" );
190 case Qt::DisplayRole:
192 return htmlStylePattern.arg( name ).arg( description );
193 case Qt::ToolTipRole:
195 case Qt::DecorationRole:
202 QString name = tr(
"3D Symbology" );
203 QString description = tr(
"Everything from the 3D symbology section" );
208 case Qt::DisplayRole:
210 return htmlStylePattern.arg( name ).arg( description );
211 case Qt::ToolTipRole:
213 case Qt::DecorationRole:
220 QString name = tr(
"Labels" );
221 QString description = tr(
"Everything from the labels section" );
226 case Qt::DisplayRole:
228 return htmlStylePattern.arg( name ).arg( description );
229 case Qt::ToolTipRole:
231 case Qt::DecorationRole:
238 QString name = tr(
"Fields" );
239 QString description = tr(
"Virtual fields, aliases, default value expressions and constraints from the form section and WMS/WFS exposure" );
244 case Qt::DisplayRole:
246 return htmlStylePattern.arg( name ).arg( description );
247 case Qt::ToolTipRole:
249 case Qt::DecorationRole:
256 QString name = tr(
"Attribute Form" );
257 QString description = tr(
"Form layout and widget configuration (no constraints and default value expressions)" );
262 case Qt::DisplayRole:
264 return htmlStylePattern.arg( name ).arg( description );
265 case Qt::ToolTipRole:
267 case Qt::DecorationRole:
274 QString name = tr(
"Actions" );
275 QString description = tr(
"Everything from the actions section" );
280 case Qt::DisplayRole:
282 return htmlStylePattern.arg( name ).arg( description );
283 case Qt::ToolTipRole:
285 case Qt::DecorationRole:
292 QString name = tr(
"Map Tips" );
293 QString description = tr(
"Map tips settings (no layer display expression)" );
298 case Qt::DisplayRole:
300 return htmlStylePattern.arg( name ).arg( description );
301 case Qt::ToolTipRole:
303 case Qt::DecorationRole:
310 QString name = tr(
"Diagrams" );
311 QString description = tr(
"Everything from the diagram section" );
316 case Qt::DisplayRole:
318 return htmlStylePattern.arg( name ).arg( description );
319 case Qt::ToolTipRole:
321 case Qt::DecorationRole:
328 QString name = tr(
"Attribute Table Configuration" );
329 QString description = tr(
"Attribute table settings: choice and order of columns and conditional styling" );
334 case Qt::DisplayRole:
336 return htmlStylePattern.arg( name ).arg( description );
337 case Qt::ToolTipRole:
339 case Qt::DecorationRole:
346 QString name = tr(
"Rendering" );
347 QString description = tr(
"Everything from the rendering section: Scale visibility, simplify method, opacity, auto refresh etc." );
352 case Qt::DisplayRole:
354 return htmlStylePattern.arg( name ).arg( description );
355 case Qt::ToolTipRole:
357 case Qt::DecorationRole:
364 QString name = tr(
"Custom Properties" );
365 QString description = tr(
"Layer variables and embedded legend widgets as well as all the custom properties (often used by plugins and custom python code)" );
370 case Qt::DisplayRole:
372 return htmlStylePattern.arg( name ).arg( description );
373 case Qt::ToolTipRole:
375 case Qt::DecorationRole:
382 QString name = tr(
"Geometry Options" );
383 QString description = tr(
"Geometry constraints and validity checks" );
388 case Qt::DisplayRole:
390 return htmlStylePattern.arg( name ).arg( description );
391 case Qt::ToolTipRole:
393 case Qt::DecorationRole:
400 QString name = tr(
"Relations" );
401 QString description = tr(
"The relations this layer has with other layers" );
406 case Qt::DisplayRole:
408 return htmlStylePattern.arg( name ).arg( description );
409 case Qt::ToolTipRole:
411 case Qt::DecorationRole:
418 QString name = tr(
"Temporal Properties" );
419 QString description = tr(
"Everything from the temporal section" );
424 case Qt::DisplayRole:
426 return htmlStylePattern.arg( name ).arg( description );
427 case Qt::ToolTipRole:
429 case Qt::DecorationRole:
436 QString name = tr(
"Legend Settings" );
437 QString description = tr(
"Legend settings (no embedded legend widgets)" );
442 case Qt::DisplayRole:
444 return htmlStylePattern.arg( name ).arg( description );
445 case Qt::ToolTipRole:
447 case Qt::DecorationRole:
454 QString name = tr(
"Elevation Properties" );
455 QString description = tr(
"Everything from the elevation section" );
460 case Qt::DisplayRole:
462 return htmlStylePattern.arg( name ).arg( description );
463 case Qt::ToolTipRole:
465 case Qt::DecorationRole:
472 QString name = tr(
"Notes" );
473 QString description = tr(
"The layer notes" );
478 case Qt::DisplayRole:
480 return htmlStylePattern.arg( name ).arg( description );
481 case Qt::ToolTipRole:
483 case Qt::DecorationRole:
490 QString name = tr(
"All Fields and Attribute Form Categories" );
491 QString description = tr(
"All fields and attribute form categories" );
496 case Qt::DisplayRole:
497 return htmlStylePattern.arg( name ).arg( description );
498 case Qt::ToolTipRole:
500 case Qt::DecorationRole:
507 QString name = tr(
"All Symbology and Labeling Categories" );
508 QString description = mLayerType ==
Qgis::LayerType::Vector ? tr(
"All symbology, labeling and diagram categories" ) : tr(
"All symbology and labeling categories" );
513 case Qt::DisplayRole:
514 return htmlStylePattern.arg( name ).arg( description );
515 case Qt::ToolTipRole:
517 case Qt::DecorationRole:
524 QString name = tr(
"All Style Categories" );
525 QString description = tr(
"All style categories" );
530 case Qt::DisplayRole:
531 return htmlStylePattern.arg( name ).arg( description );
532 case Qt::ToolTipRole:
533 case Qt::DecorationRole:
544 if ( !index.isValid() || index.row() >=
rowCount() )
547 if ( role == Qt::CheckStateRole )
550 if ( value.value<Qt::CheckState>() == Qt::Checked )
552 mCategories |= category;
553 emit dataChanged( index, index );
556 else if ( value.value<Qt::CheckState>() == Qt::Unchecked )
558 mCategories &= ~category;
559 emit dataChanged( index, index );