16 #ifndef QGSVECTORTILEBASICRENDERERWIDGET_H
17 #define QGSVECTORTILEBASICRENDERERWIDGET_H
21 #include "ui_qgsvectortilebasicrendererwidget.h"
26 #include <QSortFilterProxyModel>
33 class QgsVectorTileBasicRendererListModel;
37 class QgsVectorTileBasicRendererProxyModel;
45 class GUI_EXPORT QgsVectorTileBasicRendererWidget :
public QgsMapLayerConfigWidget,
private Ui::QgsVectorTileBasicRendererWidget
50 ~QgsVectorTileBasicRendererWidget()
override;
56 void apply()
override;
61 void editStyleAtIndex(
const QModelIndex &index );
64 void updateSymbolsFromWidget();
68 QPointer< QgsVectorTileLayer > mVTLayer;
69 std::unique_ptr<QgsVectorTileBasicRenderer> mRenderer;
70 QgsVectorTileBasicRendererListModel *mModel =
nullptr;
71 QgsVectorTileBasicRendererProxyModel *mProxyModel =
nullptr;
79 class QgsVectorTileBasicRendererListModel :
public QAbstractListModel
86 MinZoom = Qt::UserRole + 1,
95 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
96 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
97 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
98 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
99 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
100 bool setData(
const QModelIndex &index,
const QVariant &value,
int role )
override;
102 bool removeRows(
int row,
int count,
const QModelIndex &parent = QModelIndex() )
override;
107 Qt::DropActions supportedDropActions()
const override;
108 QStringList mimeTypes()
const override;
109 QMimeData *mimeData(
const QModelIndexList &indexes )
const override;
110 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent )
override;
116 class QgsVectorTileBasicRendererProxyModel :
public QSortFilterProxyModel
120 QgsVectorTileBasicRendererProxyModel( QgsVectorTileBasicRendererListModel *source, QObject *parent =
nullptr );
122 void setCurrentZoom(
int zoom );
123 void setFilterVisible(
bool enabled );
124 void setFilterString(
const QString &
string );
126 bool filterAcceptsRow(
int source_row,
const QModelIndex &source_parent )
const override;
130 bool mFilterVisible =
false;
131 QString mFilterString;
132 int mCurrentZoom = -1;
137 #endif // QGSVECTORTILEBASICRENDERERWIDGET_H