diff options
author | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-11-09 14:39:27 (GMT) |
---|---|---|
committer | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-11-11 15:15:40 (GMT) |
commit | 9a5b72eb64d698aff507d5c2b2ea6d19bda0b65e (patch) | |
tree | 4d84e80c495e9827eea55525ef16c160eebc5711 | |
parent | 7a81735272b5ee065f499a492cca4b4a703e0659 (diff) | |
download | Qt-9a5b72eb64d698aff507d5c2b2ea6d19bda0b65e.zip Qt-9a5b72eb64d698aff507d5c2b2ea6d19bda0b65e.tar.gz Qt-9a5b72eb64d698aff507d5c2b2ea6d19bda0b65e.tar.bz2 |
Send WinIdChange event when winId is set to zero
This allows an observer to get a notification just before the window
handle owned by a native widget is destroyed. Note that, at the
point when the event is sent, the widget's internalWinId() will
return the new value, but the old native window handle will not
be destroyed until after the event handler is run.
Task-number: QTMOBILITY-645
Reviewed-by: sroedal
-rw-r--r-- | dist/changes-4.7.2 | 8 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/dist/changes-4.7.2 b/dist/changes-4.7.2 index 49bdd8e..a18a237 100644 --- a/dist/changes-4.7.2 +++ b/dist/changes-4.7.2 @@ -45,8 +45,12 @@ QtCore QtGui ----- - - foo - * bar + - QWidget + * [QTMOBILITY-645] Send WinIdChange event when winId is set to zero. + The window handle of a native widget may be set to zero in two + situations: (i) temporarily, during reparenting and (ii) during + widget destruction. Previously, no WinIdChange event was sent in + either of these cases; now, it is sent in both cases. QtDBus ------ diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index e22ec55..cbf4886 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1673,13 +1673,8 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier } if(oldWinId != id) { - // Do not emit an event when the old winId is destroyed. This only - // happens (a) during widget destruction, and (b) immediately prior - // to creation of a new winId, for example as a result of re-parenting. - if(id != 0) { - QEvent e(QEvent::WinIdChange); - QCoreApplication::sendEvent(q, &e); - } + QEvent e(QEvent::WinIdChange); + QCoreApplication::sendEvent(q, &e); } } |