diff options
author | Water-Team <water@pad.test.qt.nokia.com> | 2011-06-29 21:42:03 (GMT) |
---|---|---|
committer | Water-Team <water@pad.test.qt.nokia.com> | 2011-06-29 21:42:03 (GMT) |
commit | 0a8daa8845325fba9cf2ec973eb6bab8a2853dd5 (patch) | |
tree | 504c698037ee6283f1b5dbc6fa658bb2bfffb99a /src/gui/inputmethod/qcoefepinputcontext_s60.cpp | |
parent | 680023c4921019614948c277cde5498645836cb9 (diff) | |
parent | 6b3f2a3b96d01dc339d07a076300d29616603b28 (diff) | |
download | Qt-0a8daa8845325fba9cf2ec973eb6bab8a2853dd5.zip Qt-0a8daa8845325fba9cf2ec973eb6bab8a2853dd5.tar.gz Qt-0a8daa8845325fba9cf2ec973eb6bab8a2853dd5.tar.bz2 |
Merge branch '4.8-upstream' into master-water
Diffstat (limited to 'src/gui/inputmethod/qcoefepinputcontext_s60.cpp')
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 57 |
1 files changed, 38 insertions, 19 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index ebf0ff8..f8d7e28 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -366,7 +366,8 @@ bool QCoeFepInputContext::symbianFilterEvent(QWidget *keyWidget, const QSymbianE } if (event->type() == QSymbianEvent::ResourceChangeEvent - && event->resourceChangeType() == KEikMessageFadeAllWindows) { + && (event->resourceChangeType() == KEikMessageFadeAllWindows + || event->resourceChangeType() == KEikDynamicLayoutVariantSwitch)) { reset(); } @@ -467,7 +468,10 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget) } } else { if (m_splitViewResizeBy) - gv->resize(gv->rect().width(), m_splitViewResizeBy); + if (m_splitViewPreviousWindowStates & Qt::WindowFullScreen) + gv->resize(gv->rect().width(), qApp->desktop()->height()); + else + gv->resize(gv->rect().width(), m_splitViewResizeBy); } // Resizing might have led to widget losing its original windowstate. // Restore previous window state. @@ -646,6 +650,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) { using namespace Qt; + reset(); commitTemporaryPreeditString(); const bool anynumbermodes = hints & (ImhDigitsOnly | ImhFormattedNumbersOnly | ImhDialableCharactersOnly); @@ -698,11 +703,6 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) } else if (anynumbermodes) { flags |= EAknEditorNumericInputMode; - if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 - && ((hints & ImhFormattedNumbersOnly) || (hints & ImhDialableCharactersOnly))) { - //workaround - the * key does not launch the symbols menu, making it impossible to use these modes unless text mode is enabled. - flags |= EAknEditorTextInputMode; - } } else if (anytextmodes) { flags |= EAknEditorTextInputMode; @@ -783,8 +783,6 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_EMAIL_ADDR_SPECIAL_CHARACTER_TABLE_DIALOG); } else if (needsCharMap) { m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG); - } else if ((hints & ImhFormattedNumbersOnly) || (hints & ImhDialableCharactersOnly)) { - m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG); } else { m_fepState->SetSpecialCharacterTableResourceId(0); } @@ -895,19 +893,40 @@ void QCoeFepInputContext::translateInputWidget() m_transformation = (rootItem->transform().isTranslating()) ? QRectF(0,0, gv->width(), rootItem->transform().dy()) : QRectF(); - // Do nothing if the cursor is visible in the splitview area. - if (splitViewRect.contains(cursorP.boundingRect())) + // Adjust cursor bounding rect to be lower, so that view translates if the cursor gets near + // the splitview border. + QRect cursorRect = cursorP.boundingRect().adjusted(0, cursor.height(), 0, cursor.height()); + if (splitViewRect.contains(cursorRect)) return; - // New Y position should be ideally at the center of the splitview area. - // If that would expose unpainted canvas, limit the tranformation to the visible scene bottom. - - const qreal maxY = gv->sceneRect().bottom() - splitViewRect.bottom() + m_transformation.height(); - qreal dy = -(qMin(maxY, (cursor.bottom() - vkbRect.top() / 2))); - - // Do not allow transform above screen top. - if (m_transformation.height() + dy > 0) + // New Y position should be ideally just above the keyboard. + // If that would expose unpainted canvas, limit the tranformation to the visible scene rect or + // to the focus item's shape/clip path. + + const QPainterPath path = gv->scene()->focusItem()->isClipped() ? + gv->scene()->focusItem()->clipPath() : gv->scene()->focusItem()->shape(); + const qreal itemHeight = path.boundingRect().height(); + + // Limit the maximum translation so that underlaying window content is not exposed. + qreal maxY = gv->sceneRect().bottom() - splitViewRect.bottom(); + maxY = m_transformation.height() ? (qMin(itemHeight, maxY) + m_transformation.height()) : maxY; + if (maxY < 0) + maxY = 0; + + // Translation should happen row-by-row, but initially it needs to ensure that cursor is visible. + const qreal translation = m_transformation.height() ? + cursor.height() : (cursorRect.bottom() - vkbRect.top()); + const qreal dy = -(qMin(maxY, translation)); + + // Do not allow transform above screen top, nor beyond scenerect + if (m_transformation.height() + dy > 0 || gv->sceneRect().bottom() + m_transformation.height() < 0) { + // If we already have some transformation, remove it. + if (m_transformation.height() < 0 || gv->sceneRect().bottom() + m_transformation.height() < 0) { + rootItem->resetTransform(); + translateInputWidget(); + } return; + } rootItem->setTransform(QTransform::fromTranslate(0, dy), true); } |