diff options
author | Gareth Stockwell <gareth.stockwell@sosco.com> | 2009-10-07 16:30:47 (GMT) |
---|---|---|
committer | Gareth Stockwell <gareth.stockwell@sosco.com> | 2009-10-09 07:07:53 (GMT) |
commit | 9371ae3ff036a622f578023377cfcacbc733b804 (patch) | |
tree | 3cdea47ed4143add16adf3369bd3980969fa7b07 /src/gui/kernel/qwidget_p.h | |
parent | dda32cb904430e225566b047004b93c7be8ecca9 (diff) | |
download | Qt-9371ae3ff036a622f578023377cfcacbc733b804.zip Qt-9371ae3ff036a622f578023377cfcacbc733b804.tar.gz Qt-9371ae3ff036a622f578023377cfcacbc733b804.tar.bz2 |
Modified reparenting to correctly deal with native child widgets
Both reparenting and modification of window flags are done by calling
QWidget::setParent. If either the parent changes, or a non-top-level
widget becomes top-level (as a result of OR-ing Qt::Window into its
window flags), a new native window ID is created for the widget. The
Symbian implementation of setParent_sys had a flaw which manifested
itself in the following situation:
1. We start with a native widget X, and its child Y, which is also
native. There exist parent-child relationships between the associated
CCoeControl instances, and the native windows (represented by RWindow
handles).
2. X gets a new native window created as a result of a call to
setParent.
3. QWidgetPrivate::reparentChildren calls SetParent on Y's control, to
re-establish the parent-child relationship.
The problem is that the window owned by Y's control now has no parent,
so if we try to re-size the widget, the window server panics the client
thread (WSERV-52).
Because Symbian does not allow existing windows to be re-parented, and
nor does it allow a window-owning control to re-create a new window,
the only way to provide Y's window with a parent is to destroy the
control and create a new one, passing in X's new window to the
CCoeControl::CreateWindowL function.
The changes made are as follows:
a) QWidgetPrivate::reparentChildren is therefore modified to call
create_sys, with destroyOldWindow set to true.
b) QWidgetPrivate::create_sys is modified to take account of the value
of this flag in all cases. (Previously it only did so if a new WId was
passed in by the caller).
c) The call to setWinId is delayed until the control and window are
fully initialized. This is to allow us to emit a new event,
WinIdChanged, from setWinId, in order to inform the widget that its
winId has changed.
d) QWidgetPrivate::activateSymbianWindow is modified in order to
support this change of call ordering.
Note that QWidgetPrivate::create_sys requires some re-factoring in
order to remove the redundancy between the top-level and child widget
cases.
Task-number: QTBUG-4664
Reviewed-by: axis
Diffstat (limited to 'src/gui/kernel/qwidget_p.h')
-rw-r--r-- | src/gui/kernel/qwidget_p.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index c06ef73..a4cc0da 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -294,7 +294,7 @@ public: void setMask_sys(const QRegion &); #ifdef Q_OS_SYMBIAN void setSoftKeys_sys(const QList<QAction*> &softkeys); - void activateSymbianWindow(); + void activateSymbianWindow(WId wid = 0); #endif void raise_sys(); |