forked from qt-creator/qt-creator
QmlDesigner.propertyEditor: adding new files
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user