Initial undo stack.

--HG--
branch : feature
This commit is contained in:
dismine 2014-06-04 14:30:45 +03:00
parent a4083afc77
commit 0196db77d7
3 changed files with 15 additions and 2 deletions

View File

@ -770,6 +770,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
{
WriteSettings();
event->accept();
qApp->closeAllWindows();
}
else
{

View File

@ -51,8 +51,10 @@ VApplication::VApplication(int &argc, char **argv)
_widthMainLine(DefWidth), _widthHairLine(DefWidth/3.0), measurements(QMap<QString, VTranslation>()),
guiTexts(QMap<QString, VTranslation>()), descriptions(QMap<QString, VTranslation>()),
variables(QMap<QString, VTranslation>()), functions(QMap<QString, VTranslation>()),
postfixOperators(QMap<QString, VTranslation>())
postfixOperators(QMap<QString, VTranslation>()), undoStack(nullptr)
{
undoStack = new QUndoStack(this);
InitLineWidth();
InitMeasurements();
InitVariables();
@ -1935,3 +1937,10 @@ QString VApplication::FormulaToUser(const QString &formula)
return newFormula;
}
//---------------------------------------------------------------------------------------------------------------------
QUndoStack *VApplication::getUndoStack() const
{
return undoStack;
}

View File

@ -30,6 +30,7 @@
#define VAPPLICATION_H
#include <QApplication>
#include <QUndoStack>
#include "../options.h"
#include "vtranslation.h"
@ -81,7 +82,9 @@ public:
QString PostfixOperator(const QString &name) const;
QString FormulaFromUser(const QString &formula);
QString FormulaToUser(const QString &formula);
QUndoStack *getUndoStack() const;
private:
Q_DISABLE_COPY(VApplication)
Valentina::Units _patternUnit;
Pattern::Measurements _patternType;
qreal _widthMainLine;
@ -92,6 +95,7 @@ private:
QMap<QString, VTranslation> variables;
QMap<QString, VTranslation> functions;
QMap<QString, VTranslation> postfixOperators;
QUndoStack *undoStack;
void InitLineWidth();
void InitMeasurements();
void InitVariables();
@ -107,7 +111,6 @@ private:
void CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens,
QMap<int, QString> &numbers);
void BiasTokens(int position, int bias, QMap<int, QString> &tokens) const;
};
inline Valentina::Units VApplication::patternUnit() const