From bc95a811062791d815203ad499b2014445766b8d Mon Sep 17 00:00:00 2001 From: Donald Carr Date: Thu, 6 May 2010 16:55:50 +0000 Subject: Adjust wolfenqt to use QGraphicsWebView --- mazescene.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/mazescene.cpp b/mazescene.cpp index 2ac0f2c..856e103 100644 --- a/mazescene.cpp +++ b/mazescene.cpp @@ -31,7 +31,10 @@ #include #include #include +#if 0 #include +#endif +#include #include #include @@ -282,13 +285,14 @@ void MazeScene::addWall(const QPointF &a, const QPointF &b, int type) } #endif +#if 0 QGraphicsProxyWidget *proxy = item->childItem(); QWebView *view = proxy ? qobject_cast(proxy->widget()) : 0; if (view) { connect(view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished())); proxy->setVisible(false); } - +#endif item->setVisible(false); addProjectedItem(item); m_walls << item; @@ -544,9 +548,23 @@ WallItem::WallItem(MazeScene *scene, const QPointF &a, const QPointF &b, int typ m_scale = 0.5; } else if (type == 9) { if (a.x() > b.x()) { +#if 0 QWebView *view = new QWebView; view->setUrl(QUrl(QLatin1String("http://www.google.com"))); childWidget = view; +#endif + QGraphicsWebView *view = new QGraphicsWebView(this); + view->setCacheMode(QGraphicsItem::ItemCoordinateCache); + view->setResizesToContents(false); + view->setGeometry(QRectF(0, 0, 800, 600)); + view->setUrl(QUrl(QLatin1String("http://www.google.com"))); + + QRectF rect = view->boundingRect(); + QPointF center = rect.center(); + qreal scale = qMin(m_scale / rect.width(), m_scale / rect.height()); + view->translate(0, -0.05); + view->scale(scale, scale); + view->translate(-center.x(), -center.y()); } } else if (type == 10) { #ifndef QT_NO_OPENGL @@ -802,8 +820,8 @@ bool MazeScene::blocked(const QPointF &pos, Entity *me) const foreach (WallItem *item, m_walls) { if (item->type() == 6 - || item->type() == -1 && m_doorAnimation->state() != QTimeLine::Running - && m_doorAnimation->direction() == QTimeLine::Backward) + || (item->type() == -1 && m_doorAnimation->state() != QTimeLine::Running + && m_doorAnimation->direction() == QTimeLine::Backward)) continue; const QPointF a = item->a(); -- cgit v1.2.3