QGIS API Documentation 3.41.0-Master (cea29feecf2)
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:
48
54 void setRelationship( const QgsWeakRelation &relationship );
55
61 QgsWeakRelation relationship() const;
62
68 bool isValid() const;
69
70 signals:
71
77 void validityChanged( bool isValid );
78
79 private:
80 QgsAbstractDatabaseProviderConnection *mConnection = nullptr;
81 QgsDatabaseTableModel *mTableModel = nullptr;
82 QSortFilterProxyModel *mProxyModel = nullptr;
83 QgsWeakRelation mRelation;
84};
85
86
93class GUI_EXPORT QgsDbRelationDialog : public QDialog
94{
95 Q_OBJECT
96
97 public:
103 explicit QgsDbRelationDialog( QgsAbstractDatabaseProviderConnection *connection SIP_TRANSFER, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
104
110 void setRelationship( const QgsWeakRelation &relationship );
111
117 QgsWeakRelation relationship() const;
118
119 public slots:
120
121 void accept() override;
122
123 private slots:
124
125 void validityChanged( bool isValid );
126
127 private:
128 QgsDbRelationWidget *mWidget = nullptr;
129 QDialogButtonBox *mButtonBox = nullptr;
130};
131
132#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