summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@digia.com>2014-05-21 18:00:20 +0200
committerThomas Hartmann <Thomas.Hartmann@digia.com>2014-05-22 15:39:05 +0200
commitc2682f9b0c5a57f32a7056a670345803b388e392 (patch)
tree41e191db6c27ab1609cd63b1a43aa962c7e12766
parentb5559e73f43559a726d8ec7a144f6534c7380350 (diff)
downloadqt-creator-c2682f9b0c5a57f32a7056a670345803b388e392.tar.gz
QmlDesigner.PropertyEditor: Adding signal selectionToBeChanged
Controls can connect to this signal and commit data to the backend before the slection changes. This is required since editingFinished signals are usually triggered to "late". Change-Id: I99fa27064473ceee2d1a21b25f64a13370fb4cef Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp5
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h2
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp3
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp5
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.h3
5 files changed, 18 insertions, 0 deletions
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
index e985d03870..d0b792b685 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
@@ -437,6 +437,11 @@ bool PropertyEditorQmlBackend::checkIfUrlExists(const QUrl &url)
return (QFileInfo(fileFromUrl(url)).exists());
}
+void PropertyEditorQmlBackend::emitSelectionToBeChanged()
+{
+ m_backendModelNode.emitSelectionToBeChanged();
+}
+
QUrl PropertyEditorQmlBackend::getQmlUrlForModelNode(const ModelNode &modelNode, TypeName &className)
{
if (modelNode.isValid()) {
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h
index cccbce7eab..e79caab56a 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h
@@ -74,6 +74,8 @@ public:
static bool checkIfUrlExists(const QUrl &url);
+ void emitSelectionToBeChanged();
+
private:
void createPropertyEditorValue(const QmlObjectNode &qmlObjectNode,
const PropertyName &name, const QVariant &value,
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp
index 0cf7b5016f..46e80c9238 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp
@@ -577,6 +577,9 @@ void PropertyEditorView::scriptFunctionsChanged(const ModelNode &/*node*/, const
void PropertyEditorView::select(const ModelNode &node)
{
+ if (m_qmlBackEndForCurrentType)
+ m_qmlBackEndForCurrentType->emitSelectionToBeChanged();
+
if (QmlObjectNode(node).isValid())
m_selectedNode = node;
else
diff --git a/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp b/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp
index 776e6c00d2..220e6f81ba 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp
@@ -50,4 +50,9 @@ void QmlModelNodeProxy::registerDeclarativeType()
qmlRegisterType<QmlModelNodeProxy>("HelperWidgets",2,0,"ModelNodeProxy");
}
+void QmlModelNodeProxy::emitSelectionToBeChanged()
+{
+ emit selectionToBeChanged();
+}
+
}
diff --git a/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.h b/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.h
index 516477fcfe..d72644ff44 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.h
@@ -47,8 +47,11 @@ public:
static void registerDeclarativeType();
+ void emitSelectionToBeChanged();
+
signals:
void selectionChanged();
+ void selectionToBeChanged();
public slots: