1
1
mirror of https://github.com/andre-wojtowicz/qt-sql-example.git synced 2024-11-03 14:05:26 +01:00

Added project files

This commit is contained in:
Andrzej Wójtowicz 2017-09-01 22:53:26 +02:00
commit ad0d38876b
16 changed files with 1188 additions and 0 deletions

41
.gitignore vendored Normal file
View File

@ -0,0 +1,41 @@
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.dll
*.dylib
# Qt-es
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
Makefile*
*build-*
build/*
# QtCreator
*.autosave
# QtCtreator Qml
*.qmlproject.user
*.qmlproject.user.*
# QtCtreator CMake
CMakeLists.txt.user*

9
README.md Normal file
View File

@ -0,0 +1,9 @@
# QT SQL Example
An exemplary Qt app that connects to SQL server and displays a table from a database. The program was made for educational purposes.
![](screenshot.png)
The program was tested on:
* client: Windows 10, Qt 5.9.1,
* servers: MySQL Server 5.5.57, Microsoft SQL Server 2008 R2 SP3.

9
config.ini Normal file
View File

@ -0,0 +1,9 @@
[sql]
engine=mssql
driver=SQL Server
address=localhost\\SQLEXPRESS
port=1433
authentication=server
login=user
password=password
database=db

22
qt-sql-example.pro Normal file
View File

@ -0,0 +1,22 @@
VERSION = 1.0
QMAKE_TARGET_DESCRIPTION = "Qt app that displays SQL table; for educational purposes"
QMAKE_TARGET_COPYRIGHT = "Andrzej Wojtowicz, Adam Mickiewicz University in Poznan"
QMAKE_TARGET_PRODUCT = "Qt SQL Example"
QT += core gui sql widgets
TARGET = qt-sql-example
TEMPLATE = app
SOURCES += src/main.cpp\
src/mainwindow.cpp \
src/db_controller.cpp
HEADERS += src/mainwindow.h \
src/db_controller.h
FORMS += src/mainwindow.ui
RESOURCES += res/icons.qrc
win32:RC_ICONS += res/database.ico

BIN
res/database.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

BIN
res/failure.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

7
res/icons.qrc Normal file
View File

@ -0,0 +1,7 @@
<RCC>
<qresource prefix="/icons">
<file>database.ico</file>
<file>failure.ico</file>
<file>success.ico</file>
</qresource>
</RCC>

5
res/readme.txt Normal file
View File

@ -0,0 +1,5 @@
database.ico:
- author: http://barrymieny.deviantart.com
- license: Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
success.ico & failure.ico
- author: https://www.iconfinder.com/iconpack

BIN
res/success.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

139
src/db_controller.cpp Normal file
View File

@ -0,0 +1,139 @@
#include "db_controller.h"
DbController::DbController(QObject* parent) :
QObject(parent)
{
}
DbController::~DbController()
{
if (db.isOpen())
db.close();
}
void DbController::connectToServerRequested(QString engine, QString driver, QString server, int port, QString database,
QString login, QString password, bool is_sql_authentication)
{
db = QSqlDatabase();
db.removeDatabase("example-connection"); // remove old connection if exists
if (engine == "mysql")
{
db = QSqlDatabase::addDatabase("QMYSQL", "example-connection");
}
else if (engine == "mssql")
{
db = QSqlDatabase::addDatabase("QODBC", "example-connection");
}
else
{
emit serverErrorWithConnection("Unknown database engine");
return;
}
bool connection_succesfull;
if (engine == "mysql")
{
connection_succesfull = connectToServerMySQL(server, port, database, login, password);
}
else if (engine == "mssql")
{
connection_succesfull =
(is_sql_authentication ? connectToServerMSSQL(driver, server, port, database, login, password) :
connectToServerMSSQL(driver, server, port, database));
}
else
{
emit serverErrorWithConnection("Unknown database engine");
return;
}
if (connection_succesfull)
emit serverConnected();
else
emit serverErrorWithConnection(getLastError().driverText());
}
void DbController::disconnectFromServerRequested()
{
disconnectFromServer();
emit serverDisconnected();
}
bool DbController::checkIfTableExists(QString table)
{
return db.tables().contains(table);
}
bool DbController::checkIfConnected()
{
return db.isOpen();
}
void DbController::selectTableRequested(QString table)
{
QSqlQueryModel* model = selectTable(table);
emit tableSelected(model);
}
void DbController::getTablesNamesRequested()
{
emit gotTablesNames(db.tables());
}
bool DbController::connectToServerMSSQL(QString driver, QString server, int port, QString database,
QString login, QString password)
{
db.setDatabaseName(connection_string_sqlauth.arg(driver).arg(server).arg(port).arg(database)
.arg(login).arg(password));
return db.open();
}
bool DbController::connectToServerMSSQL(QString driver, QString server, int port, QString database)
{
db.setDatabaseName(connection_string_winauth.arg(driver).arg(server).arg(port).arg(database));
return db.open();
}
bool DbController::connectToServerMySQL(QString server, int port, QString database,
QString login, QString password)
{
db.setHostName(server);
db.setPort(port);
db.setDatabaseName(database);
db.setUserName(login);
db.setPassword(password);
return db.open();
}
void DbController::disconnectFromServer()
{
db.close();
}
QSqlQueryModel* DbController::selectTable(QString name)
{
QSqlQueryModel* model = new QSqlQueryModel;
model->setQuery("SELECT * FROM " + name, db);
return model;
}
QSqlError DbController::getLastError()
{
return db.lastError();
}
const QString DbController::connection_string_sqlauth =
QString("DRIVER={%1};SERVER=%2;PORT=%3;DATABASE=%4;UID=%5;PWD=%6");
const QString DbController::connection_string_winauth =
QString("DRIVER={%1};SERVER=%2;PORT=%3;DATABASE=%4");

42
src/db_controller.h Normal file
View File

@ -0,0 +1,42 @@
#ifndef DB_CONTROLLER_H
#define DB_CONTROLLER_H
#include <QString>
#include <QtSql>
class DbController : public QObject
{
Q_OBJECT
public:
explicit DbController(QObject*);
~DbController();
bool checkIfTableExists(QString);
bool checkIfConnected();
public slots:
void connectToServerRequested(QString, QString, QString, int, QString, QString, QString, bool);
void disconnectFromServerRequested();
void selectTableRequested(QString);
void getTablesNamesRequested();
signals:
void serverConnected();
void serverErrorWithConnection(QString);
void serverDisconnected();
void tableSelected(QSqlQueryModel*);
void gotTablesNames(QStringList);
private:
bool connectToServerMSSQL(QString, QString, int, QString, QString, QString);
bool connectToServerMSSQL(QString, QString, int, QString);
bool connectToServerMySQL(QString, int, QString, QString, QString);
void disconnectFromServer();
QSqlQueryModel* selectTable(QString);
QSqlError getLastError();
QSqlDatabase db;
static const QString connection_string_sqlauth;
static const QString connection_string_winauth;
};
#endif // DB_CONTROLLER_H

21
src/main.cpp Normal file
View File

@ -0,0 +1,21 @@
#include "db_controller.h"
#include "mainwindow.h"
#include <QApplication>
#include <QThread>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
DbController db_controller(0);
QThread db_thread;
db_controller.moveToThread(&db_thread);
db_thread.start();
MainWindow window(0, &db_controller, &db_thread);
window.show();
return app.exec();
}

288
src/mainwindow.cpp Normal file
View File

@ -0,0 +1,288 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QMessageBox>
#include <QKeyEvent>
#include <QSettings>
MainWindow::MainWindow(QWidget* parent, DbController* dbc, QThread* dbt) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
db_controller = dbc;
db_thread = dbt;
// check Qt SQL drivers
QStringList sql_drivers = QSqlDatabase::drivers();
ui->label_qmysql_icon->setPixmap(
QPixmap(":/icons/" + QString(sql_drivers.contains("QMYSQL") ? "success" : "failure") + ".ico"));
ui->label_qodbc_icon->setPixmap(
QPixmap(":/icons/" + QString(sql_drivers.contains("QODBC") ? "success" : "failure") + ".ico"));
ui->radio_mysql->setEnabled(sql_drivers.contains("QMYSQL"));
ui->radio_mssql->setEnabled(sql_drivers.contains("QODBC"));
if (!sql_drivers.contains("QMYSQL") && !sql_drivers.contains("QODBC"))
ui->groupBox_sql_connect->setEnabled(false);
// connect signals with slots
// ui => ui
connect(ui->button_connect, SIGNAL(clicked()), this, SLOT(connectToServerRequested()));
connect(ui->radio_mssql, SIGNAL(clicked()), this, SLOT(engineChanged()));
connect(ui->radio_mysql, SIGNAL(clicked()), this, SLOT(engineChanged()));
connect(ui->radio_sql_authentication, SIGNAL(clicked()), this, SLOT(authenticationMethodChanged()));
connect(ui->radio_windows_authentication, SIGNAL(clicked()), this, SLOT(authenticationMethodChanged()));
connect(ui->button_show_table, SIGNAL(clicked()), this, SLOT(showTableRequested()));
// ui => db_controller
connect(this, SIGNAL(connectToServer(QString,QString,QString,int,QString,QString,QString,bool)),
db_controller, SLOT(connectToServerRequested(QString,QString,QString,int,QString,QString,QString,bool)));
connect(this, SIGNAL(disconnectFromServer()), db_controller, SLOT(disconnectFromServerRequested()));
connect(this, SIGNAL(selectTable(QString)), db_controller, SLOT(selectTableRequested(QString)));
connect(this, SIGNAL(getTablesNames()), db_controller, SLOT(getTablesNamesRequested()));
// db_controller => ui
connect(db_controller, SIGNAL(serverConnected()), this, SLOT(serverConnected()));
connect(db_controller, SIGNAL(serverErrorWithConnection(QString)),
this, SLOT(serverErrorWithConnection(QString)));
connect(db_controller, SIGNAL(serverDisconnected()), this, SLOT(serverDisconnected()));
connect(db_controller, SIGNAL(tableSelected(QSqlQueryModel*)), this, SLOT(displayTable(QSqlQueryModel*)));
connect(db_controller, SIGNAL(gotTablesNames(QStringList)), this, SLOT(fillTablesNames(QStringList)));
// load settings
QString inifile("config.ini");
QFileInfo check_file(inifile);
if (check_file.exists() && check_file.isFile())
{
QSettings settings(inifile, QSettings::Format::IniFormat);
QString engine = settings.value("sql/engine", "").toString();
if (engine == "mysql")
{
ui->radio_mysql->setChecked(true);
ui->radio_windows_authentication->setEnabled(false);
ui->lineEdit_driver->setEnabled(false);
}
else if (engine == "mssql")
{
ui->radio_mssql->setChecked(true);
}
ui->lineEdit_driver->setText(settings.value("sql/driver", "").toString());
ui->lineEdit_server_address->setText(settings.value("sql/address", "").toString());
ui->spinBox_server_port->setValue(settings.value("sql/port", 0).toInt());
QString auth = settings.value("sql/authentication", "").toString();
ui->radio_sql_authentication->setChecked(auth == "server" && (engine == "mssql" || engine == "mysql"));
ui->radio_windows_authentication->setChecked(auth == "windows" && engine == "mssql");
ui->lineEdit_login->setText(settings.value("sql/login", "").toString());
ui->lineEdit_password->setText(settings.value("sql/password", "").toString()); // plain text, so secure...
ui->lineEdit_database_name->setText(settings.value("sql/database", "").toString());
ui->statusBar->showMessage("Settings file config.ini loaded", 3000);
}
else
{
ui->statusBar->showMessage("Settings file config.ini does not exist", 5000);
}
}
MainWindow::~MainWindow()
{
db_thread->exit();
db_thread->wait();
delete ui;
}
void MainWindow::connectToServerRequested()
{
QString engine;
if (ui->radio_mysql->isChecked())
engine = "mysql";
else if (ui->radio_mssql->isChecked())
engine = "mssql";
else
{
QMessageBox::information(this,
"Invalid Engine",
"Choose database engine",
QMessageBox::Ok);
return;
}
QString driver = ui->lineEdit_driver->text(),
server = ui->lineEdit_server_address->text(),
database = ui->lineEdit_database_name->text(),
login = ui->lineEdit_login->text(),
password = ui->lineEdit_password->text();
int port = ui->spinBox_server_port->value();
if (server == "")
{
QMessageBox::information(this,
"Invalid Connection Data",
"Insert server address to connect",
QMessageBox::Ok);
return;
}
bool is_sql_authentication = ui->radio_sql_authentication->isChecked();
if (is_sql_authentication && login == "")
{
QMessageBox::information(this,
"Invalid Connection Data",
"Insert login to connect",
QMessageBox::Ok);
return;
}
if (database == "")
{
QMessageBox::information(this,
"Invalid Connection Data",
"Insert database name to connect",
QMessageBox::Ok);
return;
}
ui->button_connect->setEnabled(false);
ui->statusBar->showMessage("Connecting...");
emit connectToServer(engine, driver, server, port, database, login, password, is_sql_authentication);
}
void MainWindow::disconnectFromServerRequested()
{
ui->button_connect->setEnabled(false);
emit disconnectFromServer();
}
void MainWindow::authenticationMethodChanged()
{
bool is_sql_authentication = ui->radio_sql_authentication->isChecked();
ui->lineEdit_login->setEnabled(is_sql_authentication);
ui->lineEdit_password->setEnabled(is_sql_authentication);
}
void MainWindow::engineChanged()
{
bool is_mssql_engine = ui->radio_mssql->isChecked();
ui->lineEdit_driver->setEnabled(is_mssql_engine);
ui->radio_windows_authentication->setEnabled(is_mssql_engine);
ui->spinBox_server_port->setValue(is_mssql_engine ? 1433 : 3306);
if (!is_mssql_engine)
{
ui->radio_sql_authentication->setChecked(true);
emit authenticationMethodChanged();
}
}
void MainWindow::showTableRequested()
{
ui->button_show_table->setEnabled(false);
QString table_name = ui->comboBox_table_name->currentText();
emit selectTable(table_name);
}
void MainWindow::serverConnected()
{
ui->button_connect->setEnabled(true);
disconnect(ui->button_connect, SIGNAL(clicked()), this, SLOT(connectToServerRequested()));
connect(ui->button_connect, SIGNAL(clicked()), this, SLOT(disconnectFromServerRequested()));
ui->button_connect->setText("Disconnect");
ui->groupBox_database_browser->setEnabled(true);
ui->statusBar->showMessage("Connected", 3000);
emit getTablesNames();
}
void MainWindow::fillTablesNames(QStringList tables_names)
{
if (tables_names.length() == 0)
QMessageBox::warning(this,
"Tables",
"There are no tables to display in the database",
QMessageBox::Ok);
else
{
ui->comboBox_table_name->addItems(tables_names);
ui->comboBox_table_name->setEnabled(true);
ui->comboBox_table_name->setFocus();
}
}
void MainWindow::serverErrorWithConnection(QString message)
{
QMessageBox::critical(this,
"Connection failed",
message,
QMessageBox::Ok);
ui->button_connect->setEnabled(true);
ui->statusBar->showMessage("Connection failed", 3000);
}
void MainWindow::serverDisconnected()
{
disconnect(ui->button_connect, SIGNAL(clicked()), this, SLOT(disconnectFromServerRequested()));
connect(ui->button_connect, SIGNAL(clicked()), this, SLOT(connectToServerRequested()));
ui->tableView_database_table->setModel(NULL);
ui->button_connect->setEnabled(true);
ui->button_connect->setText("Connect");
ui->comboBox_table_name->clear();
ui->comboBox_table_name->setEnabled(false);
ui->groupBox_database_browser->setEnabled(false);
ui->button_connect->setFocus();
}
void MainWindow::displayTable(QSqlQueryModel* model)
{
if (!model->lastError().isValid())
ui->tableView_database_table->setModel(model);
else
QMessageBox::critical(this,
"Select failed",
model->lastError().databaseText(),
QMessageBox::Ok);
ui->button_show_table->setEnabled(true);
ui->comboBox_table_name->setFocus();
}
void MainWindow::keyPressEvent(QKeyEvent* pe)
{
if (pe->key() == Qt::Key_Enter || pe->key() == Qt::Key_Return)
{
if (!db_controller->checkIfConnected())
emit connectToServerRequested();
else if (ui->comboBox_table_name->isEnabled() && ui->comboBox_table_name->hasFocus())
emit showTableRequested();
}
}

49
src/mainwindow.h Normal file
View File

@ -0,0 +1,49 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "db_controller.h"
#include <QMainWindow>
namespace Ui
{
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget* parent, DbController* dbc, QThread* dbt);
~MainWindow();
public slots:
void connectToServerRequested();
void disconnectFromServerRequested();
void engineChanged();
void authenticationMethodChanged();
void showTableRequested();
void serverConnected();
void serverErrorWithConnection(QString);
void serverDisconnected();
void displayTable(QSqlQueryModel*);
void fillTablesNames(QStringList);
signals:
void connectToServer(QString, QString, QString, int, QString, QString, QString, bool);
void disconnectFromServer();
void selectTable(QString);
void getTablesNames();
private:
Ui::MainWindow* ui;
DbController* db_controller;
QThread* db_thread;
protected:
virtual void keyPressEvent(QKeyEvent*);
};
#endif // MAINWINDOW_H

556
src/mainwindow.ui Normal file
View File

@ -0,0 +1,556 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>690</width>
<height>483</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>690</width>
<height>483</height>
</size>
</property>
<property name="windowTitle">
<string>Qt SQL Example</string>
</property>
<property name="windowIcon">
<iconset resource="../res/icons.qrc">
<normaloff>:/icons/database.ico</normaloff>:/icons/database.ico</iconset>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox_sql_drivers">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>45</height>
</size>
</property>
<property name="title">
<string>Qt SQL database drivers</string>
</property>
<widget class="QLabel" name="label_qmysql_icon">
<property name="geometry">
<rect>
<x>53</x>
<y>23</y>
<width>13</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/icons.qrc">:/icons/failure.ico</pixmap>
</property>
</widget>
<widget class="QLabel" name="label_qodbc_icon">
<property name="geometry">
<rect>
<x>143</x>
<y>23</y>
<width>13</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/icons.qrc">:/icons/failure.ico</pixmap>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>73</x>
<y>22</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>QMYSQL</string>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>163</x>
<y>22</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>QODBC</string>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_sql_connect">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>390</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="title">
<string>Connect to server</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<widget class="QGroupBox" name="groupBox_authentication">
<property name="geometry">
<rect>
<x>10</x>
<y>175</y>
<width>231</width>
<height>141</height>
</rect>
</property>
<property name="title">
<string>Authentication</string>
</property>
<widget class="QLineEdit" name="lineEdit_login">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>90</x>
<y>54</y>
<width>131</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QRadioButton" name="radio_sql_authentication">
<property name="geometry">
<rect>
<x>10</x>
<y>24</y>
<width>151</width>
<height>17</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SQL Server authentication</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QRadioButton" name="radio_windows_authentication">
<property name="geometry">
<rect>
<x>10</x>
<y>114</y>
<width>141</width>
<height>17</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Windows authentication</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_password">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>90</x>
<y>84</y>
<width>131</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>30</x>
<y>54</y>
<width>51</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>login:</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>30</x>
<y>84</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>password:</string>
</property>
</widget>
<zorder>lineEdit_login</zorder>
<zorder>radio_sql_authentication</zorder>
<zorder>radio_windows_authentication</zorder>
<zorder>lineEdit_password</zorder>
<zorder>label</zorder>
<zorder>label_2</zorder>
<zorder>groupBox_sql_drivers</zorder>
</widget>
<widget class="QPushButton" name="button_connect">
<property name="geometry">
<rect>
<x>88</x>
<y>356</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Connect</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>115</y>
<width>41</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>server:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_server_address">
<property name="geometry">
<rect>
<x>100</x>
<y>115</y>
<width>141</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_database_name">
<property name="geometry">
<rect>
<x>100</x>
<y>326</y>
<width>141</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>10</x>
<y>326</y>
<width>81</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>database name:</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>10</x>
<y>145</y>
<width>51</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>port:</string>
</property>
</widget>
<widget class="QSpinBox" name="spinBox_server_port">
<property name="geometry">
<rect>
<x>100</x>
<y>145</y>
<width>61</width>
<height>22</height>
</rect>
</property>
<property name="toolTip">
<string>Default: MySQL 3306; MSSQL 1433</string>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>10</x>
<y>85</y>
<width>41</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>driver:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_driver">
<property name="geometry">
<rect>
<x>100</x>
<y>85</y>
<width>141</width>
<height>20</height>
</rect>
</property>
<property name="toolTip">
<string>For ODBC/MSSQL: &quot;SQL Server&quot; (Windows), &quot;ODBC Driver 13 for SQL Server&quot;, &quot;FreeTDS&quot; (unix), etc.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QGroupBox" name="groupBox_engine">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>231</width>
<height>51</height>
</rect>
</property>
<property name="title">
<string>Engine</string>
</property>
<widget class="QRadioButton" name="radio_mssql">
<property name="geometry">
<rect>
<x>135</x>
<y>20</y>
<width>82</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>MSSQL</string>
</property>
</widget>
<widget class="QRadioButton" name="radio_mysql">
<property name="geometry">
<rect>
<x>45</x>
<y>20</y>
<width>82</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>MySQL</string>
</property>
</widget>
</widget>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox_database_browser">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>300</height>
</size>
</property>
<property name="title">
<string>Database browser</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QComboBox" name="comboBox_table_name">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>130</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="button_show_table">
<property name="text">
<string>Show</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>table:</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<widget class="QTableView" name="tableView_database_table"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>radio_mysql</tabstop>
<tabstop>radio_mssql</tabstop>
<tabstop>lineEdit_driver</tabstop>
<tabstop>lineEdit_server_address</tabstop>
<tabstop>spinBox_server_port</tabstop>
<tabstop>radio_sql_authentication</tabstop>
<tabstop>lineEdit_login</tabstop>
<tabstop>lineEdit_password</tabstop>
<tabstop>radio_windows_authentication</tabstop>
<tabstop>lineEdit_database_name</tabstop>
<tabstop>button_connect</tabstop>
<tabstop>comboBox_table_name</tabstop>
<tabstop>button_show_table</tabstop>
<tabstop>tableView_database_table</tabstop>
</tabstops>
<resources>
<include location="../res/icons.qrc"/>
</resources>
<connections/>
</ui>