diff options
authorPeter Hartmann <>2011-08-02 16:09:24 +0200
committerQt by Nokia <>2011-08-10 13:00:59 +0200
commit661fcee7791a5c19c14ba87b60aaf2b46db19422 (patch)
parentca3120aa20038b22810d675c93cd1eac1dcc88d1 (diff)
QLabel documentation: add warning about sanitizing input
make users more aware of QLabel guessing the text format. Reviewed-by: Gabriel de Dietrich <> (cherry picked from commit 31f7ecbdcdbafbac5bbfa693e4d060757244941b) Change-Id: I681c7daf568a6107b01908fa85d2da2a7e4e228a Reviewed-on: Reviewed-by: Qt Sanity Bot <> Reviewed-by: Peter Hartmann <>
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp
index 26dd0e1120..7a94f42125 100644
--- a/src/gui/widgets/qlabel.cpp
+++ b/src/gui/widgets/qlabel.cpp
@@ -88,6 +88,13 @@ QT_BEGIN_NAMESPACE
by clear().
+ \warning When passing a QString to the constructor or calling setText(),
+ make sure to sanitize your input, as QLabel tries to guess whether it
+ displays the text as plain text or as rich text. You may want to call
+ setTextFormat() explicitly, e.g. in case you expect the text to be in
+ plain format but cannot control the text source (for instance when
+ displaying data loaded from the Web).
When the content is changed using any of these functions, any
previous content is cleared.