summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-05-21 01:51:55 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-05-21 01:51:55 (GMT)
commiteb29ed226a426126aff5f4deea2f864fb6466c65 (patch)
tree41efce3cbe5b1232edeebb283a616b70cfed7667 /src
parent69b6c7f5bb5ca2cd2ddc625d49d5b39075dc833b (diff)
parent942ea5202d4a329376c27015b07406c2018437ff (diff)
downloadQt-eb29ed226a426126aff5f4deea2f864fb6466c65.zip
Qt-eb29ed226a426126aff5f4deea2f864fb6466c65.tar.gz
Qt-eb29ed226a426126aff5f4deea2f864fb6466c65.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src')
-rw-r--r--src/declarative/fx/qfxtextedit.cpp22
-rw-r--r--src/declarative/fx/qfxtextedit.h4
-rw-r--r--src/declarative/fx/qfxtextedit_p.h3
3 files changed, 28 insertions, 1 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)
{
diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h
index d195a80..1456cd8 100644
--- a/src/declarative/fx/qfxtextedit.h
+++ b/src/declarative/fx/qfxtextedit.h
@@ -78,6 +78,7 @@ class Q_DECLARATIVE_EXPORT QFxTextEdit : public QFxPaintedItem
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible)
Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress)
+ Q_PROPERTY(bool preserveSelection READ preserveSelection WRITE setPreserveSelection)
Q_CLASSINFO("DefaultProperty", "text")
public:
@@ -131,6 +132,9 @@ public:
bool focusOnPress() const;
void setFocusOnPress(bool on);
+ bool preserveSelection() const;
+ void setPreserveSelection(bool on);
+
virtual void dump(int depth);
virtual QString propertyInfo() const;
diff --git a/src/declarative/fx/qfxtextedit_p.h b/src/declarative/fx/qfxtextedit_p.h
index a9b7237..78b0018 100644
--- a/src/declarative/fx/qfxtextedit_p.h
+++ b/src/declarative/fx/qfxtextedit_p.h
@@ -69,7 +69,7 @@ class QFxTextEditPrivate : public QFxPaintedItemPrivate
public:
QFxTextEditPrivate()
: font(0), color("black"), imgDirty(true), hAlign(QFxTextEdit::AlignLeft), vAlign(QFxTextEdit::AlignTop),
- dirty(false), wrap(false), richText(false), cursorVisible(false), focusOnPress(false),
+ dirty(false), wrap(false), richText(false), cursorVisible(false), focusOnPress(false), preserveSelection(true),
format(QFxTextEdit::AutoText), document(0)
{
}
@@ -98,6 +98,7 @@ public:
bool richText;
bool cursorVisible;
bool focusOnPress;
+ bool preserveSelection;
QFxTextEdit::TextFormat format;
QTextDocument *document;
QTextControl *control;