-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqgsdiagramproperties.h
111 lines (85 loc) · 3.59 KB
/
qgsdiagramproperties.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/***************************************************************************
qgsdiagramproperties.h
Properties for diagram layers
-------------------
begin : August 2012
copyright : (C) Matthias Kuhn
email : matthias at opengis dot ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSDIAGRAMPROPERTIES_H
#define QGSDIAGRAMPROPERTIES_H
#include <QDialog>
#include "qgsdiagramrenderer.h"
#include <ui_qgsdiagrampropertiesbase.h>
#include <QStyledItemDelegate>
#include "qgis_app.h"
class QgsVectorLayer;
class QgsMapCanvas;
class APP_EXPORT QgsDiagramProperties : public QWidget, private Ui::QgsDiagramPropertiesBase, private QgsExpressionContextGenerator
{
Q_OBJECT
public:
QgsDiagramProperties( QgsVectorLayer *layer, QWidget *parent, QgsMapCanvas *canvas );
~QgsDiagramProperties();
//! Adds an attribute from the list of available attributes to the assigned attributes with a random color.
void addAttribute( QTreeWidgetItem *item );
public slots:
void apply();
void on_mDiagramTypeComboBox_currentIndexChanged( int index );
void on_mAddCategoryPushButton_clicked();
void on_mAttributesTreeWidget_itemDoubleClicked( QTreeWidgetItem *item, int column );
void on_mFindMaximumValueButton_clicked();
void on_mRemoveCategoryPushButton_clicked();
void on_mDiagramFontButton_clicked();
void on_mDiagramAttributesTreeWidget_itemDoubleClicked( QTreeWidgetItem *item, int column );
void on_mEngineSettingsButton_clicked();
void showAddAttributeExpressionDialog();
void on_mDiagramStackedWidget_currentChanged( int index );
void on_mPlacementComboBox_currentIndexChanged( int index );
void on_mButtonSizeLegendSymbol_clicked();
void scalingTypeChanged();
protected:
QFont mDiagramFont;
QgsVectorLayer *mLayer = nullptr;
private:
enum Columns
{
ColumnAttributeExpression = 0,
ColumnColor,
ColumnLegendText,
};
enum Roles
{
RoleAttributeExpression = Qt::UserRole,
};
QString showExpressionBuilder( const QString &initialExpression );
QgsPropertyCollection mDataDefinedProperties;
// Keeps track of the diagram type to properly save / restore settings when the diagram type combo box is set to no diagram.
QString mDiagramType;
std::unique_ptr< QgsMarkerSymbol > mSizeLegendSymbol;
QString guessLegendText( const QString &expression );
QgsMapCanvas *mMapCanvas = nullptr;
QgsExpressionContext createExpressionContext() const override;
void registerDataDefinedButton( QgsPropertyOverrideButton *button, QgsDiagramLayerSettings::Property key );
private slots:
void updateProperty();
};
class EditBlockerDelegate: public QStyledItemDelegate
{
public:
EditBlockerDelegate( QObject *parent = nullptr )
: QStyledItemDelegate( parent )
{}
virtual QWidget *createEditor( QWidget *, const QStyleOptionViewItem &, const QModelIndex & ) const override
{
return nullptr;
}
};
#endif // QGSDIAGRAMPROPERTIES_H