aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarno Malmari <ext-jarno.malmari@nokia.com>2010-11-29 13:42:25 +0200
committerPekka Vuorela <pekka.ta.vuorela@nokia.com>2010-12-09 14:23:07 +0200
commita455ae982ef8e57da764e77cb6c6f791dcf3c9af (patch)
treedf541df56e37b98c69ed0dc74ead0dbab33428d3
parente374b3f7c88a5c75199943cbe8bb87a28b85968e (diff)
Changes: SIP request moved to focus in, in MTextEdits.
RevBy: Pekka Vuorela, Michael Hasselmann
-rwxr-xr-xsrc/corelib/widgets/mtextedit.cpp51
-rwxr-xr-xsrc/corelib/widgets/mtextedit_p.h5
2 files changed, 16 insertions, 40 deletions
diff --git a/src/corelib/widgets/mtextedit.cpp b/src/corelib/widgets/mtextedit.cpp
index 35719686..ca13f14d 100755
--- a/src/corelib/widgets/mtextedit.cpp
+++ b/src/corelib/widgets/mtextedit.cpp
@@ -305,8 +305,7 @@ namespace
* \param type widget type (single line or multiline)
*/
MTextEditPrivate::MTextEditPrivate()
- : pendingSoftwareInputPanelRequest(false),
- focusEventState(NoFocusEventReceivedYet),
+ : focusEventState(NoFocusEventReceivedYet),
validator(0),
ownValidator(false),
completer(0),
@@ -931,47 +930,24 @@ void MTextEditPrivate::requestSip()
inputContext->setFocusWidget(focusedGraphicsView);
MInputMethodState::requestSoftwareInputPanel();
- pendingSoftwareInputPanelRequest = false;
-
- Q_Q(MTextEdit);
-
- if (q->sceneManager()) {
- q->sceneManager()->ensureCursorVisible();
- }
}
-void MTextEditPrivate::requestAutoSip(Qt::FocusReason fr)
+void MTextEditPrivate::requestAutoSip()
{
Q_Q(MTextEdit);
- if (!q->isAutoSipEnabled()) {
- return;
- }
-
- if (fr == Qt::MouseFocusReason) {
- // Wait for the mouse release event instead so that the window relocation that might
- // happen does not change the mouse position *before* the button is released.
- pendingSoftwareInputPanelRequest = true;
- } else {
+ if (q->isAutoSipEnabled()) {
requestSip();
}
}
-void MTextEditPrivate::closeSip()
-{
- MInputMethodState::closeSoftwareInputPanel();
- pendingSoftwareInputPanelRequest = false;
-}
-
void MTextEditPrivate::closeAutoSip()
{
Q_Q(MTextEdit);
- if (!q->isAutoSipEnabled()) {
- return;
+ if (q->isAutoSipEnabled()) {
+ MInputMethodState::closeSoftwareInputPanel();
}
-
- closeSip();
}
/*!
@@ -1679,15 +1655,14 @@ void MTextEdit::keyPressEvent(QKeyEvent *event)
}
}
-
void MTextEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(MTextEdit);
MWidgetController::mouseReleaseEvent(event);
- // Widget was focused-in on corresponding mouse press event:
- if (d->pendingSoftwareInputPanelRequest) {
- d->requestSip();
+ // Make sure cursor is visible. This is done here so we don't do
+ // unnecessary scrolling if panning is started.
+ if (sceneManager()) {
+ sceneManager()->ensureCursorVisible();
}
}
@@ -1708,7 +1683,12 @@ void MTextEdit::focusInEvent(QFocusEvent *event)
sceneManager(), SLOT(ensureCursorVisible()),
Qt::UniqueConnection);
- d->requestAutoSip(event->reason());
+ if (event->reason() != Qt::MouseFocusReason) {
+ // For mouse reason, this is done on mouse release.
+ sceneManager()->ensureCursorVisible();
+ }
+
+ d->requestAutoSip();
}
if (model()->autoSelectionEnabled() == true) {
@@ -1762,7 +1742,6 @@ void MTextEdit::focusOutEvent(QFocusEvent *event)
}
MInputMethodState::closeSoftwareInputPanel();
- d->pendingSoftwareInputPanelRequest = false;
}
bool MTextEdit::insert(const QString &text)
diff --git a/src/corelib/widgets/mtextedit_p.h b/src/corelib/widgets/mtextedit_p.h
index cb40cd00..971939e2 100755
--- a/src/corelib/widgets/mtextedit_p.h
+++ b/src/corelib/widgets/mtextedit_p.h
@@ -73,8 +73,7 @@ public:
bool isPreediting() const;
void requestSip();
- void requestAutoSip(Qt::FocusReason fr);
- void closeSip();
+ void requestAutoSip();
void closeAutoSip();
void setMode(MTextEditModel::EditMode mode);
@@ -127,8 +126,6 @@ public:
//! \brief Reset IC if we have focus. Disable handling of input method events during reset().
void safeReset();
- bool pendingSoftwareInputPanelRequest;
-
enum FocusEventStateType {
NoFocusEventReceivedYet,
FocusInEventReceived,