bool CDiagramContextMenuHandler::onEvent(CDiagramPrivateData *p, QEvent *evt)
{
    QMenu                           *menu = NULL;
    bool							r = false;
    QGraphicsItem                   *item = NULL;
    QList<QGraphicsItem*>           items;
    CDiagram						*d = NULL;
	QGraphicsSceneContextMenuEvent	*event = NULL;

	if (!p)
		return r;

	d = p->m_d;
	switch(evt->type())
	{
	case QEvent::GraphicsSceneContextMenu:
		event = static_cast<QGraphicsSceneContextMenuEvent*>(evt);
    items = d->items( event->scenePos());
    foreach (item, items)
    {
        if (item)
        {
            d->sendEvent(item, event);
            break;
        }
    }

    if (!event->isAccepted())
		{
        menu = d->contextMenu(d->mode());
        if (!menu)
        {
            r = triggerMenu(d, event->screenPos());
        }
        else
        {
            menu->exec(event->screenPos());
            r = true;
        }
    }
    else
        {
            item->setSelected(true);
        }
		break;

	default:
		break;
	}; // End of switch

	return r;
}
Beispiel #2
0
static QEvent *cloneEvent(QEvent *e)
{
    switch (e->type()) {
    case QEvent::MouseButtonPress:
    case QEvent::MouseButtonRelease:
    case QEvent::MouseButtonDblClick:
    case QEvent::MouseMove:
        return new QMouseEvent(*static_cast<QMouseEvent*>(e));
    case QEvent::KeyPress:
    case QEvent::KeyRelease:
        return new QKeyEvent(*static_cast<QKeyEvent*>(e));
    case QEvent::FocusIn:
    case QEvent::FocusOut:
        return new QFocusEvent(*static_cast<QFocusEvent*>(e));
    case QEvent::Enter:
        return new QEvent(*e);
    case QEvent::Leave:
        return new QEvent(*e);
        break;
    case QEvent::Paint:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::Move:
        return new QMoveEvent(*static_cast<QMoveEvent*>(e));
    case QEvent::Resize:
        return new QResizeEvent(*static_cast<QResizeEvent*>(e));
    case QEvent::Create:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::Destroy:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::Show:
        return new QShowEvent(*static_cast<QShowEvent*>(e));
    case QEvent::Hide:
        return new QHideEvent(*static_cast<QHideEvent*>(e));
    case QEvent::Close:
        return new QCloseEvent(*static_cast<QCloseEvent*>(e));
    case QEvent::Quit:
        return new QEvent(*e);
    case QEvent::ParentChange:
        return new QEvent(*e);
    case QEvent::ParentAboutToChange:
        return new QEvent(*e);
    case QEvent::ThreadChange:
        return new QEvent(*e);

    case QEvent::WindowActivate:
    case QEvent::WindowDeactivate:
        return new QEvent(*e);

    case QEvent::ShowToParent:
        return new QEvent(*e);
    case QEvent::HideToParent:
        return new QEvent(*e);
#ifndef QT_NO_WHEELEVENT
    case QEvent::Wheel:
        return new QWheelEvent(*static_cast<QWheelEvent*>(e));
#endif //QT_NO_WHEELEVENT
    case QEvent::WindowTitleChange:
        return new QEvent(*e);
    case QEvent::WindowIconChange:
        return new QEvent(*e);
    case QEvent::ApplicationWindowIconChange:
        return new QEvent(*e);
    case QEvent::ApplicationFontChange:
        return new QEvent(*e);
    case QEvent::ApplicationLayoutDirectionChange:
        return new QEvent(*e);
    case QEvent::ApplicationPaletteChange:
        return new QEvent(*e);
    case QEvent::PaletteChange:
        return new QEvent(*e);
    case QEvent::Clipboard:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::Speech:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::MetaCall:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::SockAct:
        return new QEvent(*e);
    case QEvent::WinEventAct:
        return new QEvent(*e);
    case QEvent::DeferredDelete:
        return new QEvent(*e);
#ifndef QT_NO_DRAGANDDROP 
   case QEvent::DragEnter:
        return new QDragEnterEvent(*static_cast<QDragEnterEvent*>(e));
    case QEvent::DragMove:
        return new QDragMoveEvent(*static_cast<QDragMoveEvent*>(e));
    case QEvent::DragLeave:
        return new QDragLeaveEvent(*static_cast<QDragLeaveEvent*>(e));
    case QEvent::Drop:
        return new QDropEvent(*static_cast<QDragMoveEvent*>(e));
    case QEvent::DragResponse:
        return new QDragResponseEvent(*static_cast<QDragResponseEvent*>(e));
#endif
    case QEvent::ChildAdded:
        return new QChildEvent(*static_cast<QChildEvent*>(e));
    case QEvent::ChildPolished:
        return new QChildEvent(*static_cast<QChildEvent*>(e));
#ifdef QT3_SUPPORT
    case QEvent::ChildInsertedRequest:
        return new QEvent(*e);
    case QEvent::ChildInserted:
        return new QChildEvent(*static_cast<QChildEvent*>(e));
    case QEvent::LayoutHint:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
#endif
    case QEvent::ChildRemoved:
        return new QChildEvent(*static_cast<QChildEvent*>(e));
    case QEvent::ShowWindowRequest:
        return new QEvent(*e);
    case QEvent::PolishRequest:
        return new QEvent(*e);
    case QEvent::Polish:
        return new QEvent(*e);
    case QEvent::LayoutRequest:
        return new QEvent(*e);
    case QEvent::UpdateRequest:
        return new QEvent(*e);
    case QEvent::UpdateLater:
        return new QEvent(*e);

    case QEvent::EmbeddingControl:
        return new QEvent(*e);
    case QEvent::ActivateControl:
        return new QEvent(*e);
    case QEvent::DeactivateControl:
        return new QEvent(*e);

#ifndef QT_NO_CONTEXTMENU
    case QEvent::ContextMenu:
        return new QContextMenuEvent(*static_cast<QContextMenuEvent*>(e));
#endif
    case QEvent::InputMethod:
        return new QInputMethodEvent(*static_cast<QInputMethodEvent*>(e));
    case QEvent::AccessibilityPrepare:
        return new QEvent(*e);
#ifndef QT_NO_TABLETEVENT
    case QEvent::TabletMove:
        return new QTabletEvent(*static_cast<QTabletEvent*>(e));
#endif //QT_NO_TABLETEVENT
    case QEvent::LocaleChange:
        return new QEvent(*e);
    case QEvent::LanguageChange:
        return new QEvent(*e);
    case QEvent::LayoutDirectionChange:
        return new QEvent(*e);
    case QEvent::Style:
        return new QEvent(*e);
#ifndef QT_NO_TABLETEVENT
    case QEvent::TabletPress:
        return new QTabletEvent(*static_cast<QTabletEvent*>(e));
    case QEvent::TabletRelease:
        return new QTabletEvent(*static_cast<QTabletEvent*>(e));
#endif //QT_NO_TABLETEVENT
    case QEvent::OkRequest:
        return new QEvent(*e);
    case QEvent::HelpRequest:
        return new QEvent(*e);

    case QEvent::IconDrag:
        return new QIconDragEvent(*static_cast<QIconDragEvent*>(e));

    case QEvent::FontChange:
        return new QEvent(*e);
    case QEvent::EnabledChange:
        return new QEvent(*e);
    case QEvent::ActivationChange:
        return new QEvent(*e);
    case QEvent::StyleChange:
        return new QEvent(*e);
    case QEvent::IconTextChange:
        return new QEvent(*e);
    case QEvent::ModifiedChange:
        return new QEvent(*e);
    case QEvent::MouseTrackingChange:
        return new QEvent(*e);

    case QEvent::WindowBlocked:
        return new QEvent(*e);
    case QEvent::WindowUnblocked:
        return new QEvent(*e);
    case QEvent::WindowStateChange:
        return new QWindowStateChangeEvent(*static_cast<QWindowStateChangeEvent*>(e));

    case QEvent::ToolTip:
        return new QHelpEvent(*static_cast<QHelpEvent*>(e));
    case QEvent::WhatsThis:
        return new QHelpEvent(*static_cast<QHelpEvent*>(e));
#ifndef QT_NO_STATUSTIP
    case QEvent::StatusTip:
        return new QStatusTipEvent(*static_cast<QStatusTipEvent*>(e));
#endif //QT_NO_STATUSTIP
#ifndef QT_NO_ACTION
    case QEvent::ActionChanged:
    case QEvent::ActionAdded:
    case QEvent::ActionRemoved:
        return new QActionEvent(*static_cast<QActionEvent*>(e));
#endif
    case QEvent::FileOpen:
        return new QFileOpenEvent(*static_cast<QFileOpenEvent*>(e));

#ifndef QT_NO_SHORTCUT
    case QEvent::Shortcut:
        return new QShortcutEvent(*static_cast<QShortcutEvent*>(e));
#endif //QT_NO_SHORTCUT
    case QEvent::ShortcutOverride:
        return new QKeyEvent(*static_cast<QKeyEvent*>(e));

#ifdef QT3_SUPPORT
    case QEvent::Accel:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::AccelAvailable:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
#endif

#ifndef QT_NO_WHATSTHIS
    case QEvent::WhatsThisClicked:
        return new QWhatsThisClickedEvent(*static_cast<QWhatsThisClickedEvent*>(e));
#endif //QT_NO_WHATSTHIS

#ifndef QT_NO_TOOLBAR
    case QEvent::ToolBarChange:
        return new QToolBarChangeEvent(*static_cast<QToolBarChangeEvent*>(e));
#endif //QT_NO_TOOLBAR

    case QEvent::ApplicationActivate:
        return new QEvent(*e);
    case QEvent::ApplicationDeactivate:
        return new QEvent(*e);

    case QEvent::QueryWhatsThis:
        return new QHelpEvent(*static_cast<QHelpEvent*>(e));
    case QEvent::EnterWhatsThisMode:
        return new QEvent(*e);
    case QEvent::LeaveWhatsThisMode:
        return new QEvent(*e);

    case QEvent::ZOrderChange:
        return new QEvent(*e);

    case QEvent::HoverEnter:
    case QEvent::HoverLeave:
    case QEvent::HoverMove:
        return new QHoverEvent(*static_cast<QHoverEvent*>(e));

    case QEvent::AccessibilityHelp:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::AccessibilityDescription:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

#ifdef QT_KEYPAD_NAVIGATION
    case QEvent::EnterEditFocus:
        return new QEvent(*e);
    case QEvent::LeaveEditFocus:
        return new QEvent(*e);
#endif
    case QEvent::AcceptDropsChange:
        return new QEvent(*e);

#ifdef QT3_SUPPORT
    case QEvent::MenubarUpdated:
        return new QMenubarUpdatedEvent(*static_cast<QMenubarUpdatedEvent*>(e));
#endif

    case QEvent::ZeroTimerEvent:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
#ifndef QT_NO_GRAPHICSVIEW
    case QEvent::GraphicsSceneMouseMove:
    case QEvent::GraphicsSceneMousePress:
    case QEvent::GraphicsSceneMouseRelease:
    case QEvent::GraphicsSceneMouseDoubleClick: {
        QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent*>(e);
        QGraphicsSceneMouseEvent *me2 = new QGraphicsSceneMouseEvent(me->type());
        me2->setWidget(me->widget());
        me2->setPos(me->pos());
        me2->setScenePos(me->scenePos());
        me2->setScreenPos(me->screenPos());
// ### for all buttons
        me2->setButtonDownPos(Qt::LeftButton, me->buttonDownPos(Qt::LeftButton));
        me2->setButtonDownPos(Qt::RightButton, me->buttonDownPos(Qt::RightButton));
        me2->setButtonDownScreenPos(Qt::LeftButton, me->buttonDownScreenPos(Qt::LeftButton));
        me2->setButtonDownScreenPos(Qt::RightButton, me->buttonDownScreenPos(Qt::RightButton));
        me2->setLastPos(me->lastPos());
        me2->setLastScenePos(me->lastScenePos());
        me2->setLastScreenPos(me->lastScreenPos());
        me2->setButtons(me->buttons());
        me2->setButton(me->button());
        me2->setModifiers(me->modifiers());
        return me2;
    }

    case QEvent::GraphicsSceneContextMenu: {
        QGraphicsSceneContextMenuEvent *me = static_cast<QGraphicsSceneContextMenuEvent*>(e);
        QGraphicsSceneContextMenuEvent *me2 = new QGraphicsSceneContextMenuEvent(me->type());
        me2->setWidget(me->widget());
        me2->setPos(me->pos());
        me2->setScenePos(me->scenePos());
        me2->setScreenPos(me->screenPos());
        me2->setModifiers(me->modifiers());
        me2->setReason(me->reason());
        return me2;
    }

    case QEvent::GraphicsSceneHoverEnter:
    case QEvent::GraphicsSceneHoverMove:
    case QEvent::GraphicsSceneHoverLeave: {
        QGraphicsSceneHoverEvent *he = static_cast<QGraphicsSceneHoverEvent*>(e);
        QGraphicsSceneHoverEvent *he2 = new QGraphicsSceneHoverEvent(he->type());
        he2->setPos(he->pos());
        he2->setScenePos(he->scenePos());
        he2->setScreenPos(he->screenPos());
        he2->setLastPos(he->lastPos());
        he2->setLastScenePos(he->lastScenePos());
        he2->setLastScreenPos(he->lastScreenPos());
        he2->setModifiers(he->modifiers());
        return he2;
    }
    case QEvent::GraphicsSceneHelp:
        return new QHelpEvent(*static_cast<QHelpEvent*>(e));
    case QEvent::GraphicsSceneDragEnter:
    case QEvent::GraphicsSceneDragMove:
    case QEvent::GraphicsSceneDragLeave:
    case QEvent::GraphicsSceneDrop: {
        QGraphicsSceneDragDropEvent *dde = static_cast<QGraphicsSceneDragDropEvent*>(e);
        QGraphicsSceneDragDropEvent *dde2 = new QGraphicsSceneDragDropEvent(dde->type());
        dde2->setPos(dde->pos());
        dde2->setScenePos(dde->scenePos());
        dde2->setScreenPos(dde->screenPos());
        dde2->setButtons(dde->buttons());
        dde2->setModifiers(dde->modifiers());
        return dde2;
    }
    case QEvent::GraphicsSceneWheel: {
        QGraphicsSceneWheelEvent *we = static_cast<QGraphicsSceneWheelEvent*>(e);
        QGraphicsSceneWheelEvent *we2 = new QGraphicsSceneWheelEvent(we->type());
        we2->setPos(we->pos());
        we2->setScenePos(we->scenePos());
        we2->setScreenPos(we->screenPos());
        we2->setButtons(we->buttons());
        we2->setModifiers(we->modifiers());
        we2->setOrientation(we->orientation());
        we2->setDelta(we->delta());
        return we2;
    }
#endif
    case QEvent::KeyboardLayoutChange:
        return new QEvent(*e);

    case QEvent::DynamicPropertyChange:
        return new QDynamicPropertyChangeEvent(*static_cast<QDynamicPropertyChangeEvent*>(e));

#ifndef QT_NO_TABLETEVENT
    case QEvent::TabletEnterProximity:
    case QEvent::TabletLeaveProximity:
        return new QTabletEvent(*static_cast<QTabletEvent*>(e));
#endif //QT_NO_TABLETEVENT

    case QEvent::NonClientAreaMouseMove:
    case QEvent::NonClientAreaMouseButtonPress:
    case QEvent::NonClientAreaMouseButtonRelease:
    case QEvent::NonClientAreaMouseButtonDblClick:
        return new QMouseEvent(*static_cast<QMouseEvent*>(e));

    case QEvent::MacSizeChange:
        return new QEvent(*e);

    case QEvent::ContentsRectChange:
        return new QEvent(*e);

    case QEvent::MacGLWindowChange:
        return new QEvent(*e);

    case QEvent::FutureCallOut:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
#ifndef QT_NO_GRAPHICSVIEW
    case QEvent::GraphicsSceneResize: {
        QGraphicsSceneResizeEvent *re = static_cast<QGraphicsSceneResizeEvent*>(e);
        QGraphicsSceneResizeEvent *re2 = new QGraphicsSceneResizeEvent();
        re2->setOldSize(re->oldSize());
        re2->setNewSize(re->newSize());
        return re2;
    }
    case QEvent::GraphicsSceneMove: {
        QGraphicsSceneMoveEvent *me = static_cast<QGraphicsSceneMoveEvent*>(e);
        QGraphicsSceneMoveEvent *me2 = new QGraphicsSceneMoveEvent();
        me2->setWidget(me->widget());
        me2->setNewPos(me->newPos());
        me2->setOldPos(me->oldPos());
        return me2;
    }
#endif
    case QEvent::CursorChange:
        return new QEvent(*e);
    case QEvent::ToolTipChange:
        return new QEvent(*e);

    case QEvent::NetworkReplyUpdated:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::GrabMouse:
    case QEvent::UngrabMouse:
    case QEvent::GrabKeyboard:
    case QEvent::UngrabKeyboard:
        return new QEvent(*e);

    case QEvent::TouchBegin:
    case QEvent::TouchUpdate:
    case QEvent::TouchEnd:
        return new QTouchEvent(*static_cast<QTouchEvent*>(e));

#ifndef QT_NO_GESTURES
    case QEvent::NativeGesture:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
#endif

    case QEvent::RequestSoftwareInputPanel:
    case QEvent::CloseSoftwareInputPanel:
        return new QEvent(*e);

    case QEvent::UpdateSoftKeys:
        return new QEvent(*e);

    case QEvent::User:
    case QEvent::MaxUser:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    default:
        ;
    }
    return qcoreStateMachineHandler()->cloneEvent(e);
}
static QEvent *cloneEvent(QEvent *e)
{
    switch (e->type()) {
    case QEvent::MouseButtonPress:
    case QEvent::MouseButtonRelease:
    case QEvent::MouseButtonDblClick:
    case QEvent::MouseMove:
        return new QMouseEvent(*static_cast<QMouseEvent*>(e));
    case QEvent::KeyPress:
    case QEvent::KeyRelease:
        return new QKeyEvent(*static_cast<QKeyEvent*>(e));
    case QEvent::FocusIn:
    case QEvent::FocusOut:
        return new QFocusEvent(*static_cast<QFocusEvent*>(e));
    case QEvent::Enter:
        return new QEvent(*e);
    case QEvent::Leave:
        return new QEvent(*e);
        break;
    case QEvent::Paint:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::Move:
        return new QMoveEvent(*static_cast<QMoveEvent*>(e));
    case QEvent::Resize:
        return new QResizeEvent(*static_cast<QResizeEvent*>(e));
    case QEvent::Create:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::Destroy:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::Show:
        return new QShowEvent(*static_cast<QShowEvent*>(e));
    case QEvent::Hide:
        return new QHideEvent(*static_cast<QHideEvent*>(e));
    case QEvent::Close:
        return new QCloseEvent(*static_cast<QCloseEvent*>(e));
    case QEvent::Quit:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ParentChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ParentAboutToChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ThreadChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::WindowActivate:
    case QEvent::WindowDeactivate:
        return new QEvent(*e);

    case QEvent::ShowToParent:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::HideToParent:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::Wheel:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::WindowTitleChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::WindowIconChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ApplicationWindowIconChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ApplicationFontChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ApplicationLayoutDirectionChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ApplicationPaletteChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::PaletteChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::Clipboard:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::Speech:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::MetaCall:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::SockAct:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::WinEventAct:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::DeferredDelete:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::DragEnter:
        return new QDragEnterEvent(*static_cast<QDragEnterEvent*>(e));
    case QEvent::DragMove:
        return new QDragMoveEvent(*static_cast<QDragMoveEvent*>(e));
    case QEvent::DragLeave:
        return new QDragLeaveEvent(*static_cast<QDragLeaveEvent*>(e));
    case QEvent::Drop:
        return new QDropEvent(*static_cast<QDragMoveEvent*>(e));
    case QEvent::DragResponse:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ChildAdded:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ChildPolished:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
#ifdef QT3_SUPPORT
    case QEvent::ChildInsertedRequest:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ChildInserted:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::LayoutHint:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
#endif
    case QEvent::ChildRemoved:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ShowWindowRequest:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::PolishRequest:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::Polish:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::LayoutRequest:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::UpdateRequest:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::UpdateLater:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::EmbeddingControl:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ActivateControl:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::DeactivateControl:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ContextMenu:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::InputMethod:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::AccessibilityPrepare:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::TabletMove:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::LocaleChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::LanguageChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::LayoutDirectionChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::Style:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::TabletPress:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::TabletRelease:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::OkRequest:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::HelpRequest:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::IconDrag:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::FontChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::EnabledChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ActivationChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::StyleChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::IconTextChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ModifiedChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::MouseTrackingChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::WindowBlocked:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::WindowUnblocked:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::WindowStateChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::ToolTip:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::WhatsThis:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::StatusTip:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::ActionChanged:
    case QEvent::ActionAdded:
    case QEvent::ActionRemoved:
        return new QActionEvent(*static_cast<QActionEvent*>(e));

    case QEvent::FileOpen:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::Shortcut:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ShortcutOverride:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

#ifdef QT3_SUPPORT
    case QEvent::Accel:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::AccelAvailable:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
#endif

    case QEvent::WhatsThisClicked:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::ToolBarChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::ApplicationActivate:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ApplicationDeactivate:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::QueryWhatsThis:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::EnterWhatsThisMode:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::LeaveWhatsThisMode:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::ZOrderChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::HoverEnter:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::HoverLeave:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::HoverMove:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::AccessibilityHelp:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::AccessibilityDescription:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

#ifdef QT_KEYPAD_NAVIGATION
    case QEvent::EnterEditFocus:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::LeaveEditFocus:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
#endif
    case QEvent::AcceptDropsChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::MenubarUpdated:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::ZeroTimerEvent:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::GraphicsSceneMouseMove:
    case QEvent::GraphicsSceneMousePress:
    case QEvent::GraphicsSceneMouseRelease:
    case QEvent::GraphicsSceneMouseDoubleClick: {
        QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent*>(e);
        QGraphicsSceneMouseEvent *me2 = new QGraphicsSceneMouseEvent(me->type());
        me2->setWidget(me->widget());
        me2->setPos(me->pos());
        me2->setScenePos(me->scenePos());
        me2->setScreenPos(me->screenPos());
// ### for all buttons
        me2->setButtonDownPos(Qt::LeftButton, me->buttonDownPos(Qt::LeftButton));
        me2->setButtonDownPos(Qt::RightButton, me->buttonDownPos(Qt::RightButton));
        me2->setButtonDownScreenPos(Qt::LeftButton, me->buttonDownScreenPos(Qt::LeftButton));
        me2->setButtonDownScreenPos(Qt::RightButton, me->buttonDownScreenPos(Qt::RightButton));
        me2->setLastPos(me->lastPos());
        me2->setLastScenePos(me->lastScenePos());
        me2->setLastScreenPos(me->lastScreenPos());
        me2->setButtons(me->buttons());
        me2->setButton(me->button());
        me2->setModifiers(me->modifiers());
        return me2;
    }

    case QEvent::GraphicsSceneContextMenu: {
        QGraphicsSceneContextMenuEvent *me = static_cast<QGraphicsSceneContextMenuEvent*>(e);
        QGraphicsSceneContextMenuEvent *me2 = new QGraphicsSceneContextMenuEvent(me->type());
        me2->setWidget(me->widget());
        me2->setPos(me->pos());
        me2->setScenePos(me->scenePos());
        me2->setScreenPos(me->screenPos());
        me2->setModifiers(me->modifiers());
        me2->setReason(me->reason());
        return me2;
    }

    case QEvent::GraphicsSceneHoverEnter:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::GraphicsSceneHoverMove:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::GraphicsSceneHoverLeave:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::GraphicsSceneHelp:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::GraphicsSceneDragEnter:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::GraphicsSceneDragMove:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::GraphicsSceneDragLeave:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::GraphicsSceneDrop:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::GraphicsSceneWheel:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::KeyboardLayoutChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::DynamicPropertyChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::TabletEnterProximity:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::TabletLeaveProximity:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::NonClientAreaMouseMove:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::NonClientAreaMouseButtonPress:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::NonClientAreaMouseButtonRelease:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::NonClientAreaMouseButtonDblClick:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::MacSizeChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::ContentsRectChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::MacGLWindowChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::FutureCallOut:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::GraphicsSceneResize:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::GraphicsSceneMove: {
        QGraphicsSceneMoveEvent *me = static_cast<QGraphicsSceneMoveEvent*>(e);
        QGraphicsSceneMoveEvent *me2 = new QGraphicsSceneMoveEvent();
        me2->setWidget(me->widget());
        me2->setNewPos(me->newPos());
        me2->setOldPos(me->oldPos());
        return me2;
    }

    case QEvent::CursorChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    case QEvent::ToolTipChange:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::NetworkReplyUpdated:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;

    case QEvent::GrabMouse:
    case QEvent::UngrabMouse:
    case QEvent::GrabKeyboard:
    case QEvent::UngrabKeyboard:
        return new QEvent(*e);

#if defined(QT_MAC_USE_COCOA) && (QT_VERSION >= 0x040500)
    case QEvent::CocoaRequestModal:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
#endif
    case QEvent::User:
    case QEvent::MaxUser:
        Q_ASSERT_X(false, "cloneEvent()", "not implemented");
        break;
    default:
        ;
    }
    return qcoreStateMachineHandler()->cloneEvent(e);
}