48 lines
752 B
C++
48 lines
752 B
C++
#pragma once
|
|
|
|
#include "DataModel.h"
|
|
|
|
#include <QMainWindow>
|
|
#include <QString>
|
|
|
|
|
|
class DataModel;
|
|
class QDataWidgetMapper;
|
|
|
|
namespace Ui {
|
|
class MainWindow;
|
|
};
|
|
|
|
class MainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
private:
|
|
Ui::MainWindow *ui;
|
|
DataModel m_dataModel;
|
|
QString m_filename;
|
|
bool m_saveOnClose = false;
|
|
|
|
public:
|
|
MainWindow(QWidget *parent);
|
|
MainWindow(QWidget *parent, const QString &filename);
|
|
~MainWindow();
|
|
|
|
public slots:
|
|
void newFile();
|
|
void openFile();
|
|
void openFile(const QString &filename);
|
|
void saveFile();
|
|
void saveFileAs();
|
|
void closeFile();
|
|
void print() const;
|
|
void dataModelChanged();
|
|
|
|
protected:
|
|
void closeEvent(QCloseEvent *event) override;
|
|
|
|
private:
|
|
void setupUi();
|
|
void saveFile(const QString &filename);
|
|
};
|