Added an about dialog with version info

This commit is contained in:
Michael Mandl 2019-01-30 21:41:03 +01:00
parent eff3b42cb0
commit 7c71733184
3 changed files with 24 additions and 0 deletions

View file

@ -1,6 +1,8 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "version.h"
#include <QJsonObject> #include <QJsonObject>
#include <QJsonDocument> #include <QJsonDocument>
#include <QFile> #include <QFile>
@ -58,6 +60,8 @@ void MainWindow::setupUi()
connect(ui->actionPrint, &QAction::triggered, this, &MainWindow::print); connect(ui->actionPrint, &QAction::triggered, this, &MainWindow::print);
connect(ui->actionExport_PDF, &QAction::triggered, this, qOverload<>(&MainWindow::savePdf)); connect(ui->actionExport_PDF, &QAction::triggered, this, qOverload<>(&MainWindow::savePdf));
connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::aboutDialog);
connect(&m_dataModel, &DataModel::modelChanged, this, &MainWindow::dataModelChanged); connect(&m_dataModel, &DataModel::modelChanged, this, &MainWindow::dataModelChanged);
} }
@ -235,3 +239,10 @@ void MainWindow::savePdf(const QString &filename)
printDoc.print(&printer); printDoc.print(&printer);
} }
void MainWindow::aboutDialog()
{
QString infoString =
QString::fromUtf8(ESGRAF48_DESCRIPTION) + " Version " + QString::fromUtf8(ESGRAF48_VERSION);
QMessageBox::information(this, ESGRAF48_DESCRIPTION, infoString);
}

View file

@ -38,6 +38,7 @@ public slots:
void print() const; void print() const;
void dataModelChanged(); void dataModelChanged();
void savePdf(); void savePdf();
void aboutDialog();
protected: protected:
void closeEvent(QCloseEvent *event) override; void closeEvent(QCloseEvent *event) override;

View file

@ -137,7 +137,14 @@
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionQuit"/> <addaction name="actionQuit"/>
</widget> </widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Help</string>
</property>
<addaction name="actionAbout"/>
</widget>
<addaction name="menuFile"/> <addaction name="menuFile"/>
<addaction name="menuHelp"/>
</widget> </widget>
<widget class="QToolBar" name="toolBar"> <widget class="QToolBar" name="toolBar">
<property name="windowTitle"> <property name="windowTitle">
@ -237,6 +244,11 @@
<string>Export as PDF file</string> <string>Export as PDF file</string>
</property> </property>
</action> </action>
<action name="actionAbout">
<property name="text">
<string>About</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>