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;
126 ValueRole = Qt::UserRole + 1
136 void disableSymbolLevels() override
SIP_SKIP;
147 int matchToSymbols(
QgsStyle *style );
150 void changeCategorizedSymbol();
151 void categoryColumnChanged( const QString &field );
152 void categoriesDoubleClicked( const QModelIndex &idx );
154 void addCategories();
159 void applyColorRamp();
161 void deleteCategories();
162 void deleteAllCategories();
164 void showSymbolLevels();
175 void matchToSymbolsFromLibrary();
184 void matchToSymbolsFromXml();
191 void pasteSymbolToSelection() override;
196 void updateSymbolsFromButton();
197 void dataDefinedSizeLegend();
204 void mergeSelectedCategories();
211 void unmergeSelectedCategories();
213 void showContextMenu( QPoint p );
215 void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
219 void updateUiFromRenderer();
222 void populateCategories();
225 int currentCategoryRow();
228 QList<
int> selectedCategories();
231 void changeSelectedSymbols();
233 void changeCategorySymbol();
235 void applyChangeToSymbol();
237 QList<
QgsSymbol *> selectedSymbols() override;
239 void refreshSymbolView() override;
240 void keyPressEvent( QKeyEvent *event ) override;
247 QgsCategorizedSymbolRendererModel *mModel =
nullptr;
250 QString mOldClassificationAttribute;
252 QMenu *mContextMenu =
nullptr;
253 QAction *mMergeCategoriesAction =
nullptr;
254 QAction *mUnmergeCategoriesAction =
nullptr;
255 QAction *mActionLevels =
nullptr;
259 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.
QList< QgsRendererCategory > QgsCategoryList
QList< QgsLegendSymbolItem > QgsLegendSymbolList