QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | List of all members
QgsDatabaseTableComboBox Class Reference

The QgsDatabaseTableComboBox class is a combo box which displays the list of tables for a specific database connection. More...

#include <qgsdatabasetablecombobox.h>

Inheritance diagram for QgsDatabaseTableComboBox:
Inheritance graph
[legend]

Public Slots

void refreshTables ()
 Refreshes the list of available tables.
 
void setConnectionName (const QString &connection, const QString &provider=QString())
 Sets the database connection name from which to retrieve the available tables.
 
void setSchema (const QString &schema)
 Sets the schema from which to retrieve the available tables.
 
void setTable (const QString &table, const QString &schema=QString())
 Sets the current table selected in the combo box.
 

Signals

void tableChanged (const QString &table, const QString &schema=QString())
 Emitted whenever the currently selected table changes.
 

Public Member Functions

 QgsDatabaseTableComboBox (const QString &provider, const QString &connection, const QString &schema=QString(), QWidget *parent=nullptr)
 Constructor for QgsDatabaseTableComboBox, for the specified provider and connection.
 
 QgsDatabaseTableComboBox (QgsAbstractDatabaseProviderConnection *connection, const QString &schema=QString(), QWidget *parent=nullptr)
 Constructor for QgsDatabaseTableComboBox, for the specified connection.
 
bool allowEmptyTable () const
 Returns true if the combobox allows the empty table ("not set") choice.
 
QComboBox * comboBox ()
 Returns the combobox portion of the widget.
 
QString currentSchema () const
 Returns the schema of the current table selected in the combo box.
 
QString currentTable () const
 Returns the name of the current table selected in the combo box.
 
void setAllowEmptyTable (bool allowEmpty)
 Sets whether an optional empty table ("not set") option is present in the combobox.
 

Detailed Description

The QgsDatabaseTableComboBox class is a combo box which displays the list of tables for a specific database connection.

Warning
The provider must support the connection API methods in its QgsProviderMetadata implementation in order for the combobox to work correctly.
Since
QGIS 3.14

Definition at line 51 of file qgsdatabasetablecombobox.h.

Constructor & Destructor Documentation

◆ QgsDatabaseTableComboBox() [1/2]

QgsDatabaseTableComboBox::QgsDatabaseTableComboBox ( const QString &  provider,
const QString &  connection,
const QString &  schema = QString(),
QWidget *  parent = nullptr 
)
explicit

Constructor for QgsDatabaseTableComboBox, for the specified provider and connection.

The optional schema argument can be used to restrict the listed tables to a specific schema.

Warning
The provider must support the connection API methods in its QgsProviderMetadata implementation in order for the model to work correctly.

Definition at line 24 of file qgsdatabasetablecombobox.cpp.

◆ QgsDatabaseTableComboBox() [2/2]

QgsDatabaseTableComboBox::QgsDatabaseTableComboBox ( QgsAbstractDatabaseProviderConnection connection,
const QString &  schema = QString(),
QWidget *  parent = nullptr 
)
explicit

Constructor for QgsDatabaseTableComboBox, for the specified connection.

The optional schema argument can be used to restrict the listed tables to a specific schema.

Ownership of connection is transferred to the combobox.

Definition at line 35 of file qgsdatabasetablecombobox.cpp.

Member Function Documentation

◆ allowEmptyTable()

bool QgsDatabaseTableComboBox::allowEmptyTable ( ) const

Returns true if the combobox allows the empty table ("not set") choice.

See also
setAllowEmptyTable()

Definition at line 50 of file qgsdatabasetablecombobox.cpp.

◆ comboBox()

QComboBox * QgsDatabaseTableComboBox::comboBox ( )
inline

Returns the combobox portion of the widget.

Definition at line 101 of file qgsdatabasetablecombobox.h.

◆ currentSchema()

QString QgsDatabaseTableComboBox::currentSchema ( ) const

Returns the schema of the current table selected in the combo box.

Definition at line 174 of file qgsdatabasetablecombobox.cpp.

◆ currentTable()

QString QgsDatabaseTableComboBox::currentTable ( ) const

Returns the name of the current table selected in the combo box.

Definition at line 185 of file qgsdatabasetablecombobox.cpp.

◆ refreshTables

void QgsDatabaseTableComboBox::refreshTables ( )
slot

Refreshes the list of available tables.

Definition at line 165 of file qgsdatabasetablecombobox.cpp.

◆ setAllowEmptyTable()

void QgsDatabaseTableComboBox::setAllowEmptyTable ( bool  allowEmpty)

Sets whether an optional empty table ("not set") option is present in the combobox.

See also
allowEmptyTable()

Definition at line 43 of file qgsdatabasetablecombobox.cpp.

◆ setConnectionName

void QgsDatabaseTableComboBox::setConnectionName ( const QString &  connection,
const QString &  provider = QString() 
)
slot

Sets the database connection name from which to retrieve the available tables.

Optionally the provider can be reset too.

Definition at line 119 of file qgsdatabasetablecombobox.cpp.

◆ setSchema

void QgsDatabaseTableComboBox::setSchema ( const QString &  schema)
slot

Sets the schema from which to retrieve the available tables.

Definition at line 147 of file qgsdatabasetablecombobox.cpp.

◆ setTable

void QgsDatabaseTableComboBox::setTable ( const QString &  table,
const QString &  schema = QString() 
)
slot

Sets the current table selected in the combo box.

If necessary, the schema can be specified too.

Definition at line 88 of file qgsdatabasetablecombobox.cpp.

◆ tableChanged

void QgsDatabaseTableComboBox::tableChanged ( const QString &  table,
const QString &  schema = QString() 
)
signal

Emitted whenever the currently selected table changes.


The documentation for this class was generated from the following files: