QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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 "ui_qgsdbrelationshipwidgetbase.h"
19
20#include "qgis.h"
21#include "qgis_gui.h"
22#include "qgis_sip.h"
23#include "qgsweakrelation.h"
24
25#include <QAbstractTableModel>
26#include <QDialog>
27
28class QDialogButtonBox;
31class QSortFilterProxyModel;
32
39class GUI_EXPORT QgsDbRelationWidget : public QWidget, private Ui_QgsDbRelationshipWidgetBase
40{
41 Q_OBJECT
42
43 public:
50
57
64
70 bool isValid() const;
71
72 signals:
73
80
81 private:
82 QgsAbstractDatabaseProviderConnection *mConnection = nullptr;
83 QgsDatabaseTableModel *mTableModel = nullptr;
84 QSortFilterProxyModel *mProxyModel = nullptr;
85 QgsWeakRelation mRelation;
86};
87
88
95class GUI_EXPORT QgsDbRelationDialog : public QDialog
96{
97 Q_OBJECT
98
99 public:
105 explicit QgsDbRelationDialog( QgsAbstractDatabaseProviderConnection *connection SIP_TRANSFER, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
106
113
120
121 public slots:
122
123 void accept() override;
124
125 private slots:
126
127 void validityChanged( bool isValid );
128
129 private:
130 QgsDbRelationWidget *mWidget = nullptr;
131 QDialogButtonBox *mButtonBox = nullptr;
132};
133
134#endif // QGSDBRELATIONSHIPWIDGET_H
Provides common functionality for database based connections.
A model containing tables from a database connection.
QgsDbRelationDialog(QgsAbstractDatabaseProviderConnection *connection, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags())
Constructor for QgsDbRelationDialog, with the specified parent widget and window flags,...
QgsWeakRelation relationship() const
Returns the relationship as defined in the dialog.
void setRelationship(const QgsWeakRelation &relationship)
Sets the current relationship to show properties for in the dialog.
A widget for configuration of the properties of a relationship in a database.
void setRelationship(const QgsWeakRelation &relationship)
Sets the current relationship to show properties for in the widget.
QgsDbRelationWidget(QgsAbstractDatabaseProviderConnection *connection, QWidget *parent=nullptr)
Constructor for QgsDbRelationWidget with the specified parent widget, for the specified connection.
void validityChanged(bool isValid)
Emitted whenever the validity of the relationship configuration in the widget changes.
bool isValid() const
Returns true if the widget currently represents a valid relationship configuration.
QgsWeakRelation relationship() const
Returns the relationship as defined in the widget.
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