summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qlabel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/qlabel.cpp')
-rw-r--r--src/gui/widgets/qlabel.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp
index f2a6965..ab88f38 100644
--- a/src/gui/widgets/qlabel.cpp
+++ b/src/gui/widgets/qlabel.cpp
@@ -55,6 +55,10 @@
#include "private/qstylesheetstyle_p.h"
#include <qmath.h>
+#ifndef QT_NO_ACCESSIBILITY
+#include <qaccessible.h>
+#endif
+
QT_BEGIN_NAMESPACE
/*!
@@ -88,6 +92,13 @@ QT_BEGIN_NAMESPACE
by clear().
\endtable
+ \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.
@@ -370,6 +381,11 @@ void QLabel::setText(const QString &text)
#endif
d->updateLabel();
+
+#ifndef QT_NO_ACCESSIBILITY
+ if (accessibleName().isEmpty())
+ QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+#endif
}
QString QLabel::text() const
@@ -1072,7 +1088,7 @@ void QLabel::paintEvent(QPaintEvent *)
else
#endif
if (d->isTextLabel) {
- QRectF lr = d->layoutRect();
+ QRectF lr = d->layoutRect().toAlignedRect();
QStyleOption opt;
opt.initFrom(this);
#ifndef QT_NO_STYLE_STYLESHEET