diff options
author | Joaquim Rocha <jrocha@igalia.com> | 2010-12-15 11:31:51 +0100 |
---|---|---|
committer | Stanislav Ionascu <stanislav.ionascu@nokia.com> | 2011-01-03 12:35:10 +0200 |
commit | ef288a62ffeb09f5065cdc8de56e6cbb870e45fb (patch) | |
tree | e4a90f8e8d9acc2e9c098c43186f979b20bbfd16 | |
parent | 14d64a964e6e330fe9b61e4c9e92c5f6adbbde89 (diff) |
Fixes: NB#209318 - MLabelView calls updateGeometry() when the text changes.
RevBy: Stanislav Ionascu
Details:
These changes keep track of the previous static text's size of the label
and compare it with the new size when text is set, updating the label's
geometry only when they differ.
-rw-r--r-- | src/views/mlabelview_p.h | 2 | ||||
-rw-r--r-- | src/views/mlabelview_simple.cpp | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/views/mlabelview_p.h b/src/views/mlabelview_p.h index 9e6fb4d7..96bff53b 100644 --- a/src/views/mlabelview_p.h +++ b/src/views/mlabelview_p.h @@ -229,6 +229,8 @@ public: MLabelViewSimple *impl; QTextOption textOptions; + + QSizeF previousStaticTextSize; }; #endif diff --git a/src/views/mlabelview_simple.cpp b/src/views/mlabelview_simple.cpp index fc73c80a..7a8c26ba 100644 --- a/src/views/mlabelview_simple.cpp +++ b/src/views/mlabelview_simple.cpp @@ -148,6 +148,7 @@ void MLabelViewSimple::setupModel() } else { viewPrivate->textOptions.setWrapMode(QTextOption::NoWrap); } + viewPrivate->previousStaticTextSize = staticText.size(); } bool MLabelViewSimple::updateData(const QList<const char *>& modifications) @@ -160,7 +161,8 @@ bool MLabelViewSimple::updateData(const QList<const char *>& modifications) foreach(member, modifications) { if (member == MLabelModel::Text) { preferredSize = QSizeF(-1, -1); - needUpdate = true; + needUpdate = viewPrivate->previousStaticTextSize != staticText.size(); + viewPrivate->previousStaticTextSize = staticText.size(); } else if (member == MLabelModel::Color) { needUpdate = true; } else if(member == MLabelModel::WrapMode) { |