142 const int filteredRowCount =
rowCount();
144 if ( !index.isValid() || index.row() >= filteredRowCount )
147 const QgsMapLayer::StyleCategory category = mCategoryList.at( index.row() + ( mShowAllCategories ? 0 : mCategoryList.count() - filteredRowCount ) );
149 if ( role == Qt::UserRole )
153 if ( role == Qt::CheckStateRole )
155 return mCategories.testFlag( category ) ? Qt::Checked : Qt::Unchecked;
158 QString htmlStylePattern = QStringLiteral(
"<p><b>%1</b><br/><span style='color:gray;'>%2</span></p>" );
163 QString name = tr(
"Layer Configuration" );
164 QString description = tr(
"The layers display expression and the datasource flags: identifiable, removable, searchable, read-only and hidden from the project settings" );
169 case Qt::DisplayRole:
170 return htmlStylePattern.arg( name ).arg( description );
171 case Qt::ToolTipRole:
173 case Qt::DecorationRole:
180 QString name = tr(
"Symbology" );
181 QString description = tr(
"Everything from the symbology section" );
186 case Qt::DisplayRole:
188 return htmlStylePattern.arg( name ).arg( description );
189 case Qt::ToolTipRole:
191 case Qt::DecorationRole:
198 QString name = tr(
"3D Symbology" );
199 QString description = tr(
"Everything from the 3D symbology section" );
204 case Qt::DisplayRole:
206 return htmlStylePattern.arg( name ).arg( description );
207 case Qt::ToolTipRole:
209 case Qt::DecorationRole:
216 QString name = tr(
"Labels" );
217 QString description = tr(
"Everything from the labels section" );
222 case Qt::DisplayRole:
224 return htmlStylePattern.arg( name ).arg( description );
225 case Qt::ToolTipRole:
227 case Qt::DecorationRole:
234 QString name = tr(
"Fields" );
235 QString description = tr(
"Virtual fields, aliases, default value expressions and constraints from the form section and WMS/WFS exposure" );
240 case Qt::DisplayRole:
242 return htmlStylePattern.arg( name ).arg( description );
243 case Qt::ToolTipRole:
245 case Qt::DecorationRole:
252 QString name = tr(
"Attribute Form" );
253 QString description = tr(
"Form layout and widget configuration (no constraints and default value expressions)" );
258 case Qt::DisplayRole:
260 return htmlStylePattern.arg( name ).arg( description );
261 case Qt::ToolTipRole:
263 case Qt::DecorationRole:
270 QString name = tr(
"Actions" );
271 QString description = tr(
"Everything from the actions section" );
276 case Qt::DisplayRole:
278 return htmlStylePattern.arg( name ).arg( description );
279 case Qt::ToolTipRole:
281 case Qt::DecorationRole:
288 QString name = tr(
"Map Tips" );
289 QString description = tr(
"Map tips settings (no layer display expression)" );
294 case Qt::DisplayRole:
296 return htmlStylePattern.arg( name ).arg( description );
297 case Qt::ToolTipRole:
299 case Qt::DecorationRole:
306 QString name = tr(
"Diagrams" );
307 QString description = tr(
"Everything from the diagram section" );
312 case Qt::DisplayRole:
314 return htmlStylePattern.arg( name ).arg( description );
315 case Qt::ToolTipRole:
317 case Qt::DecorationRole:
324 QString name = tr(
"Attribute Table Configuration" );
325 QString description = tr(
"Attribute table settings: choice and order of columns and conditional styling" );
330 case Qt::DisplayRole:
332 return htmlStylePattern.arg( name ).arg( description );
333 case Qt::ToolTipRole:
335 case Qt::DecorationRole:
342 QString name = tr(
"Rendering" );
343 QString description = tr(
"Everything from the rendering section: Scale visibility, simplify method, opacity, auto refresh etc." );
348 case Qt::DisplayRole:
350 return htmlStylePattern.arg( name ).arg( description );
351 case Qt::ToolTipRole:
353 case Qt::DecorationRole:
360 QString name = tr(
"Custom Properties" );
361 QString description = tr(
"Layer variables and embedded legend widgets as well as all the custom properties (often used by plugins and custom python code)" );
366 case Qt::DisplayRole:
368 return htmlStylePattern.arg( name ).arg( description );
369 case Qt::ToolTipRole:
371 case Qt::DecorationRole:
378 QString name = tr(
"Geometry Options" );
379 QString description = tr(
"Geometry constraints and validity checks" );
384 case Qt::DisplayRole:
386 return htmlStylePattern.arg( name ).arg( description );
387 case Qt::ToolTipRole:
389 case Qt::DecorationRole:
396 QString name = tr(
"Relations" );
397 QString description = tr(
"The relations this layer has with other layers" );
402 case Qt::DisplayRole:
404 return htmlStylePattern.arg( name ).arg( description );
405 case Qt::ToolTipRole:
407 case Qt::DecorationRole:
414 QString name = tr(
"Temporal Properties" );
415 QString description = tr(
"Everything from the temporal section" );
420 case Qt::DisplayRole:
422 return htmlStylePattern.arg( name ).arg( description );
423 case Qt::ToolTipRole:
425 case Qt::DecorationRole:
432 QString name = tr(
"Legend Settings" );
433 QString description = tr(
"Legend settings (no embedded legend widgets)" );
438 case Qt::DisplayRole:
440 return htmlStylePattern.arg( name ).arg( description );
441 case Qt::ToolTipRole:
443 case Qt::DecorationRole:
450 QString name = tr(
"Elevation Properties" );
451 QString description = tr(
"Everything from the elevation section" );
456 case Qt::DisplayRole:
458 return htmlStylePattern.arg( name ).arg( description );
459 case Qt::ToolTipRole:
461 case Qt::DecorationRole:
468 QString name = tr(
"Notes" );
469 QString description = tr(
"The layer notes" );
474 case Qt::DisplayRole:
476 return htmlStylePattern.arg( name ).arg( description );
477 case Qt::ToolTipRole:
479 case Qt::DecorationRole:
486 QString name = tr(
"All Fields and Attribute Form Categories" );
487 QString description = tr(
"All fields and attribute form categories" );
492 case Qt::DisplayRole:
493 return htmlStylePattern.arg( name ).arg( description );
494 case Qt::ToolTipRole:
496 case Qt::DecorationRole:
503 QString name = tr(
"All Symbology and Labeling Categories" );
504 QString description = mLayerType ==
Qgis::LayerType::Vector ? tr(
"All symbology, labeling and diagram categories" ) : tr(
"All symbology and labeling categories" );
509 case Qt::DisplayRole:
510 return htmlStylePattern.arg( name ).arg( description );
511 case Qt::ToolTipRole:
513 case Qt::DecorationRole:
520 QString name = tr(
"All Style Categories" );
521 QString description = tr(
"All style categories" );
526 case Qt::DisplayRole:
527 return htmlStylePattern.arg( name ).arg( description );
528 case Qt::ToolTipRole:
529 case Qt::DecorationRole:
540 if ( !index.isValid() || index.row() >=
rowCount() )
543 if ( role == Qt::CheckStateRole )
546 if ( value.value<Qt::CheckState>() == Qt::Checked )
548 mCategories |= category;
549 emit dataChanged( index, index );
552 else if ( value.value<Qt::CheckState>() == Qt::Unchecked )
554 mCategories &= ~category;
555 emit dataChanged( index, index );