QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgsdiagramproperties.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsdiagramproperties.h
3 Properties for diagram layers
4 -------------------
5 begin : August 2012
6 copyright : (C) Matthias Kuhn
7 email : matthias at opengis dot ch
8
9 ***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSDIAGRAMPROPERTIES_H
19#define QGSDIAGRAMPROPERTIES_H
20
21// We don't want to expose this in the public API
22#define SIP_NO_FILE
23
24#include "ui_qgsdiagrampropertiesbase.h"
25
26#include "qgis_gui.h"
27#include "qgsdiagramrenderer.h"
28#include "qgscolorschemelist.h"
29
30#include <QDialog>
31#include <QStyledItemDelegate>
32
33class QgsVectorLayer;
34class QgsMapCanvas;
35
40class GUI_EXPORT QgsDiagramProperties : public QWidget, private Ui::QgsDiagramPropertiesBase, private QgsExpressionContextGenerator
41{
42 Q_OBJECT
43
44 public:
45 QgsDiagramProperties( QgsVectorLayer *layer, QWidget *parent, QgsMapCanvas *canvas );
46
52 void syncToLayer();
53
54 ~QgsDiagramProperties() override;
55
57 void addAttribute( QTreeWidgetItem *item );
58
59 signals:
60
62
63 public slots:
64 void apply();
65 void mDiagramTypeComboBox_currentIndexChanged( int index );
66 void mAddCategoryPushButton_clicked();
67 void mAttributesTreeWidget_itemDoubleClicked( QTreeWidgetItem *item, int column );
68 void mFindMaximumValueButton_clicked();
69 void mRemoveCategoryPushButton_clicked();
70 void mDiagramAttributesTreeWidget_itemDoubleClicked( QTreeWidgetItem *item, int column );
71 void mEngineSettingsButton_clicked();
72 void showAddAttributeExpressionDialog();
73 void mDiagramStackedWidget_currentChanged( int index );
74 void updatePlacementWidgets();
75 void scalingTypeChanged();
76 void showSizeLegendDialog();
77
78 private slots:
79
80 void updateProperty();
81 void showHelp();
82
83 void createAuxiliaryField();
84
85 private:
86
87 QgsVectorLayer *mLayer = nullptr;
89 QButtonGroup *mPlacePointBtnGrp = nullptr;
91 QButtonGroup *mPlaceLineBtnGrp = nullptr;
93 QButtonGroup *mPlacePolygonBtnGrp = nullptr;
94
95 std::unique_ptr< QgsPaintEffect> mPaintEffect;
96
97 enum Columns
98 {
99 ColumnAttributeExpression = 0,
100 ColumnColor,
101 ColumnLegendText,
102 };
103
104 enum Roles
105 {
106 RoleAttributeExpression = Qt::UserRole,
107 };
108
109 QString showExpressionBuilder( const QString &initialExpression );
110
111 QgsPropertyCollection mDataDefinedProperties;
112
113 // Keeps track of the diagram type to properly save / restore settings when the diagram type combo box is set to no diagram.
114 QString mDiagramType;
115 std::unique_ptr< QgsDataDefinedSizeLegend > mSizeLegend;
116
117 QString guessLegendText( const QString &expression );
118 QgsMapCanvas *mMapCanvas = nullptr;
119
121
122 void registerDataDefinedButton( QgsPropertyOverrideButton *button, QgsDiagramLayerSettings::Property key );
123};
124
125
130class EditBlockerDelegate: public QStyledItemDelegate
131{
132 Q_OBJECT
133 public:
134 EditBlockerDelegate( QObject *parent = nullptr )
135 : QStyledItemDelegate( parent )
136 {}
137
138 QWidget *createEditor( QWidget *, const QStyleOptionViewItem &, const QModelIndex & ) const override
139 {
140 return nullptr;
141 }
142};
143
144
145#endif // QGSDIAGRAMPROPERTIES_H
EditBlockerDelegate(QObject *parent=nullptr)
QWidget * createEditor(QWidget *, const QStyleOptionViewItem &, const QModelIndex &) const override
Property
Data definable properties.
Abstract interface for generating an expression context.
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Map canvas is a class for displaying all GIS data types on a canvas.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
A button for controlling property overrides which may apply to a widget.
Represents a vector layer which manages a vector based data sets.