void QDeclarativeMouseArea::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { bool acceptsContextMenuButton; #if defined(Q_WS_WINCE) // ### WinCE can trigger context menu event with a gesture in the left button or a // click with the right button. Since we have no way here to differentiate them when // event happens, accepting either of the them will block the event. acceptsContextMenuButton = acceptedButtons() & (Qt::LeftButton | Qt::RightButton); #else acceptsContextMenuButton = acceptedButtons() & Qt::RightButton; #endif if (isEnabled() && event->reason() == QGraphicsSceneContextMenuEvent::Mouse && acceptsContextMenuButton) { // Do not let the context menu event propagate to items behind. return; } QDeclarativeItem::contextMenuEvent(event); }
int QDeclarativeMouseArea::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QDeclarativeItem::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 16) qt_static_metacall(this, _c, _id, _a); _id -= 16; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< qreal*>(_v) = mouseX(); break; case 1: *reinterpret_cast< qreal*>(_v) = mouseY(); break; case 2: *reinterpret_cast< bool*>(_v) = hovered(); break; case 3: *reinterpret_cast< bool*>(_v) = pressed(); break; case 4: *reinterpret_cast< bool*>(_v) = isEnabled(); break; case 5: *reinterpret_cast< Qt::MouseButtons*>(_v) = pressedButtons(); break; case 6: *reinterpret_cast< Qt::MouseButtons*>(_v) = acceptedButtons(); break; case 7: *reinterpret_cast< bool*>(_v) = hoverEnabled(); break; case 8: *reinterpret_cast< QDeclarativeDrag**>(_v) = drag(); break; case 9: *reinterpret_cast< bool*>(_v) = preventStealing(); break; } _id -= 10; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 4: setEnabled(*reinterpret_cast< bool*>(_v)); break; case 6: setAcceptedButtons(*reinterpret_cast< Qt::MouseButtons*>(_v)); break; case 7: setHoverEnabled(*reinterpret_cast< bool*>(_v)); break; case 9: setPreventStealing(*reinterpret_cast< bool*>(_v)); break; } _id -= 10; } else if (_c == QMetaObject::ResetProperty) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 10; } #endif // QT_NO_PROPERTIES return _id; }
void QDeclarativeMouseArea::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { bool acceptsContextMenuButton; acceptsContextMenuButton = acceptedButtons() & Qt::RightButton; if (isEnabled() && event->reason() == QGraphicsSceneContextMenuEvent::Mouse && acceptsContextMenuButton) { // Do not let the context menu event propagate to items behind. return; } QDeclarativeItem::contextMenuEvent(event); }