QGIS API Documentation 3.43.0-Master (261ee7da134)
qgsdatabaseschemaselectiondialog.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsdatabaseschemaselectiondialog.cpp
3 ---------------------
4 begin : March 2025
5 copyright : (C) 2025 by Jan Caha
6 email : jan.caha at outlook 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#include <QApplication>
17#include <QMessageBox>
18#include <QGridLayout>
19#include <QLabel>
20
22#include "moc_qgsdatabaseschemaselectiondialog.cpp"
23
25 : QDialog( parent )
26{
27 setWindowTitle( tr( "Select Schema" ) );
28
29 QGridLayout *layout = new QGridLayout( this );
30
31 mCboSchema = new QgsDatabaseSchemaComboBox( connection, this );
32 mCboSchema->setAllowEmptySchema( false );
33
34 layout->addWidget( new QLabel( tr( "Select schema" ) ), 0, 0 );
35 layout->addWidget( mCboSchema, 0, 1 );
36
37 mButtonBox = new QDialogButtonBox( this );
38 mButtonBox->setOrientation( Qt::Horizontal );
39 mButtonBox->setStandardButtons( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
40 connect( mButtonBox, &QDialogButtonBox::rejected, this, &QgsDatabaseSchemaSelectionDialog::reject );
41 connect( mButtonBox, &QDialogButtonBox::accepted, this, &QgsDatabaseSchemaSelectionDialog::accept );
42
43 layout->addWidget( mButtonBox, 1, 0, 2, 0 );
44}
45
47{
48 return mCboSchema->currentSchema();
49}
Provides common functionality for database based connections.
A combo box which displays the list of schemas for a specific database connection.
void setAllowEmptySchema(bool allowEmpty)
Sets whether an optional empty schema ("not set") option is present in the combobox.
QString currentSchema() const
Returns the name of the current schema selected in the combo box.
QgsDatabaseSchemaSelectionDialog(QgsAbstractDatabaseProviderConnection *connection, QWidget *parent=nullptr)
Constructor for QgsDatabaseSchemaSelectionDialog, for the specified connection.
QString selectedSchema() const
Returns the name of the current schema selected in the combo box.