From e75afb9ab5746b97cb2d9f1538f7fd9ec943bb10 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@qt.io>
Date: Tue, 29 Oct 2019 08:20:14 +0100
Subject: [PATCH] QAbstractFormBuilder::save(): Add a note explaining property
 issues

State that the resulting files are not intended to be used
without editing.

Change-Id: I5ae342907a9394427ef9d3471ff2670421da8cc0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Kavindra Palaraja <kpalaraja@luxoft.com>
---
 .../src/lib/uilib/abstractformbuilder.cpp         | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/designer/src/lib/uilib/abstractformbuilder.cpp b/src/designer/src/lib/uilib/abstractformbuilder.cpp
index bc7ba02bf..e57237dd0 100644
--- a/src/designer/src/lib/uilib/abstractformbuilder.cpp
+++ b/src/designer/src/lib/uilib/abstractformbuilder.cpp
@@ -1201,6 +1201,21 @@ QActionGroup *QAbstractFormBuilder::createActionGroup(QObject *parent, const QSt
     Saves an XML representation of the given \a widget to the
     specified \a device in the standard UI file format.
 
+    \note Unlike when saving a form in Qt Designer, all property values are
+    written. This is because, the state of whether a property value was
+    modified or not isn't stored in the Qt property system. The widget that
+    is being saved, could have been created dynamically, not loaded via
+    \l load(), so in this case the form builder isn't aware of the list of
+    changed properties. Also, there's no generic way to do this for widgets
+    that were created dynamically.
+
+    Therefore, you should remove properties that are not required from your
+    resulting XML files, before loading them. Alternatively, if you already
+    know which properties you want to save when you call this method,
+    you can overload \l computeProperties() and return a filtered list of
+    required properties. Otherwise, unexpected behavior may occur as some
+    of these properties may depend on each other.
+
     \sa load()
 */
 void QAbstractFormBuilder::save(QIODevice *dev, QWidget *widget)
-- 
GitLab