diff --git a/Manager_DB_/main.cpp b/Manager_DB_/main.cpp index 84235bea74da0abafef81b35b960846e8fa1505e..8a3a43117e6919e70ffe19c2ae3e39b7c1969cf1 100644 --- a/Manager_DB_/main.cpp +++ b/Manager_DB_/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) std::string str; - std::cout << "Enter the command: " << std::endl; + /*std::cout << "Enter the command: " << std::endl; std::cout.flush(); std::getline(std::cin, str); QString command(str.c_str()); @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) } while (str != "STOP PROGRAMM"); - return a.exec(); + return a.exec();*/ MainWindow w; w.show(); diff --git a/Manager_DB_/mainwindow.cpp b/Manager_DB_/mainwindow.cpp index 41a26bdf8fe5de4d2be161b1d7188a936c25f016..e7cefb63e1b69f81ceb4cbb5073c1c5a608ecb1a 100644 --- a/Manager_DB_/mainwindow.cpp +++ b/Manager_DB_/mainwindow.cpp @@ -6,6 +6,32 @@ MainWindow::MainWindow(QWidget *parent) , ui(new Ui::MainWindow) { ui->setupUi(this); + ui->lineEdit->setPlaceholderText("Enter the command"); + connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(ok_clicked())); + connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(clear_clicked())); + connect(ui->actionExit, SIGNAL(clicked()), this, SLOT(exit_clicked())); +} + +void MainWindow::ok_clicked() { + QString command = ui->lineEdit->text(); + + QSqlQuery query; + bool cmd = query.exec(command); + + ui->textEdit_log->append(command); + ui->textEdit_log->append("\n"); + + if (!cmd) { + ui->textEdit_log->append(query.lastError().text()); + } +} + +void MainWindow::exit_clicked() { + QApplication::quit(); +} + +void MainWindow::clear_clicked() { + ui->lineEdit->clear(); } MainWindow::~MainWindow() diff --git a/Manager_DB_/mainwindow.h b/Manager_DB_/mainwindow.h index 4643e322a280a4f4c1c6628a0ccb18ea94797ffa..e3948d1a9e1febae18bfb3021e06212aefb3afe1 100644 --- a/Manager_DB_/mainwindow.h +++ b/Manager_DB_/mainwindow.h @@ -2,6 +2,17 @@ #define MAINWINDOW_H #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } @@ -17,5 +28,10 @@ public: private: Ui::MainWindow *ui; + +public slots: + void ok_clicked(); + void clear_clicked(); + void exit_clicked(); }; #endif // MAINWINDOW_H diff --git a/Manager_DB_/mainwindow.ui b/Manager_DB_/mainwindow.ui index eadbfef5e6ce0ae1f42dd67aa35654cc47555a4c..9ef2b3d02b79e10eb4d2631c4a3243a24267c53a 100644 --- a/Manager_DB_/mainwindow.ui +++ b/Manager_DB_/mainwindow.ui @@ -26,53 +26,23 @@ MainWindow - - - - 0 - 20 - 150 - 431 - - - - - 150 - 0 - 621 - 451 + 220 + 10 + 541 + 311 - + 10 - 0 - 131 - 21 - - - - - Nirmala UI - 10 - - - - Список таблиц - - - - - - 0 - 530 - 691 - 31 + 330 + 751 + 191 @@ -80,46 +50,41 @@ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&gt;&gt;&gt;</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> - + - -10 - 450 - 781 - 81 + 593 + 531 + 80 + 31 - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> + + OK - + - 730 - 530 - 41 + 11 + 531 + 571 31 - OK + - 690 - 530 - 41 + 680 + 531 + 80 31 @@ -127,6 +92,37 @@ p, li { white-space: pre-wrap; } clear + + + + 10 + 11 + 201 + 311 + + + + + + + + Nirmala UI + 10 + + + + <html><head/><body><p align="center"><span style=" font-size:12pt; font-weight:600;">Список таблиц</span></p></body></html> + + + Qt::RichText + + + + + + + +