aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextnode.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/qquicktextnode.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/qquicktextnode.cpp')
-rw-r--r--src/quick/items/qquicktextnode.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp
index 02e321dfba..480e141e30 100644
--- a/src/quick/items/qquicktextnode.cpp
+++ b/src/quick/items/qquicktextnode.cpp
@@ -43,7 +43,6 @@
#include "qquicktextnodeengine_p.h"
-#include <QtQuick/qsgsimplerectnode.h>
#include <private/qsgadaptationlayer_p.h>
#include <private/qsgdistancefieldglyphnode_p.h>
#include <private/qquickclipnode_p.h>
@@ -183,7 +182,8 @@ void QQuickTextNode::setCursor(const QRectF &rect, const QColor &color)
if (m_cursorNode != 0)
delete m_cursorNode;
- m_cursorNode = new QSGSimpleRectNode(rect, color);
+ QSGRenderContext *sg = QQuickItemPrivate::get(m_ownerElement)->sceneGraphRenderContext();
+ m_cursorNode = sg->sceneGraphContext()->createRectangleNode(rect, color);
appendChildNode(m_cursorNode);
}
@@ -198,6 +198,13 @@ void QQuickTextNode::initEngine(const QColor& textColor, const QColor& selectedT
m_engine->setPosition(position);
}
+void QQuickTextNode::addRectangleNode(const QRectF &rect, const QColor &color)
+{
+ QSGRenderContext *sg = QQuickItemPrivate::get(m_ownerElement)->sceneGraphRenderContext();
+ appendChildNode(sg->sceneGraphContext()->createRectangleNode(rect, color));
+}
+
+
void QQuickTextNode::addImage(const QRectF &rect, const QImage &image)
{
QSGRenderContext *sg = QQuickItemPrivate::get(m_ownerElement)->sceneGraphRenderContext();