diff options
author | Pierre Rossi <pierre.rossi@digia.com> | 2013-03-18 16:25:59 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-20 08:31:56 +0100 |
commit | f513e88403b66c4a5efe4c62c160dfce151efb33 (patch) | |
tree | f091c015be4781a9d65bb702c4263cd09cd6adb0 /src/quick/items/qquicktextnode_p.h | |
parent | 471645f6dba6a21b85cb6788f0a0a07b6d5a804a (diff) |
Optimize QQuickTextEdit for larger documents.
The rationale is to not end up re-processing the whole document on each update
Since we know where the editing takes place, we can break down the text edit's
contents in several text nodes and only re-create the affected text nodes upon
editing.
This requires ripping out the SelectionEngine helper class from QQuickTextNode
so that QQuickTextEdit can tap into its functionality directly.
A positive side-effect of this exercise is that it should be much harder to
to come across GlyphNodes packing more than 16300 glyphs or so.
Task-number: QTBUG-29596
Change-Id: Id29b0709baa43f5b29c44ab02398ba996be3e28a
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/quick/items/qquicktextnode_p.h')
-rw-r--r-- | src/quick/items/qquicktextnode_p.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/quick/items/qquicktextnode_p.h b/src/quick/items/qquicktextnode_p.h index dcc4ebe22f..16da3ce685 100644 --- a/src/quick/items/qquicktextnode_p.h +++ b/src/quick/items/qquicktextnode_p.h @@ -49,6 +49,7 @@ #include <QtGui/qcolor.h> #include <QtGui/qtextlayout.h> #include <QtCore/qvarlengtharray.h> +#include <QtCore/qscopedpointer.h> QT_BEGIN_NAMESPACE @@ -62,6 +63,8 @@ class QSGSimpleRectNode; class QSGClipNode; class QSGTexture; +class QQuickTextNodeEngine; + class QQuickTextNode : public QSGTransformNode { public: @@ -104,13 +107,17 @@ public: void setUseNativeRenderer(bool on) { m_useNativeRenderer = on; } private: - void mergeFormats(QTextLayout *textLayout, QVarLengthArray<QTextLayout::FormatRange> *mergedFormats); + void initEngine(const QColor &textColor, const QColor &selectedTextColor, const QColor &selectionColor, const QColor& anchorColor = QColor()); + QSGContext *m_context; QSGSimpleRectNode *m_cursorNode; QList<QSGTexture *> m_textures; QQuickItem *m_ownerElement; bool m_useNativeRenderer; + QScopedPointer<QQuickTextNodeEngine> m_engine; + + friend class QQuickTextEdit; }; QT_END_NAMESPACE |