20 : QAbstractListModel( parent )
22 mCategoryList = qgsEnumMap<QgsMapLayer::StyleCategory>().keys();
45 mShowAllCategories = showAll;
51 int count = mCategoryList.count();
52 if ( !mShowAllCategories )
64 if ( !index.isValid() || index.row() >=
rowCount() )
69 if ( role == Qt::UserRole )
73 if ( role == Qt::CheckStateRole )
75 return mCategories.testFlag( category ) ? Qt::Checked : Qt::Unchecked;
80 case QgsMapLayer::StyleCategory::LayerConfiguration:
84 return tr(
"Layer Configuration" );
86 return tr(
"Identifiable, removable, searchable, display expression, read-only" );
87 case Qt::DecorationRole:
91 case QgsMapLayer::StyleCategory::Symbology:
95 return tr(
"Symbology" );
98 case Qt::DecorationRole:
102 case QgsMapLayer::StyleCategory::Symbology3D:
105 case Qt::DisplayRole:
106 return tr(
"3D Symbology" );
107 case Qt::ToolTipRole:
109 case Qt::DecorationRole:
113 case QgsMapLayer::StyleCategory::Labeling:
116 case Qt::DisplayRole:
117 return tr(
"Labels" );
118 case Qt::ToolTipRole:
120 case Qt::DecorationRole:
124 case QgsMapLayer::StyleCategory::Fields:
127 case Qt::DisplayRole:
128 return tr(
"Fields" );
129 case Qt::ToolTipRole:
130 return tr(
"Aliases, widgets, WMS/WFS, expressions, constraints, virtual fields" );
131 case Qt::DecorationRole:
135 case QgsMapLayer::StyleCategory::Forms:
138 case Qt::DisplayRole:
139 return tr(
"Forms" );
140 case Qt::ToolTipRole:
142 case Qt::DecorationRole:
146 case QgsMapLayer::StyleCategory::Actions:
149 case Qt::DisplayRole:
150 return tr(
"Actions" );
151 case Qt::ToolTipRole:
153 case Qt::DecorationRole:
157 case QgsMapLayer::StyleCategory::MapTips:
160 case Qt::DisplayRole:
161 return tr(
"Map Tips" );
162 case Qt::ToolTipRole:
164 case Qt::DecorationRole:
168 case QgsMapLayer::StyleCategory::Diagrams:
171 case Qt::DisplayRole:
172 return tr(
"Diagrams" );
173 case Qt::ToolTipRole:
175 case Qt::DecorationRole:
179 case QgsMapLayer::StyleCategory::AttributeTable:
182 case Qt::DisplayRole:
183 return tr(
"Attribute Table Settings" );
184 case Qt::ToolTipRole:
185 return tr(
"Choice and order of columns, conditional styling" );
186 case Qt::DecorationRole:
190 case QgsMapLayer::StyleCategory::Rendering:
193 case Qt::DisplayRole:
194 return tr(
"Rendering" );
195 case Qt::ToolTipRole:
196 return tr(
"Scale visibility, simplify method, opacity" );
197 case Qt::DecorationRole:
201 case QgsMapLayer::StyleCategory::CustomProperties:
204 case Qt::DisplayRole:
205 return tr(
"Custom Properties" );
206 case Qt::ToolTipRole:
208 case Qt::DecorationRole:
212 case QgsMapLayer::StyleCategory::GeometryOptions:
215 case Qt::DisplayRole:
216 return tr(
"Geometry Options" );
217 case Qt::ToolTipRole:
218 return tr(
"Geometry constraints and validity checks" );
219 case Qt::DecorationRole:
223 case QgsMapLayer::StyleCategory::Relations:
226 case Qt::DisplayRole:
227 return tr(
"Relations" );
228 case Qt::ToolTipRole:
229 return tr(
"Relations with other layers" );
230 case Qt::DecorationRole:
235 case QgsMapLayer::StyleCategory::Temporal:
238 case Qt::DisplayRole:
239 return tr(
"Temporal Properties" );
240 case Qt::ToolTipRole:
241 return tr(
"Temporal properties" );
242 case Qt::DecorationRole:
247 case QgsMapLayer::StyleCategory::AllStyleCategories:
250 case Qt::DisplayRole:
251 return tr(
"All Style Categories" );
252 case Qt::ToolTipRole:
254 case Qt::DecorationRole:
265 if ( !index.isValid() || index.row() >=
rowCount() )
268 if ( role == Qt::CheckStateRole )
271 if ( value.value<Qt::CheckState>() == Qt::Checked )
273 mCategories |= category;
274 emit dataChanged( index, index );
277 else if ( value.value<Qt::CheckState>() == Qt::Unchecked )
279 mCategories &= ~category;
280 emit dataChanged( index, index );
290 return Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;