15#ifndef QGSCATEGORIZEDSYMBOLRENDERERWIDGET_H
16#define QGSCATEGORIZEDSYMBOLRENDERERWIDGET_H
22#include <QStandardItem>
23#include <QStyledItemDelegate>
30#include "ui_qgscategorizedsymbolrendererwidget.h"
37class GUI_EXPORT QgsCategorizedSymbolRendererModel :
public QAbstractItemModel
41 QgsCategorizedSymbolRendererModel( QObject *parent =
nullptr, QScreen *screen =
nullptr );
42 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
43 Qt::DropActions supportedDropActions()
const override;
44 QVariant data(
const QModelIndex &index,
int role )
const override;
45 bool setData(
const QModelIndex &index,
const QVariant &value,
int role )
override;
46 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
47 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
48 int columnCount(
const QModelIndex & = QModelIndex() )
const override;
49 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
50 QModelIndex parent(
const QModelIndex &index )
const override;
51 QStringList mimeTypes()
const override;
52 QMimeData *mimeData(
const QModelIndexList &indexes )
const override;
53 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent )
override;
59 void deleteRows( QList<int> rows );
61 void sort(
int column, Qt::SortOrder order = Qt::AscendingOrder )
override;
62 void updateSymbology();
70 QPointer<QScreen> mScreen;
77class QgsCategorizedSymbolRendererViewStyle :
public QgsProxyStyle
82 explicit QgsCategorizedSymbolRendererViewStyle( QWidget *parent );
84 void drawPrimitive( PrimitiveElement element,
const QStyleOption *option, QPainter *painter,
const QWidget *widget =
nullptr )
const override;
91class QgsCategorizedRendererViewItemDelegate :
public QStyledItemDelegate
96 explicit QgsCategorizedRendererViewItemDelegate(
QgsFieldExpressionWidget *expressionWidget, QObject *parent =
nullptr );
99 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
141 void disableSymbolLevels() override
SIP_SKIP;
152 int matchToSymbols(
QgsStyle *style );
155 void changeCategorizedSymbol();
156 void categoryColumnChanged( const QString &field );
157 void categoriesDoubleClicked( const QModelIndex &idx );
159 void addCategories();
164 void applyColorRamp();
166 void deleteCategories();
167 void deleteAllCategories();
172 void deleteUnusedCategories();
174 void showSymbolLevels();
184 void matchToSymbolsFromLibrary();
192 void matchToSymbolsFromXml();
199 void pasteSymbolToSelection() override;
204 void updateSymbolsFromButton();
205 void dataDefinedSizeLegend();
212 void mergeSelectedCategories();
219 void unmergeSelectedCategories();
221 void showContextMenu( QPoint p );
223 void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
226 void updateUiFromRenderer();
229 void populateCategories();
232 int currentCategoryRow();
235 QList<
int> selectedCategories();
238 void changeSelectedSymbols();
240 void changeCategorySymbol();
242 void applyChangeToSymbol();
249 QList<QVariant> layerUniqueValues( const QString &attrName );
251 QList<
QgsSymbol *> selectedSymbols() override;
253 void refreshSymbolView() override;
254 void keyPressEvent( QKeyEvent *event ) override;
261 QgsCategorizedSymbolRendererModel *mModel =
nullptr;
264 QString mOldClassificationAttribute;
266 QMenu *mContextMenu =
nullptr;
267 QAction *mMergeCategoriesAction =
nullptr;
268 QAction *mUnmergeCategoriesAction =
nullptr;
269 QAction *mActionLevels =
nullptr;
271 friend class TestQgsCategorizedRendererWidget;
A feature renderer which represents features using a list of renderer categories.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Abstract base class for all 2D vector feature renderers.
A QProxyStyle subclass which correctly sets the base style to match the QGIS application style,...
Represents an individual category (class) from a QgsCategorizedSymbolRenderer.
A database of saved style entities, including symbols, color ramps, text formats and others.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
Abstract base class for all rendered symbols.
Represents a vector layer which manages a vector based dataset.
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
QList< QgsRendererCategory > QgsCategoryList
QList< QgsLegendSymbolItem > QgsLegendSymbolList