QmlDesigner: Fix drag-adjusting values not ending up with correct value

When drag-adjusting e.g. brightness or position of the object in 3D
edit view, the value ending up in property editor and qml doc didn't
always match what was displayed on 3D edit view. This happened because
ValuesModifiedCommand was compressed to 100ms intervals, but any
property changes also sent ValuesChangedCommand at 16ms interval,
which changed the instance value at backend, but not the model value.

Fixed by comparing modified value to model value instead of instance
value.

Also made the 100ms compression timer singleshot, so the backend
wouldn't be unnecessarily bombarded with ValuesModifiedCommand when
holding the mouse still while dragging.

Change-Id: If86dcd61bcf0c04735d65648e4c34d9d214c5313
Fixes: QDS-2081
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2020-05-15 17:25:33 +03:00
parent 47ca3ccd8f
commit 5b28847648
2 changed files with 2 additions and 1 deletions

View File

@@ -487,6 +487,7 @@ Qt5InformationNodeInstanceServer::Qt5InformationNodeInstanceServer(NodeInstanceC
Qt5NodeInstanceServer(nodeInstanceClient)
{
m_propertyChangeTimer.setInterval(100);
m_propertyChangeTimer.setSingleShot(true);
m_selectionChangeTimer.setSingleShot(true);
m_renderTimer.setSingleShot(true);
}

View File

@@ -1254,7 +1254,7 @@ void NodeInstanceView::valuesModified(const ValuesModifiedCommand &command)
if (instance.isValid()) {
// QmlVisualNode is needed so timeline and state are updated
QmlVisualNode node = instance.modelNode();
if (node.instanceValue(container.name()) != container.value())
if (node.modelValue(container.name()) != container.value())
node.setVariantProperty(container.name(), container.value());
}
}