Bug with shortcuts in widget fixed.

Now copy/paste can be performed without being grapped by application's actions.
Another bug when removing object fixed (dynamic_cast instead of static_cast) in DelegateItem.
preferencesAboutTextFull
Yimgo 12 years ago
parent 244c5c07b9
commit 9a62370716
  1. 3
      src/domain/UBGraphicsItemDelegate.cpp
  2. 11
      src/domain/UBGraphicsWebView.cpp
  3. 1
      src/domain/UBGraphicsWebView.h

@ -389,9 +389,10 @@ void UBGraphicsItemDelegate::remove(bool canUndo)
scene->removeItem(mFrame); scene->removeItem(mFrame);
/* this is performed because when removing delegated from scene while it contains flash content, segfault happens because of QGraphicsScene::removeItem() */ /* 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<UBGraphicsWebView*>(mDelegated); UBGraphicsWebView *mDelegated_casted = dynamic_cast<UBGraphicsWebView*>(mDelegated);
if (mDelegated_casted) if (mDelegated_casted)
mDelegated_casted->setHtml(QString()); mDelegated_casted->setHtml(QString());
scene->removeItem(mDelegated); scene->removeItem(mDelegated);
if (canUndo) if (canUndo)

@ -51,10 +51,9 @@ QVariant UBGraphicsWebView::itemChange(GraphicsItemChange change, const QVariant
if ((change == QGraphicsItem::ItemSelectedHasChanged) && scene()) { if ((change == QGraphicsItem::ItemSelectedHasChanged) && scene()) {
if (isSelected()) if (isSelected())
scene()->setActiveWindow(this); scene()->setActiveWindow(this);
else { else
if(scene()->activeWindow() == this) if(scene()->activeWindow() == this)
scene()->setActiveWindow(0); scene()->setActiveWindow(0);
}
} }
QVariant newValue = mDelegate->itemChange(change, value); QVariant newValue = mDelegate->itemChange(change, value);
@ -169,3 +168,11 @@ void UBGraphicsWebView::remove()
if (mDelegate) if (mDelegate)
mDelegate->remove(true); mDelegate->remove(true);
} }
bool UBGraphicsWebView::event(QEvent *event)
{
if (event->type() == QEvent::ShortcutOverride)
event->accept();
return QGraphicsWebView::event(event);
}

@ -55,6 +55,7 @@ class UBGraphicsWebView: public QGraphicsWebView, public UBItem, public UBResiza
virtual void wheelEvent(QGraphicsSceneWheelEvent *event); virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
virtual bool event(QEvent *event);
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);

Loading…
Cancel
Save