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;
112 int matchToSymbols(
QgsStyle *style );
115 void changeCategorizedSymbol();
116 void categoryColumnChanged(
const QString &field );
117 void categoriesDoubleClicked(
const QModelIndex &idx );
119 void addCategories();
124 void applyColorRamp();
126 void deleteCategories();
127 void deleteAllCategories();
129 void showSymbolLevels();
140 void matchToSymbolsFromLibrary();
149 void matchToSymbolsFromXml();
154 void updateSymbolsFromWidget();
155 void dataDefinedSizeLegend();
162 void mergeSelectedCategories();
169 void unmergeSelectedCategories();
171 void showContextMenu( QPoint p );
175 void updateUiFromRenderer();
177 void updateCategorizedSymbolIcon();
180 void populateCategories();
183 int currentCategoryRow();
186 QList<int> selectedCategories();
189 void changeSelectedSymbols();
191 void changeCategorySymbol();
193 void applyChangeToSymbol();
195 QList<QgsSymbol *> selectedSymbols()
override;
197 void refreshSymbolView()
override;
198 void keyPressEvent( QKeyEvent *event )
override;
201 std::unique_ptr< QgsCategorizedSymbolRenderer >
mRenderer;
205 QgsCategorizedSymbolRendererModel *mModel =
nullptr;
208 QString mOldClassificationAttribute;
210 QMenu *mContextMenu =
nullptr;
211 QAction *mMergeCategoriesAction =
nullptr;
212 QAction *mUnmergeCategoriesAction =
nullptr;
216 friend class TestQgsCategorizedRendererWidget;
219 #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
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.