QmlDesigner.propertyEditor: adding new files

This commit is contained in:
Thomas Hartmann
2010-03-02 12:15:53 +01:00
parent 72b9ad39a0
commit caf8a4516a
2 changed files with 61 additions and 0 deletions

View File

@@ -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

View File

@@ -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