w3c widgets workaround

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent f49e2fa75e
commit 3e5e946a3c
  1. 95
      src/domain/UBGraphicsWidgetItem.cpp

@ -563,6 +563,9 @@ void UBGraphicsWidgetItem::injectInlineJavaScript()
void UBGraphicsWidgetItem::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) void UBGraphicsWidgetItem::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{ {
if(!scene() || !scene()->renderingContext())
return;
if (scene()->renderingContext() != UBGraphicsScene::Screen) if (scene()->renderingContext() != UBGraphicsScene::Screen)
{ {
painter->drawPixmap(0, 0, snapshot()); painter->drawPixmap(0, 0, snapshot());
@ -622,52 +625,52 @@ void UBGraphicsWidgetItem::mainFrameLoadFinished (bool ok)
update(boundingRect()); update(boundingRect());
} }
void UBGraphicsWidgetItem::wheelEvent(QGraphicsSceneWheelEvent *event) void UBGraphicsWidgetItem::wheelEvent(QGraphicsSceneWheelEvent *event)
{ {
if (Delegate()->weelEvent(event)) if (Delegate()->weelEvent(event))
{ {
QGraphicsWebView::wheelEvent(event); QGraphicsWebView::wheelEvent(event);
event->accept(); event->accept();
} }
} }
QVariant UBGraphicsWidgetItem::itemChange(GraphicsItemChange change, const QVariant &value) QVariant UBGraphicsWidgetItem::itemChange(GraphicsItemChange change, const QVariant &value)
{ {
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 = Delegate()->itemChange(change, value); QVariant newValue = Delegate()->itemChange(change, value);
return QGraphicsWebView::itemChange(change, newValue); return QGraphicsWebView::itemChange(change, newValue);
} }
void UBGraphicsWidgetItem::resize(qreal w, qreal h) void UBGraphicsWidgetItem::resize(qreal w, qreal h)
{ {
UBGraphicsWidgetItem::resize(QSizeF(w, h)); UBGraphicsWidgetItem::resize(QSizeF(w, h));
} }
void UBGraphicsWidgetItem::resize(const QSizeF & pSize) void UBGraphicsWidgetItem::resize(const QSizeF & pSize)
{ {
if (pSize != size()) { if (pSize != size()) {
QGraphicsWebView::setMaximumSize(pSize.width(), pSize.height()); QGraphicsWebView::setMaximumSize(pSize.width(), pSize.height());
QGraphicsWebView::resize(pSize.width(), pSize.height()); QGraphicsWebView::resize(pSize.width(), pSize.height());
if (Delegate()) if (Delegate())
Delegate()->positionHandles(); Delegate()->positionHandles();
if (scene()) if (scene())
scene()->setModified(true); scene()->setModified(true);
} }
} }
QSizeF UBGraphicsWidgetItem::size() const QSizeF UBGraphicsWidgetItem::size() const
{ {
return QGraphicsWebView::size(); return QGraphicsWebView::size();
} }
UBGraphicsAppleWidgetItem::UBGraphicsAppleWidgetItem(const QUrl& pWidgetUrl, QGraphicsItem *parent) UBGraphicsAppleWidgetItem::UBGraphicsAppleWidgetItem(const QUrl& pWidgetUrl, QGraphicsItem *parent)

Loading…
Cancel
Save