diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2012-05-15 20:02:53 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-16 19:38:01 +0200 |
commit | 279562172d2e998e910d82599255cb04b54df823 (patch) | |
tree | 39d459e9e6f97a80a156b1efbfb9956dfac1b137 /src | |
parent | 6eae3e1da3ebaf8023f85c62f2fdd177fa39e208 (diff) |
enable the text layout's cache where it is seems to be missed
e.g. in QStaticText, the data is used just to get the line's y-position
and re-calculates just after the loop to determine the bounding rect and to draw the text;
in QWidgetLineControl, the data re-calculated over and over while the result
is seems to remain the same; probably the caching is needed here too
Change-Id: I0f7eb291532f63eccb9c5f749daebb73ff90632f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp | 1 | ||||
-rw-r--r-- | src/gui/text/qstatictext.cpp | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgetlinecontrol.cpp | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp b/src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp index c8e1d2e010..cb82f3f9a6 100644 --- a/src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp +++ b/src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp @@ -41,6 +41,7 @@ //! [0] int leading = fontMetrics.leading(); qreal height = 0; +textLayout.setCacheEnabled(true); textLayout.beginLayout(); while (1) { QTextLine line = textLayout.createLine(); diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 5bee2a9915..faee6d2b76 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -610,6 +610,7 @@ void QStaticTextPrivate::paintText(const QPointF &topLeftPosition, QPainter *p) textLayout.setText(text); textLayout.setFont(font); textLayout.setTextOption(textOption); + textLayout.setCacheEnabled(true); qreal leading = QFontMetricsF(font).leading(); qreal height = -leading; diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 6347593efe..6920354e73 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -351,6 +351,7 @@ void QWidgetLineControl::_q_deleteSelected() */ void QWidgetLineControl::init(const QString &txt) { + m_textLayout.setCacheEnabled(true); m_text = txt; updateDisplayText(); m_cursor = m_text.length(); |