QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsvectortilebasicrendererwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectortilebasicrendererwidget.h
3  --------------------------------------
4  Date : April 2020
5  Copyright : (C) 2020 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSVECTORTILEBASICRENDERERWIDGET_H
17 #define QGSVECTORTILEBASICRENDERERWIDGET_H
18 
20 
21 #include "ui_qgsvectortilebasicrendererwidget.h"
22 
23 #include "qgswkbtypes.h"
24 
25 #include <memory>
26 
28 #define SIP_NO_FILE
29 
31 class QgsVectorTileBasicRendererListModel;
32 class QgsVectorTileLayer;
33 class QgsMapCanvas;
34 class QgsMessageBar;
35 
42 class GUI_EXPORT QgsVectorTileBasicRendererWidget : public QgsMapLayerConfigWidget, private Ui::QgsVectorTileBasicRendererWidget
43 {
44  Q_OBJECT
45  public:
46  QgsVectorTileBasicRendererWidget( QgsVectorTileLayer *layer, QgsMapCanvas *canvas, QgsMessageBar *messageBar, QWidget *parent = nullptr );
47  ~QgsVectorTileBasicRendererWidget() override;
48 
49  void setLayer( QgsVectorTileLayer *layer );
50 
51  public slots:
53  void apply() override;
54 
55  private slots:
56  void addStyle( QgsWkbTypes::GeometryType geomType );
57  void editStyle();
58  void editStyleAtIndex( const QModelIndex &index );
59  void removeStyle();
60 
61  void updateSymbolsFromWidget();
62  void cleanUpSymbolSelector( QgsPanelWidget *container );
63 
64  private:
65  QgsVectorTileLayer *mVTLayer = nullptr;
66  std::unique_ptr<QgsVectorTileBasicRenderer> mRenderer;
67  QgsVectorTileBasicRendererListModel *mModel = nullptr;
68  QgsMessageBar *mMessageBar = nullptr;
69 };
70 
71 
73 
74 class QgsVectorTileBasicRendererListModel : public QAbstractListModel
75 {
76  Q_OBJECT
77  public:
78  QgsVectorTileBasicRendererListModel( QgsVectorTileBasicRenderer *r, QObject *parent = nullptr );
79 
80  int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
81  int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
82  QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
83  QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
84  Qt::ItemFlags flags( const QModelIndex &index ) const override;
85  bool setData( const QModelIndex &index, const QVariant &value, int role ) override;
86 
87  bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() ) override;
88 
89  void insertStyle( int row, const QgsVectorTileBasicRendererStyle &style );
90 
91  // drag'n'drop support
92  Qt::DropActions supportedDropActions() const override;
93  QStringList mimeTypes() const override;
94  QMimeData *mimeData( const QModelIndexList &indexes ) const override;
95  bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ) override;
96 
97  private:
98  QgsVectorTileBasicRenderer *mRenderer = nullptr;
99 };
100 
102 
103 #endif // QGSVECTORTILEBASICRENDERERWIDGET_H
QgsVectorTileLayer
Definition: qgsvectortilelayer.h:83
QgsMapCanvas
Definition: qgsmapcanvas.h:83
QgsVectorTileBasicRenderer
Definition: qgsvectortilebasicrenderer.h:127
QgsMapLayerConfigWidget::apply
virtual void apply()=0
Called when changes to the layer need to be made.
QgsMapLayerConfigWidget
A panel widget that can be shown in the map style dock.
Definition: qgsmaplayerconfigwidget.h:33
QgsVectorTileBasicRendererStyle
Definition: qgsvectortilebasicrenderer.h:47
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:29
QgsMessageBar
Definition: qgsmessagebar.h:60
QgsWkbTypes::GeometryType
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:139
qgsmaplayerconfigwidget.h
qgswkbtypes.h