diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-08-24 14:10:22 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-08-24 14:15:25 (GMT) |
commit | 1a71668483380f45cacda30cc55424d09def0636 (patch) | |
tree | 3835f12ad1702cc8ad318485f5d131aa2f94d301 /src/gui/graphicsview | |
parent | c5b34ea67668e60a61c463633eaae0e629fee606 (diff) | |
download | Qt-1a71668483380f45cacda30cc55424d09def0636.zip Qt-1a71668483380f45cacda30cc55424d09def0636.tar.gz Qt-1a71668483380f45cacda30cc55424d09def0636.tar.bz2 |
Fix Qt::ClickFocus for QGraphicsProxyWidget.
This fixes click-focus for the Embedded Dialogs demo and the Pad Navigator
demo. In Qt 4.6, the behavior of the spontaneous-bit in events has
changed. This has happened in a number of submits that also modify
Graphics View to have the correct behavior. Somewhere on the line,
the spontaneous bit has been reset, preventing QApplicationPrivate's
ClickFocus handling to kick in. This again causes the Embedded Dialogs
demo to not give focus to widgets that are clicked.
This fix is not likely to be 100% correct. What it does is ensure that
the spont-bit survives a call to qt_sendSpontaneousEvent (as this bit
is for some reason reset at the end of QApplicationPrivate::notify_helper),
and this fixes the most apparent regression in ClickFocus handling.
Pending closer review.
The fix includes an autotest that should be kept if the fix is reverted.
Reviewed-by: bnilsen
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicswidget.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 157fbe5..033723a 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -168,6 +168,8 @@ QT_BEGIN_NAMESPACE \sa QGraphicsProxyWidget, QGraphicsItem, {Widgets and Layouts} */ +bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); + /*! Constructs a QGraphicsWidget instance. The optional \a parent argument is passed to QGraphicsItem's constructor. The optional \a wFlags argument @@ -1097,7 +1099,11 @@ QVariant QGraphicsWidget::propertyChange(const QString &propertyName, const QVar */ bool QGraphicsWidget::sceneEvent(QEvent *event) { - return QCoreApplication::sendEvent(this, event) || QGraphicsItem::sceneEvent(event); + bool spont = event->spontaneous(); + if (spont ? qt_sendSpontaneousEvent(this, event) : QApplication::sendEvent(this, event)) + return true; + event->spont = spont; + return QGraphicsItem::sceneEvent(event); } /*! |