From 6cd0519237763ff8d1787bd4c913eb2b32777712 Mon Sep 17 00:00:00 2001 From: Bent Witthold Date: Tue, 23 Dec 2025 10:08:11 +0100 Subject: [PATCH 1/2] Using the application name set in the core (with "-dev" suffix in debug builds) as window title. --- mainwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 5397ccc..da456be 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -22,7 +22,8 @@ MainWindow::MainWindow(QWidget* parent) ui->setupUi(this); m_core = std::make_unique(); - setWindowTitle(windowTitle() + " [*]"); + + setWindowTitle(QCoreApplication::applicationName() + " [*]"); /// application icon const QString iconString = "://feature.png"; From 8333be2044cfa277a922da959251f19a43f66691 Mon Sep 17 00:00:00 2001 From: Bent Witthold Date: Tue, 23 Dec 2025 10:18:00 +0100 Subject: [PATCH 2/2] Items can be saved via menu action and when exiting application with unclean undo stack. --- mainwindow.cpp | 10 +++++++--- mainwindow.h | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index da456be..b372b16 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -77,7 +77,7 @@ void MainWindow::closeEvent(QCloseEvent* event) { switch (ret) { case QMessageBox::Save: - // TODO m_core->saveItems(); + emit saveItems(); event->accept(); break; case QMessageBox::Discard: @@ -233,6 +233,11 @@ void MainWindow::onShowUndoViewToggled(bool checked) { } } +void MainWindow::saveItems() { + showStatusMessage(tr("Invoked 'File|Save'")); + m_core->saveItems(); +} + void MainWindow::createActions() { // TODO add generic menu actions (file/new, edit/cut, ...) createFileActions(); @@ -258,8 +263,7 @@ void MainWindow::createFileActions() { m_saveAct = make_unique(tr("&Save"), this); m_saveAct->setShortcuts(QKeySequence::Save); m_saveAct->setStatusTip(tr("Save the document to disk")); - // connect(m_saveAct, &QAction::triggered, this, &MainWindow::save); - m_saveAct->setEnabled(false); + connect(m_saveAct.get(), &QAction::triggered, this, &MainWindow::saveItems); ui->menu_File->addAction(m_saveAct.get()); ui->menu_File->addSeparator(); diff --git a/mainwindow.h b/mainwindow.h index 652087d..1da27c5 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -54,6 +54,9 @@ class MainWindow : public QMainWindow { void onCleanStateChanged(bool clean); void onShowUndoViewToggled(bool checked); + /// 'File' slots + void saveItems(); + private: Ui::MainWindow* ui;