aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNing Chi <ext-chi.ning@nokia.com>2010-12-29 15:08:03 +0200
committerPekka Vuorela <pekka.ta.vuorela@nokia.com>2011-01-05 17:29:18 +0200
commite53ced3b513c1a74ed856820a0f83379f13d8699 (patch)
treeab99bb255d4a7b660359df51d8613b434afea3b9
parent0940ea05991df96ada11845d9d5fea7aa0769de6 (diff)
Changes: mcompleterview should clear focus proxy before being hidden
RevBy: Hannu Koivisto, Pekka Vuorela
-rw-r--r--src/corelib/widgets/mcompleter.cpp4
-rw-r--r--src/views/mcompleterview.cpp15
-rw-r--r--src/views/mcompleterview.h6
3 files changed, 23 insertions, 2 deletions
diff --git a/src/corelib/widgets/mcompleter.cpp b/src/corelib/widgets/mcompleter.cpp
index d4122617..a8c4168a 100644
--- a/src/corelib/widgets/mcompleter.cpp
+++ b/src/corelib/widgets/mcompleter.cpp
@@ -442,8 +442,10 @@ QAbstractItemModel *MCompleter::matchedCandidateModel() const
void MCompleter::hideCompleter()
{
if (isActive()) {
- widget()->sceneManager()->disappearSceneWindow(this);
+ // change active state to false before really hidden to notify view
+ // to do necessary clear.
model()->setActive(false);
+ widget()->sceneManager()->disappearSceneWindow(this);
emit hidden();
}
}
diff --git a/src/views/mcompleterview.cpp b/src/views/mcompleterview.cpp
index 546094e7..935bee1a 100644
--- a/src/views/mcompleterview.cpp
+++ b/src/views/mcompleterview.cpp
@@ -93,7 +93,6 @@ void MCompleterViewPrivate::init()
{
connect(completionsButton, SIGNAL(clicked()), this, SLOT(showPopup()));
connect(controller, SIGNAL(shown()), this, SLOT(createContents()));
- connect(controller, SIGNAL(hidden()), this, SLOT(clear()));
if (controller->widget()) {
connect(controller->widget()->sceneManager(),
SIGNAL(orientationChangeFinished(const M::Orientation &)),
@@ -392,4 +391,18 @@ void MCompleterView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
event->accept();
}
+void MCompleterView::updateData(const QList<const char *>& modifications)
+{
+ Q_D(MCompleterView);
+
+ if (modifications.contains(MCompleterModel::Active)) {
+ if (!model()->active()) {
+ // clear focus proxy when control become inactive (before really hidden
+ // to avoid focus out)
+ d->clear();
+ }
+ }
+ MSceneWindowView::updateData(modifications);
+}
+
M_REGISTER_VIEW_NEW(MCompleterView, MCompleter)
diff --git a/src/views/mcompleterview.h b/src/views/mcompleterview.h
index 29f0a818..77d4639e 100644
--- a/src/views/mcompleterview.h
+++ b/src/views/mcompleterview.h
@@ -46,6 +46,12 @@ protected:
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
//! \reimp_end
+protected Q_SLOTS:
+
+ //! \reimp
+ virtual void updateData(const QList<const char *>& modifications);
+ //! \reimp_end
+
private:
MCompleterViewPrivate *const d_ptr;