From 4e21daa0210b2aa385792e1c4cb01f57804c5dcb Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 2 Oct 2019 14:06:56 +0200 Subject: Re-add the warnings about deprecated default binding restore mode We _really_ want people to port away from this. And yes, we are going to change it. Amends commit c273175ffec925a4164de41a79c21d785a1761a7. Task-number: QTBUG-33444 Task-number: QTBUG-78566 Change-Id: Iab50b8c7bad043528602e2e617c772de06d18b1e Reviewed-by: Simon Hausmann Reviewed-by: Pierre-Yves Siret --- src/qml/types/qqmlbind.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/qml') diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp index 9d305cd24c..8f40f4f704 100644 --- a/src/qml/types/qqmlbind.cpp +++ b/src/qml/types/qqmlbind.cpp @@ -359,7 +359,8 @@ void QQmlBind::setDelayed(bool delayed) \li Binding.RestoreBindingOrValue The original value is always restored. \endlist - The default value is Binding.RestoreBinding. + \warning The default value is Binding.RestoreBinding. This will change in + Qt 5.15 to Binding.RestoreBindingOrValue. If you rely on any specific behavior regarding the restoration of plain values when bindings get disabled you should migrate to explicitly set the @@ -456,11 +457,23 @@ void QQmlBind::eval() Q_ASSERT(vmemo); vmemo->setVMEProperty(propPriv->core.coreIndex(), *d->v4Value.valueRef()); d->clearPrev(); + } else if (!d->restoreModeExplicit) { + qmlWarning(this) + << "Not restoring previous value because restoreMode has not been set." + << "This behavior is deprecated." + << "In Qt < 5.15 the default is Binding.RestoreBinding." + << "In Qt >= 5.15 the default is Binding.RestoreBindingOrValue."; } } else if (d->prevIsVariant) { if (d->restoreValue) { d->prop.write(d->prevValue); d->clearPrev(); + } else if (!d->restoreModeExplicit) { + qmlWarning(this) + << "Not restoring previous value because restoreMode has not been set." + << "This behavior is deprecated." + << "In Qt < 5.15 the default is Binding.RestoreBinding." + << "In Qt >= 5.15 the default is Binding.RestoreBindingOrValue."; } } return; -- cgit v1.2.3