diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-07-30 06:36:16 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-07-30 06:36:16 (GMT) |
commit | b9c45a1e2fd9bc19287aebd0ffe92bbfa443a6cf (patch) | |
tree | b171f7e1d327fa0f1792708fcb030758c4d411ce /src/gui/kernel/qwidget_s60.cpp | |
parent | 3fe008b1c420105865d2eb192fb7e104019c6aa3 (diff) | |
download | Qt-b9c45a1e2fd9bc19287aebd0ffe92bbfa443a6cf.zip Qt-b9c45a1e2fd9bc19287aebd0ffe92bbfa443a6cf.tar.gz Qt-b9c45a1e2fd9bc19287aebd0ffe92bbfa443a6cf.tar.bz2 |
Swicthed back to original way of using AddToStackL and RemoveFromStack
Task: 258504
This commit fixes the problem that background widgets do not get
orientation change events, and thus will not be correctly layouted after
the foreground windget is closed.
See also: c17c1c101cbe09d4c6149ef8e76a9bb792222456
At the time when commit c17c1c101cbe09d4c6149ef8e76a9bb792222456 was
created there were no SetFocus calls in hide_sys and show_sys.
I think that has been the root cause why focus change event has not
been generated. I.e. hiding a CCoeControl in Symbian (MakeVisible)
does not generate focus event but setFocus(false/true) generates.
I tried this code with Drilldown example. In city detaisl view the
combobox was working fine with keypad navigation.
The change had no effects to qcombobox autotest results and qwidget
autotest resutls were better on some run and a bit worse on some run.
There was variation in 2-4 qwidget autotest results on each run.
Note also that screensaver seems to affect to test results.
Diffstat (limited to 'src/gui/kernel/qwidget_s60.cpp')
-rw-r--r-- | src/gui/kernel/qwidget_s60.cpp | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 5b05e55..2b3dbf4 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -312,7 +312,17 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de data.crect.moveTopLeft(QPoint(clientRect.iTl.iX, clientRect.iTl.iY)); QSymbianControl *control= new QSymbianControl(q); control->ConstructL(true,desktop); + + if (!desktop) { + TInt stackingFlags; + if ((q->windowType() & Qt::Popup) == Qt::Popup) { + stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; + } else { + stackingFlags = ECoeStackFlagStandard; + } + control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags); + QTLWExtra *topExtra = topData(); topExtra->rwindow = control->DrawableWindow(); // Request mouse move events. @@ -341,6 +351,15 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de } else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create native child widget QSymbianControl *control = new QSymbianControl(q); control->ConstructL(!parentWidget); + + TInt stackingFlags; + if ((q->windowType() & Qt::Popup) == Qt::Popup) { + stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; + } else { + stackingFlags = ECoeStackFlagStandard; + } + control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags); + setWinId(control); WId parentw = parentWidget->effectiveWinId(); control->SetContainerWindowL(*parentw); @@ -381,15 +400,9 @@ void QWidgetPrivate::show_sys() id->ActivateL(); extra->topextra->activated = 1; } - TInt stackingFlags; - if ((q->windowType() & Qt::Popup) == Qt::Popup) { - stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; - } else { - stackingFlags = ECoeStackFlagStandard; - } - id->ControlEnv()->AppUi()->AddToStackL(id, ECoeStackPriorityDefault, stackingFlags); id->MakeVisible(true); - + id->SetFocus(true); + // Force setting of the icon after window is made visible, // this is needed even WA_SetWindowIcon is not set, as in that case we need // to reset to the application level window icon @@ -406,10 +419,9 @@ void QWidgetPrivate::hide_sys() deactivateWidgetCleanup(); WId id = q->internalWinId(); if (q->isWindow() && id) { - if(id->IsFocused()) // Avoid unnecessry calls to FocusChanged() + if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() id->SetFocus(false); id->MakeVisible(false); - id->ControlEnv()->AppUi()->RemoveFromStack(id); if (QWidgetBackingStore *bs = maybeBackingStore()) bs->releaseBuffer(); } else { @@ -544,7 +556,8 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) // destroyed when emitting the child remove event below. See QWorkspace. if (wasCreated && old_winid) { old_winid->MakeVisible(false); - old_winid->ControlEnv()->AppUi()->RemoveFromStack(old_winid); + if(old_winid->IsFocused()) // Avoid unnecessary calls to FocusChanged() + old_winid->SetFocus(false); old_winid->SetParent(0); } @@ -1028,14 +1041,16 @@ void QWidget::setWindowState(Qt::WindowStates newstate) if (newstate & Qt::WindowMinimized) { if (isVisible()) { WId id = effectiveWinId(); + if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() + id->SetFocus(false); id->MakeVisible(false); - id->ControlEnv()->AppUi()->RemoveFromStack(id); } } else { if (isVisible()) { WId id = effectiveWinId(); id->MakeVisible(true); - id->ControlEnv()->AppUi()->AddToStackL(id); + if(!id->IsFocused()) // Avoid unnecessary calls to FocusChanged() + id->SetFocus(true); } const QRect normalGeometry = geometry(); const QRect r = top->normalGeometry; |