summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx/qfxtextedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/fx/qfxtextedit.cpp')
-rw-r--r--src/declarative/fx/qfxtextedit.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp
index b2da051..f59e0ae 100644
--- a/src/declarative/fx/qfxtextedit.cpp
+++ b/src/declarative/fx/qfxtextedit.cpp
@@ -427,6 +427,8 @@ void QFxTextEdit::setCursorVisible(bool on)
return;
d->cursorVisible = on;
QFocusEvent focusEvent(on ? QEvent::FocusIn : QEvent::FocusOut);
+ if (!on && !d->preserveSelection)
+ d->control->setCursorIsFocusIndicator(true);
d->control->processEvent(&focusEvent, QPointF(0, 0));
}
@@ -450,6 +452,26 @@ void QFxTextEdit::setFocusOnPress(bool on)
d->focusOnPress = on;
}
+/*!
+ \qmlproperty bool TextEdit::preserveSelection
+
+ Whether the TextEdit should keep the selection visible when it loses focus to another
+ item in the scene. By default this is set to true;
+*/
+bool QFxTextEdit::preserveSelection() const
+{
+ Q_D(const QFxTextEdit);
+ return d->preserveSelection;
+}
+
+void QFxTextEdit::setPreserveSelection(bool on)
+{
+ Q_D(QFxTextEdit);
+ if (d->preserveSelection == on)
+ return;
+ d->preserveSelection = on;
+}
+
void QFxTextEdit::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{