Commit 7a300d4d3a89d7002643bd7e70b1525d72967681
Fixed the context menu test case in the qgraphicsscene autotest.
When creating a custom QContextMenuEvent to send to a viewport we should use
the viewport to convert the mouse cursor position to screen coordinates.
Reviewed-by: Olivier Goffart
| |   |
| 2806 | 2806 | |
| 2807 | 2807 | { |
| 2808 | 2808 | QPoint pos(50, 50); |
| QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.mapToGlobal(pos)); |
| QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.viewport()->mapToGlobal(pos)); |
| 2810 | 2810 | event.ignore(); |
| 2811 | 2811 | QApplication::sendEvent(view.viewport(), &event); |
| 2812 | 2812 | QVERIFY(event.isAccepted()); |
| 2813 | 2813 | } |
| 2814 | 2814 | { |
| 2815 | 2815 | QPoint pos(150, 150); |
| QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.mapToGlobal(pos)); |
| QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.viewport()->mapToGlobal(pos)); |
| 2817 | 2817 | event.ignore(); |
| 2818 | 2818 | QApplication::sendEvent(view.viewport(), &event); |
| 2819 | 2819 | QVERIFY(!event.isAccepted()); |
| … | … | |
| 2821 | 2821 | view.scale(1.5, 1.5); |
| 2822 | 2822 | { |
| 2823 | 2823 | QPoint pos(25, 25); |
| QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.mapToGlobal(pos)); |
| QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.viewport()->mapToGlobal(pos)); |
| 2825 | 2825 | event.ignore(); |
| 2826 | 2826 | QApplication::sendEvent(view.viewport(), &event); |
| 2827 | 2827 | QVERIFY(event.isAccepted()); |
| 2828 | 2828 | } |
| 2829 | 2829 | { |
| 2830 | 2830 | QPoint pos(55, 55); |
| QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.mapToGlobal(pos)); |
| QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.viewport()->mapToGlobal(pos)); |
| 2832 | 2832 | event.ignore(); |
| 2833 | 2833 | QApplication::sendEvent(view.viewport(), &event); |
| 2834 | 2834 | QVERIFY(!event.isAccepted()); |