summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2023-07-18 14:18:39 +0800
committerMitch Curtis <mitch.curtis@qt.io>2023-10-02 12:22:44 +0800
commitccda3362464bfaff999b739aa81925c7b51075a9 (patch)
treea0690a0ca119354ff1b6d645ecd0fc6651dde45a /src/corelib/doc
parentda0571d87890b587154a6d9124ac29dc30b151dd (diff)
Doc: state that models are not thread-safe
Fixes: QTBUG-107598 Pick-to: 5.15 6.2 6.5 6.6 Change-Id: I0e7ea8d4b2094d92b3cad5eec5b30e6e3ac64018 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/doc')
-rw-r--r--src/corelib/doc/src/includes/models.qdocinc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/corelib/doc/src/includes/models.qdocinc b/src/corelib/doc/src/includes/models.qdocinc
new file mode 100644
index 0000000000..cf840b1cae
--- /dev/null
+++ b/src/corelib/doc/src/includes/models.qdocinc
@@ -0,0 +1,14 @@
+//! [thread-safety-section1]
+\section1 Thread safety
+
+Being a \l {Accessing QObject Subclasses from Other Threads}{subclass of
+QObject}, \1 is not \l {Reentrancy and Thread-Safety}{thread-safe}. Any \1
+model-related API should only be called from the thread the model object lives
+in. If the \1 is connected with a view, that means the GUI thread, as that is
+where the view lives, and it will call into the model from the GUI thread.
+Using a background thread to populate or modify the contents of a model is
+possible, but requires care, as the background thread cannot call any
+model-related API directly. Instead, you should queue the updates and apply
+them in the main thread. This can be done with \l {Signals and Slots Across
+Threads}{queued connections}.
+//! [thread-safety-section1]