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 return tr(
"Symbology" );
122 case Qt::ToolTipRole:
124 case Qt::DecorationRole:
131 case Qt::DisplayRole:
132 return tr(
"3D Symbology" );
133 case Qt::ToolTipRole:
135 case Qt::DecorationRole:
142 case Qt::DisplayRole:
143 return tr(
"Labels" );
144 case Qt::ToolTipRole:
146 case Qt::DecorationRole:
153 case Qt::DisplayRole:
154 return tr(
"Fields" );
155 case Qt::ToolTipRole:
156 return tr(
"Aliases, widgets, WMS/WFS, expressions, constraints, virtual fields" );
157 case Qt::DecorationRole:
164 case Qt::DisplayRole:
165 return tr(
"Forms" );
166 case Qt::ToolTipRole:
168 case Qt::DecorationRole:
175 case Qt::DisplayRole:
176 return tr(
"Actions" );
177 case Qt::ToolTipRole:
179 case Qt::DecorationRole:
186 case Qt::DisplayRole:
187 return tr(
"Map Tips" );
188 case Qt::ToolTipRole:
190 case Qt::DecorationRole:
197 case Qt::DisplayRole:
198 return tr(
"Diagrams" );
199 case Qt::ToolTipRole:
201 case Qt::DecorationRole:
208 case Qt::DisplayRole:
209 return tr(
"Attribute Table Settings" );
210 case Qt::ToolTipRole:
211 return tr(
"Choice and order of columns, conditional styling" );
212 case Qt::DecorationRole:
219 case Qt::DisplayRole:
220 return tr(
"Rendering" );
221 case Qt::ToolTipRole:
222 return tr(
"Scale visibility, simplify method, opacity" );
223 case Qt::DecorationRole:
230 case Qt::DisplayRole:
231 return tr(
"Custom Properties" );
232 case Qt::ToolTipRole:
234 case Qt::DecorationRole:
241 case Qt::DisplayRole:
242 return tr(
"Geometry Options" );
243 case Qt::ToolTipRole:
244 return tr(
"Geometry constraints and validity checks" );
245 case Qt::DecorationRole:
252 case Qt::DisplayRole:
253 return tr(
"Relations" );
254 case Qt::ToolTipRole:
255 return tr(
"Relations with other layers" );
256 case Qt::DecorationRole:
264 case Qt::DisplayRole:
265 return tr(
"Temporal Properties" );
266 case Qt::ToolTipRole:
267 return tr(
"Temporal properties" );
268 case Qt::DecorationRole:
276 case Qt::DisplayRole:
277 return tr(
"Legend Settings" );
278 case Qt::ToolTipRole:
279 return tr(
"Legend settings" );
280 case Qt::DecorationRole:
288 case Qt::DisplayRole:
289 return tr(
"Elevation Properties" );
290 case Qt::ToolTipRole:
291 return tr(
"Elevation properties" );
292 case Qt::DecorationRole:
300 case Qt::DisplayRole:
301 case Qt::ToolTipRole:
302 return tr(
"Notes" );
303 case Qt::DecorationRole:
311 case Qt::DisplayRole:
312 return tr(
"All Style Categories" );
313 case Qt::ToolTipRole:
315 case Qt::DecorationRole:
326 if ( !index.isValid() || index.row() >=
rowCount() )
329 if ( role == Qt::CheckStateRole )
332 if ( value.value<Qt::CheckState>() == Qt::Checked )
334 mCategories |= category;
335 emit dataChanged( index, index );
338 else if ( value.value<Qt::CheckState>() == Qt::Unchecked )
340 mCategories &= ~category;
341 emit dataChanged( index, index );
351 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)