QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
qgsdatabaseschemamodel.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsdatabaseschemamodel.h
3
--------------------------------------
4
Date : March 2020
5
Copyright : (C) 2020 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
16
#ifndef QGSDATABASESCHEMAMODEL_H
17
#define QGSDATABASESCHEMAMODEL_H
18
19
#include <memory>
20
21
#include "qgis_core.h"
22
#include "
qgis_sip.h
"
23
24
#include <QAbstractItemModel>
25
#include <QSortFilterProxyModel>
26
#include <QStringList>
27
28
class
QgsProviderMetadata
;
29
class
QgsAbstractDatabaseProviderConnection
;
30
43
class
CORE_EXPORT
QgsDatabaseSchemaModel
:
public
QAbstractItemModel
44
{
45
Q_OBJECT
46
47
public
:
48
// *INDENT-OFF*
49
56
enum class
CustomRole
SIP_MONKEYPATCH_SCOPEENUM_UNNEST
(
QgsDatabaseSchemaModel
, Role ) : int
57
{
58
Empty
SIP_MONKEYPATCH_COMPAT_NAME
( RoleEmpty ) = Qt::UserRole,
59
};
60
Q_ENUM( CustomRole )
61
// *INDENT-ON*
62
63
69
explicit
QgsDatabaseSchemaModel
(
const
QString &provider,
const
QString &connection, QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
70
76
explicit
QgsDatabaseSchemaModel
(
QgsAbstractDatabaseProviderConnection
*connection
SIP_TRANSFER
, QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
77
78
// QAbstractItemModel interface
79
QModelIndex parent(
const
QModelIndex &child )
const override
;
80
int
rowCount(
const
QModelIndex &parent = QModelIndex() )
const override
;
81
int
columnCount(
const
QModelIndex &parent = QModelIndex() )
const override
;
82
QVariant data(
const
QModelIndex &index,
int
role = Qt::DisplayRole )
const override
;
83
QModelIndex index(
int
row,
int
column,
const
QModelIndex &parent )
const override
;
84
89
void
setAllowEmptySchema(
bool
allowEmpty );
90
95
bool
allowEmptySchema
()
const
{
return
mAllowEmpty; }
96
97
public
slots:
98
102
void
refresh();
103
104
private
:
105
void
init();
106
std::unique_ptr< QgsAbstractDatabaseProviderConnection > mConnection;
107
QStringList mSchemas;
108
bool
mAllowEmpty =
false
;
109
};
110
111
#endif
// QGSDATABASESCHEMAMODEL_H
QgsAbstractDatabaseProviderConnection
Provides common functionality for database based connections.
Definition
qgsabstractdatabaseproviderconnection.h:50
QgsDatabaseSchemaModel
A model containing schemas from a database connection.
Definition
qgsdatabaseschemamodel.h:44
QgsDatabaseSchemaModel::CustomRole
CustomRole
Custom model roles.
Definition
qgsdatabaseschemamodel.h:57
QgsDatabaseSchemaModel::QgsDatabaseSchemaModel
QgsDatabaseSchemaModel(const QString &provider, const QString &connection, QObject *parent=nullptr)
Constructor for QgsDatabaseSchemaModel, for the specified provider and connection name.
Definition
qgsdatabaseschemamodel.cpp:23
QgsDatabaseSchemaModel::allowEmptySchema
bool allowEmptySchema() const
Returns true if the model allows the empty schema ("not set") choice.
Definition
qgsdatabaseschemamodel.h:95
QgsProviderMetadata
Holds data provider key, description, and associated shared library file or function pointer informat...
Definition
qgsprovidermetadata.h:234
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
SIP_MONKEYPATCH_SCOPEENUM_UNNEST
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition
qgis_sip.h:270
SIP_TRANSFER
#define SIP_TRANSFER
Definition
qgis_sip.h:35
SIP_MONKEYPATCH_COMPAT_NAME
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
Definition
qgis_sip.h:272
Generated on
for QGIS API Documentation by
1.17.0