Commit bea01410 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.propertyEditor: add rewriter transactions

parent d9d37a22
......@@ -65,10 +65,10 @@ QWidget {
}
onSliderPressed: {
backendValue.lock();
transaction.start();
}
onSliderReleased: {
backendValue.unlock();
transaction.end();
}
}
}
......
......@@ -48,6 +48,7 @@
#include "qproxylayoutitem.h"
#include "fontwidget.h"
#include "siblingcombobox.h"
#include "propertyeditortransaction.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
......@@ -71,7 +72,7 @@ enum {
namespace QmlDesigner {
PropertyEditor::NodeType::NodeType(PropertyEditor *propertyEditor) :
m_view(new QDeclarativeView)
m_view(new QDeclarativeView), m_propertyEditorTransaction(new PropertyEditorTransaction(propertyEditor))
{
Q_ASSERT(QFileInfo(":/images/button_normal.png").exists());
......@@ -172,6 +173,7 @@ void PropertyEditor::NodeType::setup(const QmlObjectNode &fxObjectNode, const QS
m_backendAnchorBinding.setup(QmlItemNode(fxObjectNode.modelNode()));
ctxt->setContextProperty("anchorBackend", &m_backendAnchorBinding);
ctxt->setContextProperty("transaction", m_propertyEditorTransaction.data());
ctxt->setContextProperty("backendValues", &m_backendValuesPropertyMap);
ctxt->setContextProperty("specificsUrl", QVariant(qmlSpecificsFile));
......@@ -212,6 +214,7 @@ void PropertyEditor::NodeType::initialSetup(const QString &typeName, const QUrl
m_backendValuesPropertyMap.insert("id", QVariant::fromValue(valueObject));
ctxt->setContextProperty("anchorBackend", &m_backendAnchorBinding);
ctxt->setContextProperty("transaction", m_propertyEditorTransaction.data());
ctxt->setContextProperty("backendValues", &m_backendValuesPropertyMap);
ctxt->setContextProperty("specificsUrl", QVariant(qmlSpecificsFile));
......
......@@ -44,6 +44,8 @@ QT_END_NAMESPACE
namespace QmlDesigner {
class PropertyEditorTransaction;
class PropertyEditor: public QmlModelView
{
Q_OBJECT
......@@ -60,6 +62,7 @@ class PropertyEditor: public QmlModelView
QDeclarativeView *m_view;
Internal::QmlAnchorBindingProxy m_backendAnchorBinding;
QDeclarativePropertyMap m_backendValuesPropertyMap;
QScopedPointer<PropertyEditorTransaction> m_propertyEditorTransaction;
};
public:
......
......@@ -15,7 +15,8 @@ SOURCES += propertyeditor.cpp \
filewidget.cpp \
propertyeditorvalue.cpp \
fontwidget.cpp \
siblingcombobox.cpp
siblingcombobox.cpp \
propertyeditortransaction.cpp
HEADERS += propertyeditor.h \
qmlanchorbindingproxy.h \
allpropertiesbox.h \
......@@ -30,7 +31,8 @@ HEADERS += propertyeditor.h \
filewidget.h \
propertyeditorvalue.h \
fontwidget.h \
siblingcombobox.h
siblingcombobox.h \
propertyeditortransaction.h
QT += declarative
RESOURCES += propertyeditor.qrc
FORMS += behaviordialog.ui
......@@ -186,24 +186,6 @@ void PropertyEditorValue::resetValue()
}
}
void PropertyEditorValue::lock()
{
if (!modelNode().isValid())
return;
//Q_ASSERT(!m_rewriterTransaction.isValid());
//m_rewriterTransaction = modelNode().view()->beginRewriterTransaction();
}
void PropertyEditorValue::unlock()
{
if (!modelNode().isValid())
return;
//Q_ASSERT(m_rewriterTransaction.isValid());
//m_rewriterTransaction.commit();
}
void PropertyEditorValue::registerDeclarativeTypes()
{
QML_REGISTER_TYPE(Bauhaus,1,0,PropertyEditorValue,PropertyEditorValue);
......
......@@ -121,8 +121,6 @@ public:
public slots:
void resetValue();
void lock();
void unlock();
signals:
void valueChanged(const QString &name);
......@@ -144,8 +142,7 @@ private: //variables
bool m_isInModel;
bool m_isBound;
bool m_isValid; // if the property value belongs to a non-existing complexProperty it is invalid
PropertyEditorNodeWrapper *m_complexNode;
QmlDesigner::RewriterTransaction m_rewriterTransaction;
PropertyEditorNodeWrapper *m_complexNode;
};
QML_DECLARE_TYPE(PropertyEditorValue);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment