20 : QAbstractListModel( parent )
25 mCategoryList = qgsEnumList<QgsMapLayer::StyleCategory>();
47 if ( idxAllStyleCategories > 0 )
49 mCategoryList.move( idxAllStyleCategories, 0 );
71 mShowAllCategories = showAll;
77 int count = mCategoryList.count();
78 if ( count > 0 && !mShowAllCategories )
90 if ( !index.isValid() || index.row() >=
rowCount() )
95 if ( role == Qt::UserRole )
99 if ( role == Qt::CheckStateRole )
101 return mCategories.testFlag( category ) ? Qt::Checked : Qt::Unchecked;
109 case Qt::DisplayRole:
110 return tr(
"Layer Configuration" );
111 case Qt::ToolTipRole:
112 return tr(
"Identifiable, removable, searchable, display expression, read-only, hidden" );
113 case Qt::DecorationRole:
120 case Qt::DisplayRole:
121 case Qt::ToolTipRole:
122 return tr(
"Symbology" );
123 case Qt::DecorationRole:
130 case Qt::DisplayRole:
131 return tr(
"3D Symbology" );
132 case Qt::ToolTipRole:
133 return tr(
"3D symbology" );
134 case Qt::DecorationRole:
141 case Qt::DisplayRole:
142 case Qt::ToolTipRole:
143 return tr(
"Labels" );
144 case Qt::DecorationRole:
151 case Qt::DisplayRole:
152 return tr(
"Fields" );
153 case Qt::ToolTipRole:
154 return tr(
"Aliases, widgets, WMS/WFS, expressions, constraints, virtual fields" );
155 case Qt::DecorationRole:
162 case Qt::DisplayRole:
163 return tr(
"Attribute Form" );
164 case Qt::ToolTipRole:
165 return tr(
"Attribute form settings, widget configuration" );
166 case Qt::DecorationRole:
173 case Qt::DisplayRole:
174 return tr(
"Actions" );
175 case Qt::ToolTipRole:
176 return tr(
"Map layer actions" );
177 case Qt::DecorationRole:
184 case Qt::DisplayRole:
185 return tr(
"Map Tips" );
186 case Qt::ToolTipRole:
187 return tr(
"Map tips" );
188 case Qt::DecorationRole:
195 case Qt::DisplayRole:
196 case Qt::ToolTipRole:
197 return tr(
"Diagrams" );
198 case Qt::DecorationRole:
205 case Qt::DisplayRole:
206 return tr(
"Attribute Table Configuration" );
207 case Qt::ToolTipRole:
208 return tr(
"Choice and order of columns, conditional styling" );
209 case Qt::DecorationRole:
216 case Qt::DisplayRole:
217 return tr(
"Rendering" );
218 case Qt::ToolTipRole:
219 return tr(
"Scale visibility, simplify method, opacity" );
220 case Qt::DecorationRole:
227 case Qt::DisplayRole:
228 return tr(
"Custom Properties" );
229 case Qt::ToolTipRole:
230 return tr(
"Variables, custom properties (often used by plugins and custom python code)" );
231 case Qt::DecorationRole:
238 case Qt::DisplayRole:
239 return tr(
"Geometry Options" );
240 case Qt::ToolTipRole:
241 return tr(
"Geometry constraints and validity checks" );
242 case Qt::DecorationRole:
249 case Qt::DisplayRole:
250 return tr(
"Relations" );
251 case Qt::ToolTipRole:
252 return tr(
"Relations with other layers" );
253 case Qt::DecorationRole:
261 case Qt::DisplayRole:
262 return tr(
"Temporal Properties" );
263 case Qt::ToolTipRole:
264 return tr(
"Temporal properties" );
265 case Qt::DecorationRole:
273 case Qt::DisplayRole:
274 return tr(
"Legend Settings" );
275 case Qt::ToolTipRole:
276 return tr(
"Legend settings" );
277 case Qt::DecorationRole:
285 case Qt::DisplayRole:
286 return tr(
"Elevation Properties" );
287 case Qt::ToolTipRole:
288 return tr(
"Elevation properties" );
289 case Qt::DecorationRole:
297 case Qt::DisplayRole:
298 case Qt::ToolTipRole:
299 return tr(
"Notes" );
300 case Qt::DecorationRole:
308 case Qt::DisplayRole:
309 return tr(
"All Style Categories" );
310 case Qt::ToolTipRole:
312 case Qt::DecorationRole:
323 if ( !index.isValid() || index.row() >=
rowCount() )
326 if ( role == Qt::CheckStateRole )
329 if ( value.value<Qt::CheckState>() == Qt::Checked )
331 mCategories |= category;
332 emit dataChanged( index, index );
335 else if ( value.value<Qt::CheckState>() == Qt::Unchecked )
337 mCategories &= ~category;
338 emit dataChanged( index, index );
348 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
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.
@ Notes
Layer user notes (since QGIS 3.20)
@ Temporal
Temporal properties (since QGIS 3.14)
@ Rendering
Rendering: scale visibility, simplify method, opacity.
@ Elevation
Elevation settings (since QGIS 3.18)
@ Symbology3D
3D symbology
@ CustomProperties
Custom properties (by plugins for instance)
@ Fields
Aliases, widgets, WMS/WFS, expressions, constraints, virtual fields.
@ Legend
Legend settings (since QGIS 3.16)