144 const int filteredRowCount =
rowCount();
146 if ( !index.isValid() || index.row() >= filteredRowCount )
149 const QgsMapLayer::StyleCategory category = mCategoryList.at( index.row() + ( mShowAllCategories ? 0 : mCategoryList.count() - filteredRowCount ) );
151 if ( role == Qt::UserRole )
155 if ( role == Qt::CheckStateRole )
157 return mCategories.testFlag( category ) ? Qt::Checked : Qt::Unchecked;
160 QString htmlStylePattern = u
"<p><b>%1</b><br/><span style='color:gray;'>%2</span></p>"_s;
165 QString name = tr(
"Layer Configuration" );
166 QString description = tr(
"The layers display expression and the datasource flags: identifiable, removable, searchable, read-only and hidden from the project settings" );
171 case Qt::DisplayRole:
172 return htmlStylePattern.arg( name ).arg( description );
173 case Qt::ToolTipRole:
175 case Qt::DecorationRole:
182 QString name = tr(
"Symbology" );
183 QString description = tr(
"Everything from the symbology section" );
188 case Qt::DisplayRole:
190 return htmlStylePattern.arg( name ).arg( description );
191 case Qt::ToolTipRole:
193 case Qt::DecorationRole:
200 QString name = tr(
"3D Symbology" );
201 QString description = tr(
"Everything from the 3D symbology section" );
206 case Qt::DisplayRole:
208 return htmlStylePattern.arg( name ).arg( description );
209 case Qt::ToolTipRole:
211 case Qt::DecorationRole:
218 QString name = tr(
"Labels" );
219 QString description = tr(
"Everything from the labels section" );
224 case Qt::DisplayRole:
226 return htmlStylePattern.arg( name ).arg( description );
227 case Qt::ToolTipRole:
229 case Qt::DecorationRole:
236 QString name = tr(
"Fields" );
237 QString description = tr(
"Virtual fields, aliases, default value expressions and constraints from the form section and WMS/WFS exposure" );
242 case Qt::DisplayRole:
244 return htmlStylePattern.arg( name ).arg( description );
245 case Qt::ToolTipRole:
247 case Qt::DecorationRole:
254 QString name = tr(
"Attribute Form" );
255 QString description = tr(
"Form layout and widget configuration (no constraints and default value expressions)" );
260 case Qt::DisplayRole:
262 return htmlStylePattern.arg( name ).arg( description );
263 case Qt::ToolTipRole:
265 case Qt::DecorationRole:
272 QString name = tr(
"Actions" );
273 QString description = tr(
"Everything from the actions section" );
278 case Qt::DisplayRole:
280 return htmlStylePattern.arg( name ).arg( description );
281 case Qt::ToolTipRole:
283 case Qt::DecorationRole:
290 QString name = tr(
"Map Tips" );
291 QString description = tr(
"Map tips settings (no layer display expression)" );
296 case Qt::DisplayRole:
298 return htmlStylePattern.arg( name ).arg( description );
299 case Qt::ToolTipRole:
301 case Qt::DecorationRole:
308 QString name = tr(
"Diagrams" );
309 QString description = tr(
"Everything from the diagram section" );
314 case Qt::DisplayRole:
316 return htmlStylePattern.arg( name ).arg( description );
317 case Qt::ToolTipRole:
319 case Qt::DecorationRole:
326 QString name = tr(
"Attribute Table Configuration" );
327 QString description = tr(
"Attribute table settings: choice and order of columns and conditional styling" );
332 case Qt::DisplayRole:
334 return htmlStylePattern.arg( name ).arg( description );
335 case Qt::ToolTipRole:
337 case Qt::DecorationRole:
344 QString name = tr(
"Rendering" );
345 QString description = tr(
"Everything from the rendering section: Scale visibility, simplify method, opacity, auto refresh etc." );
350 case Qt::DisplayRole:
352 return htmlStylePattern.arg( name ).arg( description );
353 case Qt::ToolTipRole:
355 case Qt::DecorationRole:
362 QString name = tr(
"Custom Properties" );
363 QString description = tr(
"Layer variables and embedded legend widgets as well as all the custom properties (often used by plugins and custom python code)" );
368 case Qt::DisplayRole:
370 return htmlStylePattern.arg( name ).arg( description );
371 case Qt::ToolTipRole:
373 case Qt::DecorationRole:
380 QString name = tr(
"Geometry Options" );
381 QString description = tr(
"Geometry constraints and validity checks" );
386 case Qt::DisplayRole:
388 return htmlStylePattern.arg( name ).arg( description );
389 case Qt::ToolTipRole:
391 case Qt::DecorationRole:
398 QString name = tr(
"Relations" );
399 QString description = tr(
"The relations this layer has with other layers" );
404 case Qt::DisplayRole:
406 return htmlStylePattern.arg( name ).arg( description );
407 case Qt::ToolTipRole:
409 case Qt::DecorationRole:
416 QString name = tr(
"Temporal Properties" );
417 QString description = tr(
"Everything from the temporal section" );
422 case Qt::DisplayRole:
424 return htmlStylePattern.arg( name ).arg( description );
425 case Qt::ToolTipRole:
427 case Qt::DecorationRole:
434 QString name = tr(
"Legend Settings" );
435 QString description = tr(
"Legend settings (no embedded legend widgets)" );
440 case Qt::DisplayRole:
442 return htmlStylePattern.arg( name ).arg( description );
443 case Qt::ToolTipRole:
445 case Qt::DecorationRole:
452 QString name = tr(
"Elevation Properties" );
453 QString description = tr(
"Everything from the elevation section" );
458 case Qt::DisplayRole:
460 return htmlStylePattern.arg( name ).arg( description );
461 case Qt::ToolTipRole:
463 case Qt::DecorationRole:
470 QString name = tr(
"Notes" );
471 QString description = tr(
"The layer notes" );
476 case Qt::DisplayRole:
478 return htmlStylePattern.arg( name ).arg( description );
479 case Qt::ToolTipRole:
481 case Qt::DecorationRole:
488 QString name = tr(
"All Fields and Attribute Form Categories" );
489 QString description = tr(
"All fields and attribute form categories" );
494 case Qt::DisplayRole:
495 return htmlStylePattern.arg( name ).arg( description );
496 case Qt::ToolTipRole:
498 case Qt::DecorationRole:
505 QString name = tr(
"All Symbology and Labeling Categories" );
506 QString description = mLayerType ==
Qgis::LayerType::Vector ? tr(
"All symbology, labeling and diagram categories" ) : tr(
"All symbology and labeling categories" );
511 case Qt::DisplayRole:
512 return htmlStylePattern.arg( name ).arg( description );
513 case Qt::ToolTipRole:
515 case Qt::DecorationRole:
522 QString name = tr(
"All Style Categories" );
523 QString description = tr(
"All style categories" );
528 case Qt::DisplayRole:
529 return htmlStylePattern.arg( name ).arg( description );
530 case Qt::ToolTipRole:
531 case Qt::DecorationRole:
542 if ( !index.isValid() || index.row() >=
rowCount() )
545 if ( role == Qt::CheckStateRole )
548 if ( value.value<Qt::CheckState>() == Qt::Checked )
550 mCategories |= category;
551 emit dataChanged( index, index );
554 else if ( value.value<Qt::CheckState>() == Qt::Unchecked )
556 mCategories &= ~category;
557 emit dataChanged( index, index );