QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
qgsdbrelationshipwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsdbrelationshipwidget.h
3 ------------------
4 Date : November 2022
5 Copyright : (C) 2022 by Nyall Dawson
6 Email : nyall dot dawson 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#ifndef QGSDBRELATIONSHIPWIDGET_H
16#define QGSDBRELATIONSHIPWIDGET_H
17
18#include "qgis_gui.h"
19#include "qgis_sip.h"
20#include "ui_qgsdbrelationshipwidgetbase.h"
21#include "qgis.h"
22#include "qgsweakrelation.h"
23#include <QAbstractTableModel>
24#include <QDialog>
25
26class QDialogButtonBox;
29class QSortFilterProxyModel;
30
37class GUI_EXPORT QgsDbRelationWidget : public QWidget, private Ui_QgsDbRelationshipWidgetBase
38{
39 Q_OBJECT
40
41 public:
42
49
55 void setRelationship( const QgsWeakRelation &relationship );
56
62 QgsWeakRelation relationship() const;
63
69 bool isValid() const;
70
71 signals:
72
78 void validityChanged( bool isValid );
79
80 private:
81
82 QgsAbstractDatabaseProviderConnection *mConnection = nullptr;
83 QgsDatabaseTableModel *mTableModel = nullptr;
84 QSortFilterProxyModel *mProxyModel = nullptr;
85 QgsWeakRelation mRelation;
86
87};
88
89
90
97class GUI_EXPORT QgsDbRelationDialog: public QDialog
98{
99 Q_OBJECT
100
101 public:
102
108 explicit QgsDbRelationDialog( QgsAbstractDatabaseProviderConnection *connection SIP_TRANSFER, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
109
115 void setRelationship( const QgsWeakRelation &relationship );
116
122 QgsWeakRelation relationship() const;
123
124 public slots:
125
126 void accept() override;
127
128 private slots:
129
130 void validityChanged( bool isValid );
131
132 private:
133 QgsDbRelationWidget *mWidget = nullptr;
134 QDialogButtonBox *mButtonBox = nullptr;
135};
136
137#endif // QGSDBRELATIONSHIPWIDGET_H
The QgsAbstractDatabaseProviderConnection class provides common functionality for DB based connection...
A model containing tables from a database connection.
A dialog for configuration of the properties of a relationship in a database.
A widget for configuration of the properties of a relationship in a database.
void validityChanged(bool isValid)
Emitted whenever the validity of the relationship configuration in the widget changes.
The QgsWeakRelation class represent a QgsRelation with possibly unresolved layers or unmatched fields...
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_TRANSFER
Definition qgis_sip.h:36