QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgsproviderconnectioncombobox.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsproviderconnectioncombobox.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 QGSPROVIDERCONNECTIONCOMBOBOX_H
17
#define QGSPROVIDERCONNECTIONCOMBOBOX_H
18
19
#include "qgis_gui.h"
20
#include "
qgis_sip.h
"
21
22
#include <QComboBox>
23
#include <QSortFilterProxyModel>
24
25
class
QgsProviderConnectionModel
;
26
28
#ifndef SIP_RUN
29
class
GUI_EXPORT QgsProviderConnectionComboBoxSortModel :
public
QSortFilterProxyModel
30
{
31
Q_OBJECT
32
public
:
33
explicit
QgsProviderConnectionComboBoxSortModel( QObject *parent =
nullptr
);
34
35
protected
:
36
bool
lessThan(
const
QModelIndex &source_left,
const
QModelIndex &source_right )
const override
;
37
};
38
#endif
40
50
class
GUI_EXPORT
QgsProviderConnectionComboBox
:
public
QComboBox
51
{
52
Q_OBJECT
53
54
public
:
61
explicit
QgsProviderConnectionComboBox
(
const
QString &provider, QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
);
62
68
explicit
QgsProviderConnectionComboBox
( QWidget *parent =
nullptr
)
SIP_SKIP
;
69
76
void
setProvider
(
const
QString &provider );
77
82
void
setAllowEmptyConnection
(
bool
allowEmpty );
83
88
bool
allowEmptyConnection
()
const
;
89
93
QString
currentConnection
()
const
;
94
98
QString
currentConnectionUri
()
const
;
99
100
public
slots:
101
105
void
setConnection
(
const
QString &connection );
106
107
signals:
109
void
connectionChanged
(
const
QString &connection );
110
111
private
slots:
112
void
indexChanged(
int
i );
113
void
rowsChanged();
114
void
rowsAboutToBeRemoved();
115
void
rowsRemoved();
116
117
private
:
118
QgsProviderConnectionModel
*mModel =
nullptr
;
119
QSortFilterProxyModel *mSortModel =
nullptr
;
120
QString mPreviousConnection;
121
};
122
123
#endif
// QGSPROVIDERCONNECTIONCOMBOBOX_H
QgsProviderConnectionComboBox::QgsProviderConnectionComboBox
QgsProviderConnectionComboBox(const QString &provider, QWidget *parent=nullptr)
Constructor for QgsProviderConnectionComboBox, for the specified provider.
Definition
qgsproviderconnectioncombobox.cpp:22
QgsProviderConnectionComboBox::currentConnectionUri
QString currentConnectionUri() const
Returns the uri of the current connection selected in the combo box.
Definition
qgsproviderconnectioncombobox.cpp:114
QgsProviderConnectionComboBox::setProvider
void setProvider(const QString &provider)
Sets the provider to be used.
Definition
qgsproviderconnectioncombobox.cpp:32
QgsProviderConnectionComboBox::setConnection
void setConnection(const QString &connection)
Sets the current connection selected in the combo box.
Definition
qgsproviderconnectioncombobox.cpp:72
QgsProviderConnectionComboBox::allowEmptyConnection
bool allowEmptyConnection() const
Returns true if the combobox allows the empty connection ("not set") choice.
Definition
qgsproviderconnectioncombobox.cpp:67
QgsProviderConnectionComboBox::setAllowEmptyConnection
void setAllowEmptyConnection(bool allowEmpty)
Sets whether an optional empty connection ("not set") option is present in the combobox.
Definition
qgsproviderconnectioncombobox.cpp:62
QgsProviderConnectionComboBox::currentConnection
QString currentConnection() const
Returns the name of the current connection selected in the combo box.
Definition
qgsproviderconnectioncombobox.cpp:103
QgsProviderConnectionComboBox::connectionChanged
void connectionChanged(const QString &connection)
Emitted whenever the currently selected connection changes.
QgsProviderConnectionModel
A model containing registered connection names for a specific data provider.
Definition
qgsproviderconnectionmodel.h:39
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:138
Generated on
for QGIS API Documentation by
1.17.0