QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgsdatadefinedsizelegendwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsdatadefinedsizelegendwidget.h
3 --------------------------------------
4 Date : June 2017
5 Copyright : (C) 2017 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 QGSDATADEFINEDSIZELEGENDWIDGET_H
17#define QGSDATADEFINEDSIZELEGENDWIDGET_H
18
19#include "qgis_sip.h"
20#include "qgis_gui.h"
21
22#include <memory>
23#include "ui_qgsdatadefinedsizelegendwidget.h"
24
25#include "qgspanelwidget.h"
26#include "qgsdoublevalidator.h"
27#include "qgsproperty.h"
28#include <QStyledItemDelegate>
29
30class QStandardItemModel;
31
33class QgsLayerTree;
36class QgsMapCanvas;
37class QgsMarkerSymbol;
38class QgsProperty;
39class QgsVectorLayer;
40
46class GUI_EXPORT QgsDataDefinedSizeLegendWidget : public QgsPanelWidget, private Ui::QgsDataDefinedSizeLegendWidget
47{
48 Q_OBJECT
49 public:
56 explicit QgsDataDefinedSizeLegendWidget( const QgsDataDefinedSizeLegend *ddsLegend, const QgsProperty &ddSize, QgsMarkerSymbol *overrideSymbol SIP_TRANSFER, QgsMapCanvas *canvas = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
58
60 QgsDataDefinedSizeLegend *dataDefinedSizeLegend() const SIP_FACTORY;
61
62 signals:
63
64 private slots:
65 void updatePreview();
66 void changeSymbol();
67 void addSizeClass();
68 void removeSizeClass();
69 void onSizeClassesChanged();
70
71 private:
72 std::unique_ptr<QgsMarkerSymbol> mSourceSymbol;
73 bool mOverrideSymbol = false;
74 QgsProperty mSizeProperty;
75 QgsLayerTreeModel *mPreviewModel = nullptr;
76 QgsLayerTree *mPreviewTree = nullptr;
77 QgsLayerTreeLayer *mPreviewLayerNode = nullptr;
78 QgsVectorLayer *mPreviewLayer = nullptr;
79 QgsMapCanvas *mMapCanvas = nullptr;
80 QStandardItemModel *mSizeClassesModel = nullptr;
81};
82
83#ifndef SIP_RUN
85
87class SizeClassDelegate : public QStyledItemDelegate
88{
89 Q_OBJECT
90
91 public:
92 SizeClassDelegate( QObject *parent )
93 : QStyledItemDelegate( parent )
94 {
95 }
96
97 QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &, const QModelIndex & ) const override
98 {
99 QLineEdit *lineEdit = new QLineEdit( parent );
100 QgsDoubleValidator *validator = new QgsDoubleValidator( 0, 1e6, 1, lineEdit );
101 lineEdit->setValidator( validator );
102 return lineEdit;
103 }
104};
105
107#endif
108
109#endif // QGSDATADEFINEDSIZELEGENDWIDGET_H
Widget for configuration of appearance of legend for marker symbols with data-defined size.
Object that keeps configuration of appearance of marker symbol's data-defined size in legend.
QgsDoubleValidator is a QLineEdit Validator that combines QDoubleValidator and QRegularExpressionVali...
Layer tree node points to a map layer.
The QgsLayerTreeModel class is model implementation for Qt item views framework.
Namespace with helper functions for layer tree operations.
Map canvas is a class for displaying all GIS data types on a canvas.
A marker symbol type, for rendering Point and MultiPoint geometries.
Base class for any widget that can be shown as a inline panel.
A store for object properties.
Represents a vector layer which manages a vector based data sets.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:76