diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2011-09-28 16:56:36 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-29 08:31:26 +0200 |
commit | 65f07f3b95408b0a85590571118dd59a4171a9a2 (patch) | |
tree | 63cd985c7ce0eb63078f9daaa32493eeb02225ec /src | |
parent | 8120e8c2d9bc73adc29a85b8d8962ad556b74722 (diff) |
Fix TextInput and TextEdit openInputPanel autotests
Task-number: QTBUG-21691
The change also removes showInputPanelOnClick code from the TextInput and
TextEdit, which was done to support Symbian^1 and ^3 fullscreen keyboards.
Now by default the keyboard always follows editor focus.
Change-Id: Id60a17fe51b3aa49ba9ea81b985e608e91c26145
Reviewed-on: http://codereview.qt-project.org/5733
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/items/qsgcanvas.cpp | 5 | ||||
-rw-r--r-- | src/declarative/items/qsgtextedit.cpp | 30 | ||||
-rw-r--r-- | src/declarative/items/qsgtextedit_p_p.h | 10 | ||||
-rw-r--r-- | src/declarative/items/qsgtextinput.cpp | 30 | ||||
-rw-r--r-- | src/declarative/items/qsgtextinput_p_p.h | 9 |
5 files changed, 15 insertions, 69 deletions
diff --git a/src/declarative/items/qsgcanvas.cpp b/src/declarative/items/qsgcanvas.cpp index 8e5d1ec999..cdef37ffa3 100644 --- a/src/declarative/items/qsgcanvas.cpp +++ b/src/declarative/items/qsgcanvas.cpp @@ -722,7 +722,10 @@ void QSGCanvasPrivate::notifyFocusChangesRecur(QSGItem **items, int remaining) void QSGCanvasPrivate::updateInputMethodData() { - qApp->inputPanel()->setInputItem(activeFocusItem); + QSGItem *inputItem = 0; + if (activeFocusItem && activeFocusItem->flags() & QSGItem::ItemAcceptsInputMethod) + inputItem = activeFocusItem; + qApp->inputPanel()->setInputItem(inputItem); } QVariant QSGCanvas::inputMethodQuery(Qt::InputMethodQuery query) const diff --git a/src/declarative/items/qsgtextedit.cpp b/src/declarative/items/qsgtextedit.cpp index 5c33a6269f..5cb061b0b3 100644 --- a/src/declarative/items/qsgtextedit.cpp +++ b/src/declarative/items/qsgtextedit.cpp @@ -1332,16 +1332,9 @@ void QSGTextEdit::mousePressEvent(QMouseEvent *event) if (d->focusOnPress){ bool hadActiveFocus = hasActiveFocus(); forceActiveFocus(); - if (d->showInputPanelOnFocus) { - if (hasActiveFocus() && hadActiveFocus && !isReadOnly()) { - // re-open input panel on press if already focused - openSoftwareInputPanel(); - } - } else { // show input panel on click - if (hasActiveFocus() && !hadActiveFocus) { - d->clickCausedFocus = true; - } - } + // re-open input panel on press if already focused + if (hasActiveFocus() && hadActiveFocus && !isReadOnly()) + openSoftwareInputPanel(); } d->control->processEvent(event, QPointF(0, -d->yoff)); if (!event->isAccepted()) @@ -1356,16 +1349,6 @@ void QSGTextEdit::mouseReleaseEvent(QMouseEvent *event) { Q_D(QSGTextEdit); d->control->processEvent(event, QPointF(0, -d->yoff)); - if (!d->showInputPanelOnFocus) { // input panel on click - if (d->focusOnPress && !isReadOnly() && boundingRect().contains(event->localPos())) { - // ### refactor: port properly - qDebug("QSGTextEdit: virtual keyboard handling not implemented"); -// if (canvas() && canvas() == qApp->focusWidget()) { -// qt_widget_private(canvas())->handleSoftwareInputPanel(event->button(), d->clickCausedFocus); -// } - } - } - d->clickCausedFocus = false; if (!event->isAccepted()) QSGImplicitSizeItem::mouseReleaseEvent(event); @@ -1972,11 +1955,8 @@ void QSGTextEdit::closeSoftwareInputPanel() void QSGTextEdit::focusInEvent(QFocusEvent *event) { Q_D(const QSGTextEdit); - if (d->showInputPanelOnFocus) { - if (d->focusOnPress && !isReadOnly()) { - openSoftwareInputPanel(); - } - } + if (d->focusOnPress && !isReadOnly()) + openSoftwareInputPanel(); QSGImplicitSizeItem::focusInEvent(event); } diff --git a/src/declarative/items/qsgtextedit_p_p.h b/src/declarative/items/qsgtextedit_p_p.h index 326e0a342a..7561977fdf 100644 --- a/src/declarative/items/qsgtextedit_p_p.h +++ b/src/declarative/items/qsgtextedit_p_p.h @@ -72,19 +72,13 @@ public: QSGTextEditPrivate() : color("black"), hAlign(QSGTextEdit::AlignLeft), vAlign(QSGTextEdit::AlignTop), documentDirty(true), dirty(false), richText(false), cursorVisible(false), focusOnPress(true), - showInputPanelOnFocus(true), clickCausedFocus(false), persistentSelection(true), - requireImplicitWidth(false), selectByMouse(false), canPaste(false), + persistentSelection(true), requireImplicitWidth(false), selectByMouse(false), canPaste(false), hAlignImplicit(true), rightToLeftText(false), isComplexRichText(false), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), cursorComponent(0), cursor(0), format(QSGTextEdit::AutoText), document(0), wrapMode(QSGTextEdit::NoWrap), mouseSelectionMode(QSGTextEdit::SelectCharacters), lineCount(0), yoff(0), nodeType(NodeIsNull), texture(0) { -#ifdef Q_OS_SYMBIAN - if (QSysInfo::symbianVersion() == QSysInfo::SV_SF_1 || QSysInfo::symbianVersion() == QSysInfo::SV_SF_3) { - showInputPanelOnFocus = false; - } -#endif } void init(); @@ -113,8 +107,6 @@ public: bool richText : 1; bool cursorVisible : 1; bool focusOnPress : 1; - bool showInputPanelOnFocus : 1; - bool clickCausedFocus : 1; bool persistentSelection : 1; bool requireImplicitWidth:1; bool selectByMouse:1; diff --git a/src/declarative/items/qsgtextinput.cpp b/src/declarative/items/qsgtextinput.cpp index cfb1c6fc8b..71c414fe02 100644 --- a/src/declarative/items/qsgtextinput.cpp +++ b/src/declarative/items/qsgtextinput.cpp @@ -1105,16 +1105,9 @@ void QSGTextInput::mousePressEvent(QMouseEvent *event) if(d->focusOnPress){ bool hadActiveFocus = hasActiveFocus(); forceActiveFocus(); - if (d->showInputPanelOnFocus) { - if (hasActiveFocus() && hadActiveFocus && !isReadOnly()) { - // re-open input panel on press if already focused - openSoftwareInputPanel(); - } - } else { // show input panel on click - if (hasActiveFocus() && !hadActiveFocus) { - d->clickCausedFocus = true; - } - } + // re-open input panel on press if already focused + if (hasActiveFocus() && hadActiveFocus && !isReadOnly()) + openSoftwareInputPanel(); } if (d->selectByMouse) { setKeepMouseGrab(false); @@ -1158,16 +1151,6 @@ void QSGTextInput::mouseReleaseEvent(QMouseEvent *event) d->selectPressed = false; setKeepMouseGrab(false); } - if (!d->showInputPanelOnFocus) { // input panel on click - if (d->focusOnPress && !isReadOnly() && boundingRect().contains(event->localPos())) { - if (canvas() && canvas() == QGuiApplication::activeWindow()) { - // ### refactor: implement virtual keyboard properly.. - qDebug("QSGTextInput: virtual keyboard no implemented..."); -// qt_widget_private(canvas())->handleSoftwareInputPanel(event->button(), d->clickCausedFocus); - } - } - } - d->clickCausedFocus = false; d->control->processEvent(event); if (!event->isAccepted()) QSGImplicitSizeItem::mouseReleaseEvent(event); @@ -1797,11 +1780,8 @@ void QSGTextInput::closeSoftwareInputPanel() void QSGTextInput::focusInEvent(QFocusEvent *event) { Q_D(const QSGTextInput); - if (d->showInputPanelOnFocus) { - if (d->focusOnPress && !isReadOnly()) { - openSoftwareInputPanel(); - } - } + if (d->focusOnPress && !isReadOnly()) + openSoftwareInputPanel(); QSGImplicitSizeItem::focusInEvent(event); } diff --git a/src/declarative/items/qsgtextinput_p_p.h b/src/declarative/items/qsgtextinput_p_p.h index 7022dd734e..ed2395bb0e 100644 --- a/src/declarative/items/qsgtextinput_p_p.h +++ b/src/declarative/items/qsgtextinput_p_p.h @@ -88,8 +88,6 @@ public: , oldValidity(false) , focused(false) , focusOnPress(true) - , showInputPanelOnFocus(true) - , clickCausedFocus(false) , cursorVisible(false) , autoScroll(true) , selectByMouse(false) @@ -98,11 +96,6 @@ public: , selectPressed(false) , textLayoutDirty(true) { -#ifdef Q_OS_SYMBIAN - if (QSysInfo::symbianVersion() == QSysInfo::SV_SF_1 || QSysInfo::symbianVersion() == QSysInfo::SV_SF_3) { - showInputPanelOnFocus = false; - } -#endif } ~QSGTextInputPrivate() @@ -158,8 +151,6 @@ public: bool oldValidity:1; bool focused:1; bool focusOnPress:1; - bool showInputPanelOnFocus:1; - bool clickCausedFocus:1; bool cursorVisible:1; bool autoScroll:1; bool selectByMouse:1; |