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;
140 void disableSymbolLevels() override
SIP_SKIP;
151 int matchToSymbols(
QgsStyle *style );
154 void changeCategorizedSymbol();
155 void categoryColumnChanged( const QString &field );
156 void categoriesDoubleClicked( const QModelIndex &idx );
158 void addCategories();
163 void applyColorRamp();
165 void deleteCategories();
166 void deleteAllCategories();
168 void showSymbolLevels();
178 void matchToSymbolsFromLibrary();
186 void matchToSymbolsFromXml();
193 void pasteSymbolToSelection() override;
198 void updateSymbolsFromButton();
199 void dataDefinedSizeLegend();
206 void mergeSelectedCategories();
213 void unmergeSelectedCategories();
215 void showContextMenu( QPoint p );
217 void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
220 void updateUiFromRenderer();
223 void populateCategories();
226 int currentCategoryRow();
229 QList<
int> selectedCategories();
232 void changeSelectedSymbols();
234 void changeCategorySymbol();
236 void applyChangeToSymbol();
238 QList<
QgsSymbol *> selectedSymbols() override;
240 void refreshSymbolView() override;
241 void keyPressEvent( QKeyEvent *event ) override;
248 QgsCategorizedSymbolRendererModel *mModel =
nullptr;
251 QString mOldClassificationAttribute;
253 QMenu *mContextMenu =
nullptr;
254 QAction *mMergeCategoriesAction =
nullptr;
255 QAction *mUnmergeCategoriesAction =
nullptr;
256 QAction *mActionLevels =
nullptr;
258 friend class TestQgsCategorizedRendererWidget;
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.
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 data sets.
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
QList< QgsRendererCategory > QgsCategoryList
QList< QgsLegendSymbolItem > QgsLegendSymbolList