145 const int filteredRowCount =
rowCount();
147 if ( !index.isValid() || index.row() >= filteredRowCount )
150 const QgsMapLayer::StyleCategory category = mCategoryList.at( index.row() + ( mShowAllCategories ? 0 : mCategoryList.count() - filteredRowCount ) );
152 if ( role == Qt::UserRole )
156 if ( role == Qt::CheckStateRole )
158 return mCategories.testFlag( category ) ? Qt::Checked : Qt::Unchecked;
161 QString htmlStylePattern = u
"<p><b>%1</b><br/><span style='color:gray;'>%2</span></p>"_s;
166 QString name = tr(
"Layer Configuration" );
167 QString description = tr(
"The layers display expression and the datasource flags: identifiable, removable, searchable, read-only and hidden from the project settings" );
172 case Qt::DisplayRole:
173 return htmlStylePattern.arg( name ).arg( description );
174 case Qt::ToolTipRole:
176 case Qt::DecorationRole:
183 QString name = tr(
"Symbology" );
184 QString description = tr(
"Everything from the symbology section" );
189 case Qt::DisplayRole:
191 return htmlStylePattern.arg( name ).arg( description );
192 case Qt::ToolTipRole:
194 case Qt::DecorationRole:
201 QString name = tr(
"3D Symbology" );
202 QString description = tr(
"Everything from the 3D symbology section" );
207 case Qt::DisplayRole:
209 return htmlStylePattern.arg( name ).arg( description );
210 case Qt::ToolTipRole:
212 case Qt::DecorationRole:
219 QString name = tr(
"Labels" );
220 QString description = tr(
"Everything from the labels section" );
225 case Qt::DisplayRole:
227 return htmlStylePattern.arg( name ).arg( description );
228 case Qt::ToolTipRole:
230 case Qt::DecorationRole:
237 QString name = tr(
"Fields" );
238 QString description = tr(
"Virtual fields, aliases, default value expressions and constraints from the form section and WMS/WFS exposure" );
243 case Qt::DisplayRole:
245 return htmlStylePattern.arg( name ).arg( description );
246 case Qt::ToolTipRole:
248 case Qt::DecorationRole:
255 QString name = tr(
"Attribute Form" );
256 QString description = tr(
"Form layout and widget configuration (no constraints and default value expressions)" );
261 case Qt::DisplayRole:
263 return htmlStylePattern.arg( name ).arg( description );
264 case Qt::ToolTipRole:
266 case Qt::DecorationRole:
273 QString name = tr(
"Actions" );
274 QString description = tr(
"Everything from the actions section" );
279 case Qt::DisplayRole:
281 return htmlStylePattern.arg( name ).arg( description );
282 case Qt::ToolTipRole:
284 case Qt::DecorationRole:
291 QString name = tr(
"Map Tips" );
292 QString description = tr(
"Map tips settings (no layer display expression)" );
297 case Qt::DisplayRole:
299 return htmlStylePattern.arg( name ).arg( description );
300 case Qt::ToolTipRole:
302 case Qt::DecorationRole:
309 QString name = tr(
"Diagrams" );
310 QString description = tr(
"Everything from the diagram section" );
315 case Qt::DisplayRole:
317 return htmlStylePattern.arg( name ).arg( description );
318 case Qt::ToolTipRole:
320 case Qt::DecorationRole:
327 QString name = tr(
"Attribute Table Configuration" );
328 QString description = tr(
"Attribute table settings: choice and order of columns and conditional styling" );
333 case Qt::DisplayRole:
335 return htmlStylePattern.arg( name ).arg( description );
336 case Qt::ToolTipRole:
338 case Qt::DecorationRole:
345 QString name = tr(
"Rendering" );
346 QString description = tr(
"Everything from the rendering section: Scale visibility, simplify method, opacity, auto refresh etc." );
351 case Qt::DisplayRole:
353 return htmlStylePattern.arg( name ).arg( description );
354 case Qt::ToolTipRole:
356 case Qt::DecorationRole:
363 QString name = tr(
"Custom Properties" );
364 QString description = tr(
"Layer variables and embedded legend widgets as well as all the custom properties (often used by plugins and custom python code)" );
369 case Qt::DisplayRole:
371 return htmlStylePattern.arg( name ).arg( description );
372 case Qt::ToolTipRole:
374 case Qt::DecorationRole:
381 QString name = tr(
"Geometry Options" );
382 QString description = tr(
"Geometry constraints and validity checks" );
387 case Qt::DisplayRole:
389 return htmlStylePattern.arg( name ).arg( description );
390 case Qt::ToolTipRole:
392 case Qt::DecorationRole:
399 QString name = tr(
"Relations" );
400 QString description = tr(
"The relations this layer has with other layers" );
405 case Qt::DisplayRole:
407 return htmlStylePattern.arg( name ).arg( description );
408 case Qt::ToolTipRole:
410 case Qt::DecorationRole:
417 QString name = tr(
"Temporal Properties" );
418 QString description = tr(
"Everything from the temporal section" );
423 case Qt::DisplayRole:
425 return htmlStylePattern.arg( name ).arg( description );
426 case Qt::ToolTipRole:
428 case Qt::DecorationRole:
435 QString name = tr(
"Legend Settings" );
436 QString description = tr(
"Legend settings (no embedded legend widgets)" );
441 case Qt::DisplayRole:
443 return htmlStylePattern.arg( name ).arg( description );
444 case Qt::ToolTipRole:
446 case Qt::DecorationRole:
453 QString name = tr(
"Elevation Properties" );
454 QString description = tr(
"Everything from the elevation section" );
459 case Qt::DisplayRole:
461 return htmlStylePattern.arg( name ).arg( description );
462 case Qt::ToolTipRole:
464 case Qt::DecorationRole:
471 QString name = tr(
"Notes" );
472 QString description = tr(
"The layer notes" );
477 case Qt::DisplayRole:
479 return htmlStylePattern.arg( name ).arg( description );
480 case Qt::ToolTipRole:
482 case Qt::DecorationRole:
489 QString name = tr(
"All Fields and Attribute Form Categories" );
490 QString description = tr(
"All fields and attribute form categories" );
495 case Qt::DisplayRole:
496 return htmlStylePattern.arg( name ).arg( description );
497 case Qt::ToolTipRole:
499 case Qt::DecorationRole:
506 QString name = tr(
"All Symbology and Labeling Categories" );
507 QString description = mLayerType ==
Qgis::LayerType::Vector ? tr(
"All symbology, labeling and diagram categories" ) : tr(
"All symbology and labeling categories" );
512 case Qt::DisplayRole:
513 return htmlStylePattern.arg( name ).arg( description );
514 case Qt::ToolTipRole:
516 case Qt::DecorationRole:
523 QString name = tr(
"All Style Categories" );
524 QString description = tr(
"All style categories" );
529 case Qt::DisplayRole:
530 return htmlStylePattern.arg( name ).arg( description );
531 case Qt::ToolTipRole:
532 case Qt::DecorationRole:
543 if ( !index.isValid() || index.row() >=
rowCount() )
546 if ( role == Qt::CheckStateRole )
549 if ( value.value<Qt::CheckState>() == Qt::Checked )
551 mCategories |= category;
552 emit dataChanged( index, index );
555 else if ( value.value<Qt::CheckState>() == Qt::Unchecked )
557 mCategories &= ~category;
558 emit dataChanged( index, index );