QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgsdatabaseschemacombobox.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsdatabaseschemacombobox.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 QGSDATABASESCHEMACOMBOBOX_H
17
#define QGSDATABASESCHEMACOMBOBOX_H
18
19
#include "qgis_gui.h"
20
#include "
qgis_sip.h
"
21
22
#include <QComboBox>
23
#include <QSortFilterProxyModel>
24
25
class
QgsDatabaseSchemaModel
;
26
class
QgsAbstractDatabaseProviderConnection
;
27
29
#ifndef SIP_RUN
30
class
GUI_EXPORT QgsDatabaseSchemaComboBoxSortModel :
public
QSortFilterProxyModel
31
{
32
Q_OBJECT
33
public
:
34
explicit
QgsDatabaseSchemaComboBoxSortModel( QObject *parent =
nullptr
);
35
36
protected
:
37
bool
lessThan(
const
QModelIndex &source_left,
const
QModelIndex &source_right )
const override
;
38
};
39
#endif
41
51
class
GUI_EXPORT
QgsDatabaseSchemaComboBox
:
public
QWidget
52
{
53
Q_OBJECT
54
55
public
:
62
explicit
QgsDatabaseSchemaComboBox
(
const
QString &provider,
const
QString &connection, QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
);
63
69
explicit
QgsDatabaseSchemaComboBox
(
QgsAbstractDatabaseProviderConnection
*connection
SIP_TRANSFER
, QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
);
70
75
void
setAllowEmptySchema
(
bool
allowEmpty );
76
81
bool
allowEmptySchema
()
const
;
82
86
QString
currentSchema
()
const
;
87
91
QComboBox *
comboBox
() {
return
mComboBox; }
92
93
public
slots:
94
98
void
setSchema(
const
QString &schema );
99
105
void
setConnectionName(
const
QString &connection,
const
QString &provider = QString() );
106
110
void
refreshSchemas();
111
112
signals:
114
void
schemaChanged
(
const
QString &schema );
115
116
private
slots:
117
void
indexChanged(
int
i );
118
void
rowsChanged();
119
120
private
:
121
void
init();
122
123
bool
mAllowEmpty =
false
;
124
QString mProvider;
125
QgsDatabaseSchemaModel
*mModel =
nullptr
;
126
QSortFilterProxyModel *mSortModel =
nullptr
;
127
QComboBox *mComboBox =
nullptr
;
128
};
129
130
#endif
// QGSDATABASESCHEMACOMBOBOX_H
QgsAbstractDatabaseProviderConnection
Provides common functionality for database based connections.
Definition
qgsabstractdatabaseproviderconnection.h:50
QgsDatabaseSchemaComboBox::QgsDatabaseSchemaComboBox
QgsDatabaseSchemaComboBox(const QString &provider, const QString &connection, QWidget *parent=nullptr)
Constructor for QgsDatabaseSchemaComboBox, for the specified provider and connection.
Definition
qgsdatabaseschemacombobox.cpp:30
QgsDatabaseSchemaComboBox::schemaChanged
void schemaChanged(const QString &schema)
Emitted whenever the currently selected schema changes.
QgsDatabaseSchemaComboBox::allowEmptySchema
bool allowEmptySchema() const
Returns true if the combobox allows the empty schema ("not set") choice.
Definition
qgsdatabaseschemacombobox.cpp:53
QgsDatabaseSchemaComboBox::setAllowEmptySchema
void setAllowEmptySchema(bool allowEmpty)
Sets whether an optional empty schema ("not set") option is present in the combobox.
Definition
qgsdatabaseschemacombobox.cpp:46
QgsDatabaseSchemaComboBox::comboBox
QComboBox * comboBox()
Returns the combobox portion of the widget.
Definition
qgsdatabaseschemacombobox.h:91
QgsDatabaseSchemaComboBox::currentSchema
QString currentSchema() const
Returns the name of the current schema selected in the combo box.
Definition
qgsdatabaseschemacombobox.cpp:157
QgsDatabaseSchemaModel
A model containing schemas from a database connection.
Definition
qgsdatabaseschemamodel.h:44
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
SIP_TRANSFER
#define SIP_TRANSFER
Definition
qgis_sip.h:35
Generated on
for QGIS API Documentation by
1.17.0