diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 53ef8eeb500..fbea252bc0d 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -301,14 +301,11 @@ QEvent::QEvent(Type type) /*! \internal - Attempts to copy the \a other event. - - Copying events is a bad idea, yet some Qt 4 code does it (notably, - QApplication and the state machine). - */ + Copies the \a other event. +*/ QEvent::QEvent(const QEvent &other) : d(other.d), t(other.t), posted(other.posted), spont(other.spont), - m_accept(other.m_accept) + m_accept(other.m_accept), m_inputEvent(other.m_inputEvent), m_pointerEvent(other.m_pointerEvent) { Q_TRACE(QEvent_ctor, this, t); // if QEventPrivate becomes available, make sure to implement a diff --git a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp index c5bc7a94603..42a5f4d593f 100644 --- a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp +++ b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp @@ -179,6 +179,15 @@ void tst_QMouseEvent::mouseEventBasic() me = QMouseEvent(QEvent::MouseButtonRelease, local, scene, screen, Qt::LeftButton, Qt::NoButton, Qt::NoModifier); QVERIFY(!me.isBeginEvent()); QVERIFY(me.isEndEvent()); + // Try out the copy constructor + QMouseEvent copy(me); + QVERIFY(copy.isInputEvent()); + QVERIFY(copy.isPointerEvent()); + QVERIFY(!copy.isBeginEvent()); + QVERIFY(copy.isEndEvent()); + QCOMPARE(copy.position(), local); + QCOMPARE(copy.scenePosition(), scene); + QCOMPARE(copy.globalPosition(), screen); } void tst_QMouseEvent::checkMousePressEvent_data()