/
qgsrelationaddpolymorphicdialog.h
99 lines (82 loc) · 3.06 KB
/
qgsrelationaddpolymorphicdialog.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
/***************************************************************************
qgsrelationaddpolymorphicdialog.h
---------------------
begin : December 2020
copyright : (C) 2020 by Ivan Ivanov
email : ivan 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 QGSRELATIONADDPOLYMORPHICDIALOG_H
#define QGSRELATIONADDPOLYMORPHICDIALOG_H
#include <QDialog>
#include "qgis_app.h"
#include "ui_qgsrelationmanageraddpolymorphicdialogbase.h"
#include "qgsrelation.h"
/**
* QgsRelationAddDlg allows configuring a new relation.
* Multiple field pairs can be set.
*/
class APP_EXPORT QgsRelationAddPolymorphicDialog : public QDialog, private Ui::QgsRelationManagerAddPolymorphicDialogBase
{
Q_OBJECT
public:
explicit QgsRelationAddPolymorphicDialog( bool isEditDialog, QWidget *parent = nullptr );
/**
* Returns the id of the referencing layer
*/
QString referencingLayerId();
/**
* Returns the field in the referencing layer that stores the referenced layer representation
*/
QString referencedLayerField();
/**
* Returns the expression used to generate the referenced layer representation
*/
QString referencedLayerExpression();
/**
* Returns field pairs
*/
QList< QPair< QString, QString > > fieldPairs();
/**
* Returns the polymorphic relation id
*/
QString relationId();
/**
* Returns the polymorphic relation name
*/
QString relationName();
/**
* Returns a list of layer ids used as referenced layers and stored in the referencing layers
*/
QStringList referencedLayerIds();
/**
* Return the relation strength for the generated normal relations
*/
QgsRelation::RelationStrength relationStrength();
/**
* Sets the values of form fields in the dialog with the values of the passed \a polyRel
*/
void setPolymorphicRelation( const QgsPolymorphicRelation polyRel );
private slots:
void addFieldsRow();
void removeFieldsRow();
void updateTypeConfigWidget();
void updateFieldsMappingButtons();
void updateFieldsMappingHeaders();
void updateDialogButtons();
void updateChildRelationsComboBox();
void updateReferencingFieldsComboBoxes();
void updateReferencedLayerFieldComboBox();
void referencedLayersChanged();
private:
bool isDefinitionValid();
void updateFieldsMapping();
bool mIsEditDialog = false;
};
#endif // QGSRELATIONADDPOLYMORPHICDIALOG_H