15 #ifndef QGSCATEGORIZEDSYMBOLRENDERERWIDGET_H 16 #define QGSCATEGORIZEDSYMBOLRENDERERWIDGET_H 22 #include <QStandardItem> 28 #include "ui_qgscategorizedsymbolrendererwidget.h" 35 class GUI_EXPORT QgsCategorizedSymbolRendererModel :
public QAbstractItemModel
39 QgsCategorizedSymbolRendererModel( QObject *parent =
nullptr );
40 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
41 Qt::DropActions supportedDropActions()
const override;
42 QVariant data(
const QModelIndex &index,
int role )
const override;
43 bool setData(
const QModelIndex &index,
const QVariant &value,
int role )
override;
44 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
45 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
46 int columnCount(
const QModelIndex & = QModelIndex() )
const override;
47 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
48 QModelIndex parent(
const QModelIndex &index )
const override;
49 QStringList mimeTypes()
const override;
50 QMimeData *mimeData(
const QModelIndexList &indexes )
const override;
51 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent )
override;
57 void deleteRows( QList<int> rows );
59 void sort(
int column, Qt::SortOrder order = Qt::AscendingOrder )
override;
60 void updateSymbology();
74 class QgsCategorizedSymbolRendererViewStyle:
public QgsProxyStyle 79 explicit QgsCategorizedSymbolRendererViewStyle( QWidget *parent );
81 void drawPrimitive( PrimitiveElement element,
const QStyleOption *option, QPainter *painter,
const QWidget *widget =
nullptr )
const override;
99 ~QgsCategorizedSymbolRendererWidget()
override;
113 int matchToSymbols(
QgsStyle *style );
116 void changeCategorizedSymbol();
117 void categoryColumnChanged(
const QString &field );
118 void categoriesDoubleClicked(
const QModelIndex &idx );
120 void addCategories();
125 void applyColorRamp();
127 void deleteCategories();
128 void deleteAllCategories();
130 void showSymbolLevels();
141 void matchToSymbolsFromLibrary();
150 void matchToSymbolsFromXml();
154 void pasteSymbolToSelection()
override;
159 void updateSymbolsFromWidget();
160 void updateSymbolsFromButton();
161 void dataDefinedSizeLegend();
168 void mergeSelectedCategories();
175 void unmergeSelectedCategories();
177 void showContextMenu( QPoint p );
179 void selectionChanged(
const QItemSelection &selected,
const QItemSelection &deselected );
183 void updateUiFromRenderer();
186 void populateCategories();
189 int currentCategoryRow();
192 QList<int> selectedCategories();
195 void changeSelectedSymbols();
197 void changeCategorySymbol();
199 void applyChangeToSymbol();
201 QList<QgsSymbol *> selectedSymbols()
override;
203 void refreshSymbolView()
override;
204 void keyPressEvent( QKeyEvent *event )
override;
207 std::unique_ptr< QgsCategorizedSymbolRenderer >
mRenderer;
211 QgsCategorizedSymbolRendererModel *mModel =
nullptr;
214 QString mOldClassificationAttribute;
216 QMenu *mContextMenu =
nullptr;
217 QAction *mMergeCategoriesAction =
nullptr;
218 QAction *mUnmergeCategoriesAction =
nullptr;
222 friend class TestQgsCategorizedRendererWidget;
225 #endif // QGSCATEGORIZEDSYMBOLRENDERERWIDGET_H Represents an individual category (class) from a QgsCategorizedSymbolRenderer.
A QProxyStyle subclass which correctly sets the base style to match the QGIS application style...
QList< QgsRendererCategory > QgsCategoryList
Contains settings which reflect the context in which a symbol (or renderer) widget is shown...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Abstract interface for generating an expression context.
Represents a vector layer which manages a vector based data sets.