-
Notifications
You must be signed in to change notification settings - Fork 0
/
DialogSwitchDB.cpp
49 lines (44 loc) · 1021 Bytes
/
DialogSwitchDB.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* @file DialogSwitchDB.cpp
* @author Anil Kumar
* @date 17-11-2017
* @brief This DialogSwitchDB class, It's responsible for select or change database.
*/
#include "DialogSwitchDB.h"
#include "ui_DialogSwitchDB.h"
/**
* @brief DialogSwitchDB::DialogSwitchDB
* @param parent
* @param db_
*/
DialogSwitchDB::DialogSwitchDB(QWidget *parent, QSqlDatabase *db_) :
QDialog(parent),
ui(new Ui::DialogSwitchDB)
{
ui->setupUi(this);
dba = db_;
QSqlQuery query1("SHOW DATABASES");
while(query1.next())
ui->comboBox->addItem(query1.value(0).toString());
}
/**
* @brief DialogSwitchDB::~DialogSwitchDB
*/
DialogSwitchDB::~DialogSwitchDB()
{
delete ui;
}
/**
* @brief DialogSwitchDB::on_pushButton_ok_clicked
*/
void DialogSwitchDB::on_pushButton_ok_clicked()
{
dba->setDatabaseName(ui->comboBox->currentText());
emit si_ClosedSwitchDB(true);
this->close();
}
void DialogSwitchDB::on_pushButton_Cancel_clicked()
{
emit si_ClosedSwitchDB(false);
this->close();
}