aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgcontext.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/scenegraph/qsgcontext.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/scenegraph/qsgcontext.cpp')
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index 4ea0cca553..f69dd7adde 100644
--- a/src/quick/scenegraph/qsgcontext.cpp
+++ b/src/quick/scenegraph/qsgcontext.cpp
@@ -261,6 +261,19 @@ void QSGContext::renderContextInvalidated(QSGRenderContext *)
{
}
+
+/*!
+ Convenience factory function for creating a colored rectangle with the given geometry.
+ */
+QSGRectangleNode *QSGContext::createRectangleNode(const QRectF &rect, const QColor &c)
+{
+ QSGRectangleNode *node = createRectangleNode();
+ node->setRect(rect);
+ node->setColor(c);
+ node->update();
+ return node;
+}
+
/*!
Factory function for scene graph backends of the Rectangle element.
*/