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, QScreen *screen =
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();
69 QPointer< QScreen > mScreen;
76class QgsCategorizedSymbolRendererViewStyle:
public QgsProxyStyle
81 explicit QgsCategorizedSymbolRendererViewStyle( QWidget *parent );
83 void drawPrimitive( PrimitiveElement element,
const QStyleOption *option, QPainter *painter,
const QWidget *widget =
nullptr )
const override;
90class QgsCategorizedRendererViewItemDelegate:
public QStyledItemDelegate
95 explicit QgsCategorizedRendererViewItemDelegate(
QgsFieldExpressionWidget *expressionWidget, QObject *parent =
nullptr );
98 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
125 ValueRole = Qt::UserRole + 1
135 void disableSymbolLevels() override
SIP_SKIP;
146 int matchToSymbols(
QgsStyle *style );
149 void changeCategorizedSymbol();
150 void categoryColumnChanged( const QString &
field );
151 void categoriesDoubleClicked( const QModelIndex &idx );
153 void addCategories();
158 void applyColorRamp();
160 void deleteCategories();
161 void deleteAllCategories();
163 void showSymbolLevels();
174 void matchToSymbolsFromLibrary();
183 void matchToSymbolsFromXml();
190 void pasteSymbolToSelection() override;
195 void updateSymbolsFromWidget();
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.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
QList< QgsRendererCategory > QgsCategoryList
QList< QgsLegendSymbolItem > QgsLegendSymbolList