diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/IntEditor.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/IntEditor.qml index f175040d5e9f674b943f33a54e3f40363fb9530e..f39c0c08d4b70663892c6737bd11367d5ffd8db4 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/IntEditor.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/IntEditor.qml @@ -65,10 +65,10 @@ QWidget { } onSliderPressed: { - backendValue.lock(); + transaction.start(); } onSliderReleased: { - backendValue.unlock(); + transaction.end(); } } } diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp index 076c68e50e88817f6857cc5543022707158b32e0..cbe083fec09c39e2168db3ee00d0bbb5e88ba1d3 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp @@ -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)); diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h index 1b930775f6bb942ddac5a422c076eb1a3b73b267..e00520e768307442c6a53efb900814ded8fafc4f 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h @@ -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: diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri index 462ef87c814c5609bf1e7edc151420f92ee2dc33..32449a97599e8adc65f161341479799576bc4606 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri @@ -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 diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp index 920898868f2c7172285aacb5e68c8dbe29c347c4..ee2a8d0878f7245d2195e32246f34c0b9167df85 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp @@ -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); diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h index 726b3bc0379b0a01e430ba730f06417325e5ef96..c327c6b7ce24dbaed3ee8fb192dd72487aa61a5f 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h @@ -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);