summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativetextedit.cpp
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-08-03 10:53:57 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-08-03 10:53:57 (GMT)
commitd5491ecdde14659a913c9f476f18c45f1d9489bb (patch)
tree06cc52249feda9bd9e50ca47abb8ebd676c8a309 /src/declarative/graphicsitems/qdeclarativetextedit.cpp
parent42cdfaf86d34afeb6448723839fef70fe477deed (diff)
parenta41128af5373a0225c3548abd3eb82cd7e8f7a0e (diff)
downloadQt-d5491ecdde14659a913c9f476f18c45f1d9489bb.zip
Qt-d5491ecdde14659a913c9f476f18c45f1d9489bb.tar.gz
Qt-d5491ecdde14659a913c9f476f18c45f1d9489bb.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt into lighthouse
Conflicts: configure
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativetextedit.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp55
1 files changed, 28 insertions, 27 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index f3eef23..8117676 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -202,8 +202,9 @@ QString QDeclarativeTextEdit::text() const
Sets the font size in pixels.
- Using this function makes the font device dependent.
- Use \l font.pointSize to set the size of the font in a device independent manner.
+ Using this function makes the font device dependent. Use
+ \l{TextEdit::font.pointSize} to set the size of the font in a
+ device independent manner.
*/
/*!
@@ -212,8 +213,7 @@ QString QDeclarativeTextEdit::text() const
Sets the letter spacing for the font.
Letter spacing changes the default spacing between individual letters in the font.
- A value of 100 will keep the spacing unchanged; a value of 200 will enlarge the spacing after a character by
- the width of the character itself.
+ A positive value increases the letter spacing by the corresponding pixels; a negative value decreases the spacing.
*/
/*!
@@ -256,7 +256,6 @@ void QDeclarativeTextEdit::setText(const QString &text)
Q_D(QDeclarativeTextEdit);
if (QDeclarativeTextEdit::text() == text)
return;
- d->text = text;
d->richText = d->format == RichText || (d->format == AutoText && Qt::mightBeRichText(text));
if (d->richText) {
#ifndef QT_NO_TEXTHTMLPARSER
@@ -624,7 +623,7 @@ void QDeclarativeTextEdit::moveCursorSelection(int pos)
\qmlproperty bool TextEdit::cursorVisible
If true the text edit shows a cursor.
- This property is set and unset when the text edit gets focus, but it can also
+ This property is set and unset when the text edit gets active focus, but it can also
be set directly (useful, for example, if a KeyProxy might forward keys to it).
*/
bool QDeclarativeTextEdit::isCursorVisible() const
@@ -783,9 +782,9 @@ QString QDeclarativeTextEdit::selectedText() const
}
/*!
- \qmlproperty bool TextEdit::focusOnPress
+ \qmlproperty bool TextEdit::activeFocusOnPress
- Whether the TextEdit should gain focus on a mouse press. By default this is
+ Whether the TextEdit should gain active focus on a mouse press. By default this is
set to true.
*/
bool QDeclarativeTextEdit::focusOnPress() const
@@ -800,13 +799,13 @@ void QDeclarativeTextEdit::setFocusOnPress(bool on)
if (d->focusOnPress == on)
return;
d->focusOnPress = on;
- emit focusOnPressChanged(d->focusOnPress);
+ emit activeFocusOnPressChanged(d->focusOnPress);
}
/*!
\qmlproperty bool TextEdit::persistentSelection
- Whether the TextEdit should keep the selection visible when it loses focus to another
+ Whether the TextEdit should keep the selection visible when it loses active focus to another
item in the scene. By default this is set to true;
*/
bool QDeclarativeTextEdit::persistentSelection() const
@@ -1106,15 +1105,15 @@ void QDeclarativeTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QDeclarativeTextEdit);
if (d->focusOnPress){
- bool hadFocus = hasFocus();
- forceFocus();
+ bool hadActiveFocus = hasActiveFocus();
+ forceActiveFocus();
if (d->showInputPanelOnFocus) {
- if (hasFocus() && hadFocus && !isReadOnly()) {
+ if (hasActiveFocus() && hadActiveFocus && !isReadOnly()) {
// re-open input panel on press if already focused
openSoftwareInputPanel();
}
} else { // show input panel on click
- if (hasFocus() && !hadFocus) {
+ if (hasActiveFocus() && !hadActiveFocus) {
d->clickCausedFocus = true;
}
}
@@ -1291,9 +1290,11 @@ void QDeclarativeTextEditPrivate::init()
void QDeclarativeTextEdit::q_textChanged()
{
+ Q_D(QDeclarativeTextEdit);
+ d->text = text();
updateSize();
updateMicroFocus();
- emit textChanged(text());
+ emit textChanged(d->text);
}
void QDeclarativeTextEdit::moveCursorDelegate()
@@ -1427,10 +1428,10 @@ void QDeclarativeTextEditPrivate::updateDefaultTextOption()
By default the opening of input panels follows the platform style. On Symbian^1 and
Symbian^3 -based devices the panels are opened by clicking TextEdit. On other platforms
- the panels are automatically opened when TextEdit element gains focus. Input panels are
- always closed if no editor owns focus.
+ the panels are automatically opened when TextEdit element gains active focus. Input panels are
+ always closed if no editor has active focus.
- You can disable the automatic behavior by setting the property \c focusOnPress to false
+ You can disable the automatic behavior by setting the property \c activeFocusOnPress to false
and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
the behavior you want.
@@ -1441,12 +1442,12 @@ void QDeclarativeTextEditPrivate::updateDefaultTextOption()
TextEdit {
id: textEdit
text: "Hello world!"
- focusOnPress: false
+ activeFocusOnPress: false
MouseArea {
anchors.fill: parent
onClicked: {
- if (!textEdit.focus) {
- textEdit.focus = true;
+ if (!textEdit.activeFocus) {
+ textEdit.forceActiveFocus();
textEdit.openSoftwareInputPanel();
} else {
textEdit.focus = false;
@@ -1478,10 +1479,10 @@ void QDeclarativeTextEdit::openSoftwareInputPanel()
By default the opening of input panels follows the platform style. On Symbian^1 and
Symbian^3 -based devices the panels are opened by clicking TextEdit. On other platforms
- the panels are automatically opened when TextEdit element gains focus. Input panels are
- always closed if no editor owns focus.
+ the panels are automatically opened when TextEdit element gains active focus. Input panels are
+ always closed if no editor has active focus.
- You can disable the automatic behavior by setting the property \c focusOnPress to false
+ You can disable the automatic behavior by setting the property \c activeFocusOnPress to false
and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
the behavior you want.
@@ -1492,12 +1493,12 @@ void QDeclarativeTextEdit::openSoftwareInputPanel()
TextEdit {
id: textEdit
text: "Hello world!"
- focusOnPress: false
+ activeFocusOnPress: false
MouseArea {
anchors.fill: parent
onClicked: {
- if (!textEdit.focus) {
- textEdit.focus = true;
+ if (!textEdit.activeFocus) {
+ textEdit.forceActiveFocus();
textEdit.openSoftwareInputPanel();
} else {
textEdit.focus = false;