2018-05-10 16:41:14 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-12-02 14:22:44 +00:00
|
|
|
#include "DataModel.h"
|
|
|
|
|
2018-05-10 16:41:14 +00:00
|
|
|
#include <QMainWindow>
|
2018-12-02 14:22:44 +00:00
|
|
|
#include <QString>
|
2018-05-10 16:41:14 +00:00
|
|
|
|
2018-05-20 10:04:21 +00:00
|
|
|
|
2018-05-16 05:02:12 +00:00
|
|
|
class DataModel;
|
|
|
|
class QDataWidgetMapper;
|
|
|
|
|
2018-05-10 16:41:14 +00:00
|
|
|
namespace Ui {
|
2018-05-15 11:11:40 +00:00
|
|
|
class MainWindow;
|
2018-05-10 16:41:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2018-05-16 05:02:12 +00:00
|
|
|
private:
|
|
|
|
Ui::MainWindow *ui;
|
2018-12-02 14:22:44 +00:00
|
|
|
DataModel m_dataModel;
|
2018-10-29 20:53:52 +00:00
|
|
|
QString m_filename;
|
2018-09-29 11:31:23 +00:00
|
|
|
bool m_saveOnClose = false;
|
2018-05-16 05:02:12 +00:00
|
|
|
|
2018-05-15 11:11:40 +00:00
|
|
|
public:
|
2018-12-02 14:22:44 +00:00
|
|
|
MainWindow(QWidget *parent);
|
|
|
|
MainWindow(QWidget *parent, const QString &filename);
|
2018-05-15 11:11:40 +00:00
|
|
|
~MainWindow();
|
2018-05-10 16:41:14 +00:00
|
|
|
|
2018-05-15 11:11:40 +00:00
|
|
|
public slots:
|
2018-05-20 10:04:21 +00:00
|
|
|
void newFile();
|
|
|
|
void openFile();
|
2018-12-02 14:22:44 +00:00
|
|
|
void openFile(const QString &filename);
|
2018-10-29 20:53:52 +00:00
|
|
|
void saveFile();
|
2018-05-20 10:04:21 +00:00
|
|
|
void saveFileAs();
|
2018-09-30 09:38:30 +00:00
|
|
|
void closeFile();
|
2018-10-29 20:53:52 +00:00
|
|
|
void print() const;
|
2018-09-29 11:31:23 +00:00
|
|
|
void dataModelChanged();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent *event) override;
|
2018-05-24 09:54:24 +00:00
|
|
|
|
|
|
|
private:
|
2018-12-02 14:22:44 +00:00
|
|
|
void setupUi();
|
2018-10-29 20:53:52 +00:00
|
|
|
void saveFile(const QString &filename);
|
2018-05-10 16:41:14 +00:00
|
|
|
};
|