Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "mainwindow.h"
- #include "./ui_mainwindow.h"
- MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
- , ui(new Ui::MainWindow)
- {
- ui->setupUi(this);
- db = QSqlDatabase::addDatabase("QSQLITE");
- db.setDatabaseName("../finances.db");
- if (db.isOpen()) {
- model = new QSqlTableModel(this, db);
- model->setTable("Finances");
- model->select();
- ui->tableView->setModel(model);
- } else ui->label->setText("Error: " + QString(db.lastError().databaseText()));
- }
- MainWindow::~MainWindow() { delete ui; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement