20 : QAbstractListModel( parent )
25 mCategoryList = qgsEnumList<QgsMapLayer::StyleCategory>();
56 if ( idxAllStyleCategories > 0 )
58 mCategoryList.move( idxAllStyleCategories, 0 );
80 mShowAllCategories = showAll;
86 int count = mCategoryList.count();
87 if ( count > 0 && !mShowAllCategories )
99 if ( !index.isValid() || index.row() >=
rowCount() )
104 if ( role == Qt::UserRole )
108 if ( role == Qt::CheckStateRole )
110 return mCategories.testFlag( category ) ? Qt::Checked : Qt::Unchecked;
118 case Qt::DisplayRole:
119 return tr(
"Layer Configuration" );
120 case Qt::ToolTipRole:
121 return tr(
"Identifiable, removable, searchable, display expression, read-only, hidden" );
122 case Qt::DecorationRole:
129 case Qt::DisplayRole:
130 case Qt::ToolTipRole:
131 return tr(
"Symbology" );
132 case Qt::DecorationRole:
139 case Qt::DisplayRole:
140 return tr(
"3D Symbology" );
141 case Qt::ToolTipRole:
142 return tr(
"3D symbology" );
143 case Qt::DecorationRole:
150 case Qt::DisplayRole:
151 case Qt::ToolTipRole:
152 return tr(
"Labels" );
153 case Qt::DecorationRole:
160 case Qt::DisplayRole:
161 return tr(
"Fields" );
162 case Qt::ToolTipRole:
163 return tr(
"Aliases, widgets, WMS/WFS, expressions, constraints, virtual fields" );
164 case Qt::DecorationRole:
171 case Qt::DisplayRole:
172 return tr(
"Attribute Form" );
173 case Qt::ToolTipRole:
174 return tr(
"Attribute form settings, widget configuration" );
175 case Qt::DecorationRole:
182 case Qt::DisplayRole:
183 return tr(
"Actions" );
184 case Qt::ToolTipRole:
185 return tr(
"Map layer actions" );
186 case Qt::DecorationRole:
193 case Qt::DisplayRole:
194 return tr(
"Map Tips" );
195 case Qt::ToolTipRole:
196 return tr(
"Map tips" );
197 case Qt::DecorationRole:
204 case Qt::DisplayRole:
205 case Qt::ToolTipRole:
206 return tr(
"Diagrams" );
207 case Qt::DecorationRole:
214 case Qt::DisplayRole:
215 return tr(
"Attribute Table Configuration" );
216 case Qt::ToolTipRole:
217 return tr(
"Choice and order of columns, conditional styling" );
218 case Qt::DecorationRole:
225 case Qt::DisplayRole:
226 return tr(
"Rendering" );
227 case Qt::ToolTipRole:
228 return tr(
"Scale visibility, simplify method, opacity" );
229 case Qt::DecorationRole:
236 case Qt::DisplayRole:
237 return tr(
"Custom Properties" );
238 case Qt::ToolTipRole:
239 return tr(
"Variables, custom properties (often used by plugins and custom python code)" );
240 case Qt::DecorationRole:
247 case Qt::DisplayRole:
248 return tr(
"Geometry Options" );
249 case Qt::ToolTipRole:
250 return tr(
"Geometry constraints and validity checks" );
251 case Qt::DecorationRole:
258 case Qt::DisplayRole:
259 return tr(
"Relations" );
260 case Qt::ToolTipRole:
261 return tr(
"Relations with other layers" );
262 case Qt::DecorationRole:
270 case Qt::DisplayRole:
271 return tr(
"Temporal Properties" );
272 case Qt::ToolTipRole:
273 return tr(
"Temporal properties" );
274 case Qt::DecorationRole:
282 case Qt::DisplayRole:
283 return tr(
"Legend Settings" );
284 case Qt::ToolTipRole:
285 return tr(
"Legend settings" );
286 case Qt::DecorationRole:
294 case Qt::DisplayRole:
295 return tr(
"Elevation Properties" );
296 case Qt::ToolTipRole:
297 return tr(
"Elevation properties" );
298 case Qt::DecorationRole:
306 case Qt::DisplayRole:
307 case Qt::ToolTipRole:
308 return tr(
"Notes" );
309 case Qt::DecorationRole:
317 case Qt::DisplayRole:
318 return tr(
"All Style Categories" );
319 case Qt::ToolTipRole:
321 case Qt::DecorationRole:
332 if ( !index.isValid() || index.row() >=
rowCount() )
335 if ( role == Qt::CheckStateRole )
338 if ( value.value<Qt::CheckState>() == Qt::Checked )
340 mCategories |= category;
341 emit dataChanged( index, index );
344 else if ( value.value<Qt::CheckState>() == Qt::Unchecked )
346 mCategories &= ~category;
347 emit dataChanged( index, index );
357 return Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;
LayerType
Types of layers that can be added to a map.
@ Group
Composite group layer. Added in QGIS 3.24.
@ Plugin
Plugin based layer.
@ TiledScene
Tiled scene layer. Added in QGIS 3.34.
@ Annotation
Contains freeform, georeferenced annotations. Added in QGIS 3.16.
@ VectorTile
Vector tile layer. Added in QGIS 3.14.
@ Mesh
Mesh layer. Added in QGIS 3.2.
@ PointCloud
Point cloud layer. Added in QGIS 3.18.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
void setCategories(QgsMapLayer::StyleCategories categories)
Reset the model data.
int columnCount(const QModelIndex &=QModelIndex()) const override
QgsMapLayerStyleCategoriesModel(Qgis::LayerType type, QObject *parent=nullptr)
Constructor for QgsMapLayerStyleCategoriesModel, for the specified layer type.
Qt::ItemFlags flags(const QModelIndex &) const override
QVariant data(const QModelIndex &index, int role) const override
bool setData(const QModelIndex &index, const QVariant &value, int role) override
QgsMapLayer::StyleCategories categories() const
Returns the categories as defined in the model.
void setShowAllCategories(bool showAll)
Defines if the model should list the AllStyleCategories entry.
int rowCount(const QModelIndex &=QModelIndex()) const override
QFlags< StyleCategory > StyleCategories
StyleCategory
Categories of style to distinguish appropriate sections for import/export.
@ GeometryOptions
Geometry validation configuration.
@ AttributeTable
Attribute table settings: choice and order of columns, conditional styling.
@ LayerConfiguration
General configuration: identifiable, removable, searchable, display expression, read-only.
@ Temporal
Temporal properties.
@ Rendering
Rendering: scale visibility, simplify method, opacity.
@ Elevation
Elevation settings.
@ Symbology3D
3D symbology
@ CustomProperties
Custom properties (by plugins for instance)
@ Fields
Aliases, widgets, WMS/WFS, expressions, constraints, virtual fields.