An item can be added to the model with accepting the NewItemDialog.

This commit is contained in:
2025-12-08 13:26:42 +01:00
parent 928b795f4e
commit ea75e57dbf
4 changed files with 38 additions and 7 deletions

View File

@ -8,6 +8,7 @@
#include "Dialogs/newitemdialog.h"
#include "data/settingshandler.h"
#include "genericcore.h"
#include "model/tablemodel.h"
static QString updateTextClean = "Do you want to update the application now?";
static QString updateTextDirty = "Do you want to save the tasks & update the application now?";
@ -35,6 +36,9 @@ MainWindow::MainWindow(QWidget* parent)
restoreGeometry(settings.value("geometry").toByteArray());
restoreState(settings.value("windowState").toByteArray());
m_tableModel = m_core->getModel();
ui->tableView->setModel(m_tableModel.get());
createActions();
createHelpMenu();
createGuiDialogs();
@ -44,9 +48,6 @@ MainWindow::MainWindow(QWidget* parent)
connect(this, &MainWindow::displayStatusMessage, this, &MainWindow::showStatusMessage);
connect(this, &MainWindow::checkForUpdates, this,
&MainWindow::on_actionCheck_for_update_triggered, Qt::QueuedConnection);
m_tableModel = m_core->getModel();
ui->tableView->setModel(m_tableModel.get());
}
MainWindow::~MainWindow() { delete ui; }
@ -129,8 +130,6 @@ void MainWindow::on_pushButton_clicked() {
void MainWindow::openNewItemDialog() {
showStatusMessage(tr("Invoked 'Edit|New Item'"));
qInfo() << "'open new item dialog' action triggered...";
m_newItemDialog->show();
}
@ -268,4 +267,6 @@ void MainWindow::createHelpMenu() {
void MainWindow::createGuiDialogs() {
m_newItemDialog = make_unique<NewItemDialog>(this);
m_newItemDialog->createContent();
connect(m_newItemDialog.get(), &NewItemDialog::addItems, m_tableModel.get(),
&TableModel::appendItems);
}