16#ifndef QGSDATABASETABLECOMBOBOX_H
17#define QGSDATABASETABLECOMBOBOX_H
23#include <QSortFilterProxyModel>
30class GUI_EXPORT QgsDatabaseTableComboBoxSortModel :
public QSortFilterProxyModel
34 explicit QgsDatabaseTableComboBoxSortModel( QObject *parent =
nullptr );
37 bool lessThan(
const QModelIndex &source_left,
const QModelIndex &source_right )
const override;
109 void setTable(
const QString &table,
const QString &schema = QString() );
116 void setConnectionName(
const QString &connection,
const QString &provider = QString() );
121 void setSchema(
const QString &schema );
126 void refreshTables();
130 void tableChanged(
const QString &table,
const QString &schema = QString() );
133 void indexChanged(
int i );
139 bool mAllowEmpty =
false;
144 QSortFilterProxyModel *mSortModel =
nullptr;
145 QComboBox *mComboBox =
nullptr;
Provides common functionality for database based connections.
void tableChanged(const QString &table, const QString &schema=QString())
Emitted whenever the currently selected table changes.
QString currentSchema() const
Returns the schema of the current table selected in the combo box.
QComboBox * comboBox()
Returns the combobox portion of the widget.
bool allowEmptyTable() const
Returns true if the combobox allows the empty table ("not set") choice.
void setAllowEmptyTable(bool allowEmpty)
Sets whether an optional empty table ("not set") option is present in the combobox.
QgsDatabaseTableComboBox(const QString &provider, const QString &connection, const QString &schema=QString(), QWidget *parent=nullptr)
Constructor for QgsDatabaseTableComboBox, for the specified provider and connection.
QString currentTable() const
Returns the name of the current table selected in the combo box.
A model containing tables from a database connection.