aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextinput.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/qquicktextinput.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/qquicktextinput.cpp')
-rw-r--r--src/quick/items/qquicktextinput.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index f2cf89c1b9..c63e1c87e6 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -1861,7 +1861,7 @@ QSGNode *QQuickTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
d->textNode = node;
if (!d->textLayoutDirty && oldNode != 0) {
- QSGSimpleRectNode *cursorNode = node->cursorNode();
+ QSGRectangleNode *cursorNode = node->cursorNode();
if (cursorNode != 0 && !isReadOnly()) {
cursorNode->setRect(cursorRectangle());
@@ -2706,14 +2706,20 @@ void QQuickTextInput::selectionChanged()
void QQuickTextInputPrivate::showCursor()
{
- if (textNode != 0 && textNode->cursorNode() != 0)
- textNode->cursorNode()->setColor(color);
+ if (textNode != 0 && textNode->cursorNode() != 0) {
+ QSGRectangleNode *cursor = textNode->cursorNode();
+ cursor->setColor(color);
+ cursor->update();
+ }
}
void QQuickTextInputPrivate::hideCursor()
{
- if (textNode != 0 && textNode->cursorNode() != 0)
- textNode->cursorNode()->setColor(QColor(0, 0, 0, 0));
+ if (textNode != 0 && textNode->cursorNode() != 0) {
+ QSGRectangleNode *cursor = textNode->cursorNode();
+ cursor->setColor(QColor(0, 0, 0, 0));
+ cursor->update();
+ }
}
QRectF QQuickTextInput::boundingRect() const