aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextnodeengine.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-08-08 20:29:19 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-08-13 15:03:51 +0200
commitfb339b21b8a24b835cea7a057c47b7c5ad80dd72 (patch)
tree5ad9ff6bb107073acc7ae16bfaf7801fd10f7714 /src/quick/items/qquicktextnodeengine.cpp
parent2b3de73defd4fca0888b5c2824c73d4fc26d6f7c (diff)
Create rectangle nodes in the text editing through the context
Unfortunately we can't re-use the QSGSimpleRectNode, as it doesn't provide us with virtual methods to move it's creation into the context. But's since it's only 20 lines of code anyway, this is still a nice cleanup. And it also allows the re-use of any optimizations in the renderer for QSGRectangleNode. Change-Id: I957777fbbeb0a994a9c257baf3bfe87fce8cc9e8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/quick/items/qquicktextnodeengine.cpp')
-rw-r--r--src/quick/items/qquicktextnodeengine.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp
index e9ff70e00b..d0754d511c 100644
--- a/src/quick/items/qquicktextnodeengine.cpp
+++ b/src/quick/items/qquicktextnodeengine.cpp
@@ -49,7 +49,6 @@
#include <QtGui/qtextobject.h>
#include <QtGui/qtexttable.h>
#include <QtGui/qtextlist.h>
-#include <QtQuick/qsgsimplerectnode.h>
#include <private/qquicktext_p_p.h>
#include <private/qtextdocumentlayout_p.h>
@@ -647,14 +646,14 @@ void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode,
const QRectF &rect = m_backgrounds.at(i).first;
const QColor &color = m_backgrounds.at(i).second;
- parentNode->appendChildNode(new QSGSimpleRectNode(rect, color));
+ parentNode->addRectangleNode(rect, color);
}
// First, prepend all selection rectangles to the tree
for (int i=0; i<m_selectionRects.size(); ++i) {
const QRectF &rect = m_selectionRects.at(i);
- parentNode->appendChildNode(new QSGSimpleRectNode(rect, m_selectionColor));
+ parentNode->addRectangleNode(rect, m_selectionColor);
}
// Finally, add decorations for each node to the tree.
@@ -665,7 +664,7 @@ void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode,
? m_selectedTextColor
: textDecoration.color;
- parentNode->appendChildNode(new QSGSimpleRectNode(textDecoration.rect, color));
+ parentNode->addRectangleNode(textDecoration.rect, color);
}
// Then, go through all the nodes for all lines and combine all QGlyphRuns with a common
@@ -714,7 +713,7 @@ void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode,
if (node->selectionState == Selected) {
QColor color = m_selectionColor;
color.setAlpha(128);
- parentNode->appendChildNode(new QSGSimpleRectNode(node->boundingRect, color));
+ parentNode->addRectangleNode(node->boundingRect, color);
}
}
}