diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-10-05 20:57:10 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-10-05 20:57:10 +0200 |
commit | 4625b939aad3537bd130617944e01f5da693b23d (patch) | |
tree | 8cd4b9c94d9ca70b7386b369e16d81c659d01c6f /client/mainwindow.cpp | |
parent | 9c7f4e157f10aa58e4b78636a2f8556be4637a07 (diff) |
initial merge of qt client
Diffstat (limited to 'client/mainwindow.cpp')
-rw-r--r-- | client/mainwindow.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/client/mainwindow.cpp b/client/mainwindow.cpp new file mode 100644 index 0000000..955307e --- /dev/null +++ b/client/mainwindow.cpp @@ -0,0 +1,50 @@ +#include <QSqlDatabase> + +#include "mainwindow.h" +#include "ui_mainwindow.h" +#include "main.h" + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) + , ui(new Ui::MainWindow) +{ +// db = QSqlDatabase::addDatabase("QMYSQL"); + ui->setupUi(this); +} + +MainWindow::~MainWindow() +{ + dbRef.close(); + delete ui; +} + +void MainWindow::on_actionAbout_triggered() +{ + QMessageBox::warning(this, "Oops..", "Task Failed succesfully ;)"); +} + + +void MainWindow::on_pushButton_clicked() +{ +// dbRef = QSqlDatabase::addDatabase("QMYSQL"); +// dbRef.setHostName("localhost"); +// dbRef.setUserName("root"); +// dbRef.setPassword("Ab12345!"); +// dbRef.setDatabaseName("thecrapbox"); + + if(dbRef.open()){ + QMessageBox::information(this, "Connection", "GREAT SUCCES!"); + pQueryModel = new QSqlQueryModel(); + pQueryModel->setQuery("SELECT * FROM opleiding;"); + ui->tableView->setModel(pQueryModel); + } else { + QMessageBox::warning(this, "No connection", "Failed to connect"); + } +} + +void MainWindow::on_actionConnection_triggered() +{ + _dbConenctor = new dbConnector(this); + _dbConenctor->show(); +} + |