15#ifndef QGSCATEGORIZEDSYMBOLRENDERERWIDGET_H
16#define QGSCATEGORIZEDSYMBOLRENDERERWIDGET_H
22#include <QStandardItem>
23#include <QStyledItemDelegate>
29#include "ui_qgscategorizedsymbolrendererwidget.h"
36class GUI_EXPORT QgsCategorizedSymbolRendererModel :
public QAbstractItemModel
40 QgsCategorizedSymbolRendererModel( QObject *parent =
nullptr );
41 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
42 Qt::DropActions supportedDropActions()
const override;
43 QVariant data(
const QModelIndex &index,
int role )
const override;
44 bool setData(
const QModelIndex &index,
const QVariant &value,
int role )
override;
45 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
46 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
47 int columnCount(
const QModelIndex & = QModelIndex() )
const override;
48 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
49 QModelIndex parent(
const QModelIndex &index )
const override;
50 QStringList mimeTypes()
const override;
51 QMimeData *mimeData(
const QModelIndexList &indexes )
const override;
52 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent )
override;
58 void deleteRows( QList<int> rows );
60 void sort(
int column, Qt::SortOrder order = Qt::AscendingOrder )
override;
61 void updateSymbology();
75class QgsCategorizedSymbolRendererViewStyle:
public QgsProxyStyle
80 explicit QgsCategorizedSymbolRendererViewStyle( QWidget *parent );
82 void drawPrimitive( PrimitiveElement element,
const QStyleOption *option, QPainter *painter,
const QWidget *widget =
nullptr )
const override;
89class QgsCategorizedRendererViewItemDelegate:
public QStyledItemDelegate
94 explicit QgsCategorizedRendererViewItemDelegate(
QgsFieldExpressionWidget *expressionWidget, QObject *parent =
nullptr );
97 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
124 ValueRole = Qt::UserRole + 1
134 void disableSymbolLevels() override
SIP_SKIP;
145 int matchToSymbols(
QgsStyle *style );
148 void changeCategorizedSymbol();
149 void categoryColumnChanged( const QString &
field );
150 void categoriesDoubleClicked( const QModelIndex &idx );
152 void addCategories();
157 void applyColorRamp();
159 void deleteCategories();
160 void deleteAllCategories();
162 void showSymbolLevels();
173 void matchToSymbolsFromLibrary();
182 void matchToSymbolsFromXml();
189 void pasteSymbolToSelection() override;
194 void updateSymbolsFromWidget();
195 void updateSymbolsFromButton();
196 void dataDefinedSizeLegend();
203 void mergeSelectedCategories();
210 void unmergeSelectedCategories();
212 void showContextMenu( QPoint p );
214 void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
218 void updateUiFromRenderer();
221 void populateCategories();
224 int currentCategoryRow();
227 QList<
int> selectedCategories();
230 void changeSelectedSymbols();
232 void changeCategorySymbol();
234 void applyChangeToSymbol();
236 QList<
QgsSymbol *> selectedSymbols() override;
238 void refreshSymbolView() override;
239 void keyPressEvent( QKeyEvent *event ) override;
246 QgsCategorizedSymbolRendererModel *mModel =
nullptr;
249 QString mOldClassificationAttribute;
251 QMenu *mContextMenu =
nullptr;
252 QAction *mMergeCategoriesAction =
nullptr;
253 QAction *mUnmergeCategoriesAction =
nullptr;
254 QAction *mActionLevels =
nullptr;
258 friend class TestQgsCategorizedRendererWidget;
Abstract interface for generating an expression context.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
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.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
QList< QgsRendererCategory > QgsCategoryList
QList< QgsLegendSymbolItem > QgsLegendSymbolList