diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index d785ffa1..66ae6ac6 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -389,9 +389,10 @@ void UBGraphicsItemDelegate::remove(bool canUndo) scene->removeItem(mFrame); /* this is performed because when removing delegated from scene while it contains flash content, segfault happens because of QGraphicsScene::removeItem() */ - UBGraphicsWebView *mDelegated_casted = static_cast(mDelegated); + UBGraphicsWebView *mDelegated_casted = dynamic_cast(mDelegated); if (mDelegated_casted) mDelegated_casted->setHtml(QString()); + scene->removeItem(mDelegated); if (canUndo) diff --git a/src/domain/UBGraphicsWebView.cpp b/src/domain/UBGraphicsWebView.cpp index d68bd51d..de9da3e7 100644 --- a/src/domain/UBGraphicsWebView.cpp +++ b/src/domain/UBGraphicsWebView.cpp @@ -51,10 +51,9 @@ QVariant UBGraphicsWebView::itemChange(GraphicsItemChange change, const QVariant if ((change == QGraphicsItem::ItemSelectedHasChanged) && scene()) { if (isSelected()) scene()->setActiveWindow(this); - else { + else if(scene()->activeWindow() == this) scene()->setActiveWindow(0); - } } QVariant newValue = mDelegate->itemChange(change, value); @@ -169,3 +168,11 @@ void UBGraphicsWebView::remove() if (mDelegate) mDelegate->remove(true); } + +bool UBGraphicsWebView::event(QEvent *event) +{ + if (event->type() == QEvent::ShortcutOverride) + event->accept(); + + return QGraphicsWebView::event(event); +} diff --git a/src/domain/UBGraphicsWebView.h b/src/domain/UBGraphicsWebView.h index a24d3aa6..508f60bb 100644 --- a/src/domain/UBGraphicsWebView.h +++ b/src/domain/UBGraphicsWebView.h @@ -55,6 +55,7 @@ class UBGraphicsWebView: public QGraphicsWebView, public UBItem, public UBResiza virtual void wheelEvent(QGraphicsSceneWheelEvent *event); virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); + virtual bool event(QEvent *event); virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);