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;
142 void disableSymbolLevels() override
SIP_SKIP;
153 int matchToSymbols(
QgsStyle *style );
156 void changeCategorizedSymbol();
157 void categoryColumnChanged( const QString &field );
158 void categoriesDoubleClicked( const QModelIndex &idx );
160 void addCategories();
165 void applyColorRamp();
167 void deleteCategories();
168 void deleteAllCategories();
170 void showSymbolLevels();
180 void matchToSymbolsFromLibrary();
188 void matchToSymbolsFromXml();
195 void pasteSymbolToSelection() override;
200 void updateSymbolsFromButton();
201 void dataDefinedSizeLegend();
208 void mergeSelectedCategories();
215 void unmergeSelectedCategories();
217 void showContextMenu( QPoint p );
219 void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
223 void updateUiFromRenderer();
226 void populateCategories();
229 int currentCategoryRow();
232 QList<
int> selectedCategories();
235 void changeSelectedSymbols();
237 void changeCategorySymbol();
239 void applyChangeToSymbol();
241 QList<
QgsSymbol *> selectedSymbols() override;
243 void refreshSymbolView() override;
244 void keyPressEvent( QKeyEvent *event ) override;
251 QgsCategorizedSymbolRendererModel *mModel =
nullptr;
254 QString mOldClassificationAttribute;
256 QMenu *mContextMenu =
nullptr;
257 QAction *mMergeCategoriesAction =
nullptr;
258 QAction *mUnmergeCategoriesAction =
nullptr;
259 QAction *mActionLevels =
nullptr;
261 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