Send enter to the child at the position of the QEnterEvent.

This was apparently done so in each of the widget_<platform>.cpp
in Qt 4.8. This then causes the cursor to be updated in
dispatchEnterLeave() on Windows and Linux.

Task-number: QTBUG-27871
Task-number: QTBUG-27585
Task-number: QTBUG-26424
Change-Id: Idf14cd96ccb36f7c2607853ed8b0024c36a5413c
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
bb10
Friedemann Kleint 2012-11-08 12:45:08 +01:00 committed by The Qt Project
parent 4334e0fcc6
commit 39a0952687
2 changed files with 6 additions and 4 deletions

View File

@ -261,8 +261,10 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
}
} else {
const QEnterEvent *ee = static_cast<QEnterEvent *>(event);
QApplicationPrivate::dispatchEnterLeave(m_widget, 0, ee->screenPos());
qt_last_mouse_receiver = m_widget;
QWidget *child = m_widget->childAt(ee->pos());
QWidget *receiver = child ? child : m_widget;
QApplicationPrivate::dispatchEnterLeave(receiver, 0, ee->screenPos());
qt_last_mouse_receiver = receiver;
}
}

View File

@ -8547,6 +8547,7 @@ void tst_QWidget::syntheticEnterLeave()
MyWidget window;
window.setWindowFlags(Qt::WindowStaysOnTopHint);
window.move(200, 200);
window.resize(200, 200);
MyWidget *child1 = new MyWidget(&window);
@ -8636,8 +8637,6 @@ void tst_QWidget::syntheticEnterLeave()
#ifndef QTEST_NO_CURSOR
void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave()
{
if (m_platform == QStringLiteral("windows") || m_platform == QStringLiteral("xcb"))
QSKIP("QTBUG-26424");
class SELParent : public QWidget
{
public:
@ -8665,6 +8664,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave()
QCursor::setPos(QPoint(0,0));
SELParent parent;
parent.move(200, 200);
parent.resize(200, 200);
SELChild child(&parent);
child.resize(200, 200);