diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9b94842ccddb9cf1caaf2ef5fe89536b9f55495c --- /dev/null +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp @@ -0,0 +1,34 @@ +#include "propertyeditortransaction.h" + +#include <QDebug> + +namespace QmlDesigner { + +PropertyEditorTransaction::PropertyEditorTransaction(QmlDesigner::PropertyEditor *propertyEditor) : QObject(propertyEditor), m_propertyEditor(propertyEditor) +{ +} + +void PropertyEditorTransaction::start() +{ + if (m_rewriterTransaction.isValid()) + m_rewriterTransaction.commit(); + m_rewriterTransaction = m_propertyEditor->beginRewriterTransaction(); + startTimer(4000); +} + +void PropertyEditorTransaction::end() +{ + if (m_rewriterTransaction.isValid()) + m_rewriterTransaction.commit(); +} + +void PropertyEditorTransaction::timerEvent(QTimerEvent *timerEvent) +{ + qDebug() << "timer"; + killTimer(timerEvent->timerId()); + if (m_rewriterTransaction.isValid()) + m_rewriterTransaction.commit(); +} + +} //QmlDesigner + diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.h new file mode 100644 index 0000000000000000000000000000000000000000..84b96f35b7895080a1a1b225aa2c66f46f70406c --- /dev/null +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.h @@ -0,0 +1,27 @@ +#ifndef PROPERTYEDITORTRANSACTION_H +#define PROPERTYEDITORTRANSACTION_H + +#include "propertyeditor.h" + +namespace QmlDesigner { + +class PropertyEditorTransaction : public QObject +{ + Q_OBJECT +public: + PropertyEditorTransaction(QmlDesigner::PropertyEditor *propertyEditor); + +public slots: + void start(); + void end(); +protected: + void timerEvent(QTimerEvent *event); + +private: + QmlDesigner::PropertyEditor *m_propertyEditor; + QmlDesigner::RewriterTransaction m_rewriterTransaction; +}; + +} //QmlDesigner + +#endif // PROPERTYEDITORTRANSACTION_H