1231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/* 2231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) 3cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> 4231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 5231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block This library is free software; you can redistribute it and/or 6231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block modify it under the terms of the GNU Library General Public 7231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block License as published by the Free Software Foundation; either 8231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block version 2 of the License, or (at your option) any later version. 9231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 10231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block This library is distributed in the hope that it will be useful, 11231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block but WITHOUT ANY WARRANTY; without even the implied warranty of 12231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Library General Public License for more details. 14231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 15231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block You should have received a copy of the GNU Library General Public License 16231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block along with this library; see the file COPYING.LIB. If not, write to 17231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Boston, MA 02110-1301, USA. 19231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 20231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 21231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "config.h" 22231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "qgraphicswebview.h" 23231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 2465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if !defined(QT_NO_GRAPHICSVIEW) 2565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 26231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "qwebframe.h" 27d0825bca7fe65beaee391d30da42e937db621564Steve Block#include "qwebframe_p.h" 28231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "qwebpage.h" 29231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "qwebpage_p.h" 306c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen#include "PageClientQt.h" 31dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#include "FrameView.h" 32dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#include "GraphicsContext.h" 33dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#include "IntRect.h" 34dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#include "TiledBackingStore.h" 358a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block#include <QtCore/qmetaobject.h> 36d0825bca7fe65beaee391d30da42e937db621564Steve Block#include <QtCore/qsharedpointer.h> 37d0825bca7fe65beaee391d30da42e937db621564Steve Block#include <QtCore/qtimer.h> 38231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include <QtGui/qapplication.h> 39d0825bca7fe65beaee391d30da42e937db621564Steve Block#include <QtGui/qgraphicsscene.h> 40231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include <QtGui/qgraphicssceneevent.h> 41d0825bca7fe65beaee391d30da42e937db621564Steve Block#include <QtGui/qgraphicsview.h> 42d0825bca7fe65beaee391d30da42e937db621564Steve Block#include <QtGui/qpixmapcache.h> 43dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#include <QtGui/qscrollbar.h> 44231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include <QtGui/qstyleoption.h> 45dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#include <QtGui/qinputcontext.h> 46231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#if defined(Q_WS_X11) 47231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include <QX11Info> 48231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#endif 49d0825bca7fe65beaee391d30da42e937db621564Steve Block#include <Settings.h> 50d0825bca7fe65beaee391d30da42e937db621564Steve Block 516c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsenusing namespace WebCore; 52d0825bca7fe65beaee391d30da42e937db621564Steve Block 536c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsenclass QGraphicsWebViewPrivate { 54231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockpublic: 55231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsWebViewPrivate(QGraphicsWebView* parent) 56231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block : q(parent) 57231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block , page(0) 582bde8e466a4451c7319e3a072d118917957d6554Steve Block , resizesToContents(false) 592bde8e466a4451c7319e3a072d118917957d6554Steve Block , renderHints(QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform) {} 60231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 61643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual ~QGraphicsWebViewPrivate(); 62dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 636c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen void syncLayers(); 64dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 65692e5dbf12901edacf14812a6fae25462920af42Steve Block void updateResizesToContentsForPage(); 66d0825bca7fe65beaee391d30da42e937db621564Steve Block 676c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen void detachCurrentPage(); 68dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 69231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block void _q_doLoadFinished(bool success); 70692e5dbf12901edacf14812a6fae25462920af42Steve Block void _q_contentsSizeChanged(const QSize&); 71dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void _q_scaleChanged(); 72dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 73dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void _q_pageDestroyed(); 74231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 75231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsWebView* q; 76231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QWebPage* page; 77692e5dbf12901edacf14812a6fae25462920af42Steve Block bool resizesToContents; 782bde8e466a4451c7319e3a072d118917957d6554Steve Block QPainter::RenderHints renderHints; 79692e5dbf12901edacf14812a6fae25462920af42Steve Block 80a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch QGraphicsItemOverlay* overlay() const 81a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch { 82a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (!page || !page->d->client) 83a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return 0; 84f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch return pageClient()->overlay; 85a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch } 86f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 87f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch PageClientQGraphicsWidget* pageClient() const 88f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch { 89f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch return static_cast<WebCore::PageClientQGraphicsWidget*> (page->d->client.get()); 90f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch } 91231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block}; 92231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 93643ca7872b450ea4efacab6188849e5aac2ba161Steve BlockQGraphicsWebViewPrivate::~QGraphicsWebViewPrivate() 94231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 956c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen detachCurrentPage(); 96dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 97dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 98d0825bca7fe65beaee391d30da42e937db621564Steve Blockvoid QGraphicsWebViewPrivate::syncLayers() 99d0825bca7fe65beaee391d30da42e937db621564Steve Block{ 100d0825bca7fe65beaee391d30da42e937db621564Steve Block#if USE(ACCELERATED_COMPOSITING) 101f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch pageClient()->syncLayers(); 102d0825bca7fe65beaee391d30da42e937db621564Steve Block#endif 103231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 104231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 105231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebViewPrivate::_q_doLoadFinished(bool success) 106231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 107231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block // If the page had no title, still make sure it gets the signal 108231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (q->title().isEmpty()) 109231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block emit q->urlChanged(q->url()); 110231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 111231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block emit q->loadFinished(success); 112231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 113231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 114dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockvoid QGraphicsWebViewPrivate::_q_pageDestroyed() 115dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 116dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block page = 0; 117dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block q->setPage(0); 118dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 119dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 120692e5dbf12901edacf14812a6fae25462920af42Steve Blockvoid QGraphicsWebViewPrivate::updateResizesToContentsForPage() 121692e5dbf12901edacf14812a6fae25462920af42Steve Block{ 122692e5dbf12901edacf14812a6fae25462920af42Steve Block ASSERT(page); 123f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch pageClient()->viewResizesToContents = resizesToContents; 124692e5dbf12901edacf14812a6fae25462920af42Steve Block if (resizesToContents) { 125692e5dbf12901edacf14812a6fae25462920af42Steve Block // resizes to contents mode requires preferred contents size to be set 126692e5dbf12901edacf14812a6fae25462920af42Steve Block if (!page->preferredContentsSize().isValid()) 127692e5dbf12901edacf14812a6fae25462920af42Steve Block page->setPreferredContentsSize(QSize(960, 800)); 128692e5dbf12901edacf14812a6fae25462920af42Steve Block 129692e5dbf12901edacf14812a6fae25462920af42Steve Block QObject::connect(page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), 130692e5dbf12901edacf14812a6fae25462920af42Steve Block q, SLOT(_q_contentsSizeChanged(const QSize&)), Qt::UniqueConnection); 131692e5dbf12901edacf14812a6fae25462920af42Steve Block } else { 132692e5dbf12901edacf14812a6fae25462920af42Steve Block QObject::disconnect(page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), 133692e5dbf12901edacf14812a6fae25462920af42Steve Block q, SLOT(_q_contentsSizeChanged(const QSize&))); 134692e5dbf12901edacf14812a6fae25462920af42Steve Block } 1356b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner page->d->page->mainFrame()->view()->setPaintsEntireContents(resizesToContents); 1364576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang page->d->page->mainFrame()->view()->setDelegatesScrolling(resizesToContents); 137692e5dbf12901edacf14812a6fae25462920af42Steve Block} 138692e5dbf12901edacf14812a6fae25462920af42Steve Block 139692e5dbf12901edacf14812a6fae25462920af42Steve Blockvoid QGraphicsWebViewPrivate::_q_contentsSizeChanged(const QSize& size) 140692e5dbf12901edacf14812a6fae25462920af42Steve Block{ 141692e5dbf12901edacf14812a6fae25462920af42Steve Block if (!resizesToContents) 142692e5dbf12901edacf14812a6fae25462920af42Steve Block return; 143692e5dbf12901edacf14812a6fae25462920af42Steve Block q->setGeometry(QRectF(q->geometry().topLeft(), size)); 144692e5dbf12901edacf14812a6fae25462920af42Steve Block} 145692e5dbf12901edacf14812a6fae25462920af42Steve Block 146dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockvoid QGraphicsWebViewPrivate::_q_scaleChanged() 147dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 148dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#if ENABLE(TILED_BACKING_STORE) 149ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block if (!page) 150ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block return; 151f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch pageClient()->updateTiledBackingStoreScale(); 152dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#endif 153dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 154dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 155231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 156231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \class QGraphicsWebView 157643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \brief The QGraphicsWebView class allows Web content to be added to a GraphicsView. 158231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \since 4.6 159231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 160643ca7872b450ea4efacab6188849e5aac2ba161Steve Block An instance of this class renders Web content from a URL or supplied as data, using 161643ca7872b450ea4efacab6188849e5aac2ba161Steve Block features of the QtWebKit module. 162643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 163643ca7872b450ea4efacab6188849e5aac2ba161Steve Block If the width and height of the item are not set, they will default to 800 and 600, 164643ca7872b450ea4efacab6188849e5aac2ba161Steve Block respectively. If the Web page contents is larger than that, scrollbars will be shown 165643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if not disabled explicitly. 166643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 167643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \section1 Browser Features 168643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 169643ca7872b450ea4efacab6188849e5aac2ba161Steve Block Many of the functions, signals and properties provided by QWebView are also available 170643ca7872b450ea4efacab6188849e5aac2ba161Steve Block for this item, making it simple to adapt existing code to use QGraphicsWebView instead 171643ca7872b450ea4efacab6188849e5aac2ba161Steve Block of QWebView. 172231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 173643ca7872b450ea4efacab6188849e5aac2ba161Steve Block The item uses a QWebPage object to perform the rendering of Web content, and this can 174643ca7872b450ea4efacab6188849e5aac2ba161Steve Block be obtained with the page() function, enabling the document itself to be accessed and 175643ca7872b450ea4efacab6188849e5aac2ba161Steve Block modified. 176643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 177643ca7872b450ea4efacab6188849e5aac2ba161Steve Block As with QWebView, the item records the browsing history using a QWebHistory object, 178643ca7872b450ea4efacab6188849e5aac2ba161Steve Block accessible using the history() function. The QWebSettings object that defines the 179643ca7872b450ea4efacab6188849e5aac2ba161Steve Block configuration of the browser can be obtained with the settings() function, enabling 180643ca7872b450ea4efacab6188849e5aac2ba161Steve Block features like plugin support to be customized for each item. 181643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 182643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \sa QWebView, QGraphicsTextItem 183643ca7872b450ea4efacab6188849e5aac2ba161Steve Block*/ 184643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 185643ca7872b450ea4efacab6188849e5aac2ba161Steve Block/*! 186643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \fn void QGraphicsWebView::titleChanged(const QString &title) 187643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 188643ca7872b450ea4efacab6188849e5aac2ba161Steve Block This signal is emitted whenever the \a title of the main frame changes. 189643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 190643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \sa title() 191643ca7872b450ea4efacab6188849e5aac2ba161Steve Block*/ 192643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 193643ca7872b450ea4efacab6188849e5aac2ba161Steve Block/*! 194643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \fn void QGraphicsWebView::urlChanged(const QUrl &url) 195643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 196643ca7872b450ea4efacab6188849e5aac2ba161Steve Block This signal is emitted when the \a url of the view changes. 197643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 198643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \sa url(), load() 199643ca7872b450ea4efacab6188849e5aac2ba161Steve Block*/ 200643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 201643ca7872b450ea4efacab6188849e5aac2ba161Steve Block/*! 202643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \fn void QGraphicsWebView::iconChanged() 203643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 204643ca7872b450ea4efacab6188849e5aac2ba161Steve Block This signal is emitted whenever the icon of the page is loaded or changes. 205643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 206643ca7872b450ea4efacab6188849e5aac2ba161Steve Block In order for icons to be loaded, you will need to set an icon database path 207643ca7872b450ea4efacab6188849e5aac2ba161Steve Block using QWebSettings::setIconDatabasePath(). 208643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 209643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \sa icon(), QWebSettings::setIconDatabasePath() 210643ca7872b450ea4efacab6188849e5aac2ba161Steve Block*/ 211643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 212643ca7872b450ea4efacab6188849e5aac2ba161Steve Block/*! 213643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \fn void QGraphicsWebView::loadStarted() 214643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 215643ca7872b450ea4efacab6188849e5aac2ba161Steve Block This signal is emitted when a new load of the page is started. 216643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 217643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \sa loadProgress(), loadFinished() 218643ca7872b450ea4efacab6188849e5aac2ba161Steve Block*/ 219643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 220643ca7872b450ea4efacab6188849e5aac2ba161Steve Block/*! 221643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \fn void QGraphicsWebView::loadFinished(bool ok) 222643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 223643ca7872b450ea4efacab6188849e5aac2ba161Steve Block This signal is emitted when a load of the page is finished. 224643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \a ok will indicate whether the load was successful or any error occurred. 225643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 226643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \sa loadStarted() 227231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 228231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 229231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 230231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Constructs an empty QGraphicsWebView with parent \a parent. 231231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 232231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \sa load() 233231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 234231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockQGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent) 235231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block : QGraphicsWidget(parent) 236231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block , d(new QGraphicsWebViewPrivate(this)) 237231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 238231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true); 239643ca7872b450ea4efacab6188849e5aac2ba161Steve Block setAcceptDrops(true); 240231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block setAcceptHoverEvents(true); 241d0825bca7fe65beaee391d30da42e937db621564Steve Block setAcceptTouchEvents(true); 242231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block setFocusPolicy(Qt::StrongFocus); 243d0825bca7fe65beaee391d30da42e937db621564Steve Block setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); 244dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#if ENABLE(TILED_BACKING_STORE) 245dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block QObject::connect(this, SIGNAL(scaleChanged()), this, SLOT(_q_scaleChanged())); 246dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#endif 247231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 248231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 249231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 250643ca7872b450ea4efacab6188849e5aac2ba161Steve Block Destroys the item. 251231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 252231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockQGraphicsWebView::~QGraphicsWebView() 253231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 254231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block delete d; 255231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 256231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 257231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 258231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Returns a pointer to the underlying web page. 259231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 260231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \sa setPage() 261231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 262231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockQWebPage* QGraphicsWebView::page() const 263231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 264231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!d->page) { 265231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsWebView* that = const_cast<QGraphicsWebView*>(this); 266231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QWebPage* page = new QWebPage(that); 267231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 268231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block // Default to not having a background, in the case 269231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block // the page doesn't provide one. 270231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QPalette palette = QApplication::palette(); 271231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block palette.setBrush(QPalette::Base, QColor::fromRgbF(0, 0, 0, 0)); 272231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block page->setPalette(palette); 273231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 274231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block that->setPage(page); 275231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 276231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 277231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return d->page; 278231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 279231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 280231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 281231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 282231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget*) 283231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 2842bde8e466a4451c7319e3a072d118917957d6554Steve Block QPainter::RenderHints oldHints = painter->renderHints(); 2852bde8e466a4451c7319e3a072d118917957d6554Steve Block painter->setRenderHints(oldHints | d->renderHints); 286dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#if ENABLE(TILED_BACKING_STORE) 287dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block if (WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page()->mainFrame())->tiledBackingStore()) { 288dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // FIXME: We should set the backing store viewport earlier than in paint 2896c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen backingStore->adjustVisibleRect(); 290dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // QWebFrame::render is a public API, bypass it for tiled rendering so behavior does not need to change. 291dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block WebCore::GraphicsContext context(painter); 292dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block page()->mainFrame()->d->renderFromTiledBackingStore(&context, option->exposedRect.toAlignedRect()); 2932bde8e466a4451c7319e3a072d118917957d6554Steve Block painter->setRenderHints(oldHints); 294dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return; 295dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block } 296dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#endif 297a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if USE(ACCELERATED_COMPOSITING) && !USE(TEXTURE_MAPPER) 298a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch page()->mainFrame()->render(painter, d->overlay() ? QWebFrame::ContentsLayer : QWebFrame::AllLayers, option->exposedRect.toAlignedRect()); 299d0825bca7fe65beaee391d30da42e937db621564Steve Block#else 300d0825bca7fe65beaee391d30da42e937db621564Steve Block page()->mainFrame()->render(painter, QWebFrame::AllLayers, option->exposedRect.toRect()); 301d0825bca7fe65beaee391d30da42e937db621564Steve Block#endif 3022bde8e466a4451c7319e3a072d118917957d6554Steve Block painter->setRenderHints(oldHints); 303231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 304231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 305231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 306231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 307231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockbool QGraphicsWebView::sceneEvent(QEvent* event) 308231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 309231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block // Re-implemented in order to allows fixing event-related bugs in patch releases. 310d0825bca7fe65beaee391d30da42e937db621564Steve Block 311d0825bca7fe65beaee391d30da42e937db621564Steve Block if (d->page && (event->type() == QEvent::TouchBegin 312d0825bca7fe65beaee391d30da42e937db621564Steve Block || event->type() == QEvent::TouchEnd 313d0825bca7fe65beaee391d30da42e937db621564Steve Block || event->type() == QEvent::TouchUpdate)) { 314d0825bca7fe65beaee391d30da42e937db621564Steve Block d->page->event(event); 3150617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen 3160617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen // Always return true so that we'll receive also TouchUpdate and TouchEnd events 3170617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen return true; 318d0825bca7fe65beaee391d30da42e937db621564Steve Block } 319d0825bca7fe65beaee391d30da42e937db621564Steve Block 320231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return QGraphicsWidget::sceneEvent(event); 321231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 322231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 323231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 324231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 325cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve BlockQVariant QGraphicsWebView::itemChange(GraphicsItemChange change, const QVariant& value) 326cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block{ 327cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block switch (change) { 328cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block // Differently from QWebView, it is interesting to QGraphicsWebView to handle 329cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block // post mouse cursor change notifications. Reason: 'ItemCursorChange' is sent 330cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block // as the first action in QGraphicsItem::setCursor implementation, and at that 331cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block // item widget's cursor has not been effectively changed yet. 332cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block // After cursor is properly set (at 'ItemCursorHasChanged' emission time), we 333cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block // fire 'CursorChange'. 334cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block case ItemCursorChange: 335cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block return value; 33621939df44de1705786c545cd1bf519d47250322dBen Murdoch case ItemCursorHasChanged: { 33721939df44de1705786c545cd1bf519d47250322dBen Murdoch QEvent event(QEvent::CursorChange); 33821939df44de1705786c545cd1bf519d47250322dBen Murdoch QApplication::sendEvent(this, &event); 33921939df44de1705786c545cd1bf519d47250322dBen Murdoch return value; 34021939df44de1705786c545cd1bf519d47250322dBen Murdoch } 34121939df44de1705786c545cd1bf519d47250322dBen Murdoch default: 34221939df44de1705786c545cd1bf519d47250322dBen Murdoch break; 343cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block } 344cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block 345cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block return QGraphicsWidget::itemChange(change, value); 346cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block} 347cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block 348cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block/*! \reimp 349cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block*/ 350643ca7872b450ea4efacab6188849e5aac2ba161Steve BlockQSizeF QGraphicsWebView::sizeHint(Qt::SizeHint which, const QSizeF& constraint) const 351643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{ 352643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (which == Qt::PreferredSize) 353643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return QSizeF(800, 600); // ### 354643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return QGraphicsWidget::sizeHint(which, constraint); 355643ca7872b450ea4efacab6188849e5aac2ba161Steve Block} 356643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 357643ca7872b450ea4efacab6188849e5aac2ba161Steve Block/*! \reimp 358643ca7872b450ea4efacab6188849e5aac2ba161Steve Block*/ 359643ca7872b450ea4efacab6188849e5aac2ba161Steve BlockQVariant QGraphicsWebView::inputMethodQuery(Qt::InputMethodQuery query) const 360643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{ 361643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) 362643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return d->page->inputMethodQuery(query); 363643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return QVariant(); 364643ca7872b450ea4efacab6188849e5aac2ba161Steve Block} 365643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 3662bde8e466a4451c7319e3a072d118917957d6554Steve Block/*! 3672bde8e466a4451c7319e3a072d118917957d6554Steve Block \property QGraphicsWebView::renderHints 3682bde8e466a4451c7319e3a072d118917957d6554Steve Block \since 4.8 3692bde8e466a4451c7319e3a072d118917957d6554Steve Block \brief the default render hints for the view 3702bde8e466a4451c7319e3a072d118917957d6554Steve Block 3712bde8e466a4451c7319e3a072d118917957d6554Steve Block These hints are used to initialize QPainter before painting the Web page. 3722bde8e466a4451c7319e3a072d118917957d6554Steve Block 3732bde8e466a4451c7319e3a072d118917957d6554Steve Block QPainter::TextAntialiasing and QPainter::SmoothPixmapTransform are enabled by default and will be 3742bde8e466a4451c7319e3a072d118917957d6554Steve Block used to render the item in addition of what has been set on the painter given by QGraphicsScene. 3752bde8e466a4451c7319e3a072d118917957d6554Steve Block 3762bde8e466a4451c7319e3a072d118917957d6554Steve Block \note This property is not available on Symbian. However, the getter and 3772bde8e466a4451c7319e3a072d118917957d6554Steve Block setter functions can still be used directly. 3782bde8e466a4451c7319e3a072d118917957d6554Steve Block 3792bde8e466a4451c7319e3a072d118917957d6554Steve Block \sa QPainter::renderHints() 3802bde8e466a4451c7319e3a072d118917957d6554Steve Block*/ 3812bde8e466a4451c7319e3a072d118917957d6554Steve Block 3822bde8e466a4451c7319e3a072d118917957d6554Steve Block/*! 3832bde8e466a4451c7319e3a072d118917957d6554Steve Block \since 4.8 3842bde8e466a4451c7319e3a072d118917957d6554Steve Block Returns the render hints used by the view to render content. 3852bde8e466a4451c7319e3a072d118917957d6554Steve Block 3862bde8e466a4451c7319e3a072d118917957d6554Steve Block \sa QPainter::renderHints() 3872bde8e466a4451c7319e3a072d118917957d6554Steve Block*/ 3882bde8e466a4451c7319e3a072d118917957d6554Steve BlockQPainter::RenderHints QGraphicsWebView::renderHints() const 3892bde8e466a4451c7319e3a072d118917957d6554Steve Block{ 3902bde8e466a4451c7319e3a072d118917957d6554Steve Block return d->renderHints; 3912bde8e466a4451c7319e3a072d118917957d6554Steve Block} 3922bde8e466a4451c7319e3a072d118917957d6554Steve Block 3932bde8e466a4451c7319e3a072d118917957d6554Steve Block/*! 3942bde8e466a4451c7319e3a072d118917957d6554Steve Block \since 4.8 3952bde8e466a4451c7319e3a072d118917957d6554Steve Block Sets the render hints used by the view to the specified \a hints. 3962bde8e466a4451c7319e3a072d118917957d6554Steve Block 3972bde8e466a4451c7319e3a072d118917957d6554Steve Block \sa QPainter::setRenderHints() 3982bde8e466a4451c7319e3a072d118917957d6554Steve Block*/ 3992bde8e466a4451c7319e3a072d118917957d6554Steve Blockvoid QGraphicsWebView::setRenderHints(QPainter::RenderHints hints) 4002bde8e466a4451c7319e3a072d118917957d6554Steve Block{ 4012bde8e466a4451c7319e3a072d118917957d6554Steve Block if (hints == d->renderHints) 4022bde8e466a4451c7319e3a072d118917957d6554Steve Block return; 4032bde8e466a4451c7319e3a072d118917957d6554Steve Block d->renderHints = hints; 4042bde8e466a4451c7319e3a072d118917957d6554Steve Block update(); 4052bde8e466a4451c7319e3a072d118917957d6554Steve Block} 4062bde8e466a4451c7319e3a072d118917957d6554Steve Block 4072bde8e466a4451c7319e3a072d118917957d6554Steve Block/*! 4082bde8e466a4451c7319e3a072d118917957d6554Steve Block \since 4.8 4092bde8e466a4451c7319e3a072d118917957d6554Steve Block If \a enabled is true, enables the specified render \a hint; otherwise 4102bde8e466a4451c7319e3a072d118917957d6554Steve Block disables it. 4112bde8e466a4451c7319e3a072d118917957d6554Steve Block 4122bde8e466a4451c7319e3a072d118917957d6554Steve Block \sa renderHints, QPainter::renderHints() 4132bde8e466a4451c7319e3a072d118917957d6554Steve Block*/ 4142bde8e466a4451c7319e3a072d118917957d6554Steve Blockvoid QGraphicsWebView::setRenderHint(QPainter::RenderHint hint, bool enabled) 4152bde8e466a4451c7319e3a072d118917957d6554Steve Block{ 4162bde8e466a4451c7319e3a072d118917957d6554Steve Block QPainter::RenderHints oldHints = d->renderHints; 4172bde8e466a4451c7319e3a072d118917957d6554Steve Block if (enabled) 4182bde8e466a4451c7319e3a072d118917957d6554Steve Block d->renderHints |= hint; 4192bde8e466a4451c7319e3a072d118917957d6554Steve Block else 4202bde8e466a4451c7319e3a072d118917957d6554Steve Block d->renderHints &= ~hint; 4212bde8e466a4451c7319e3a072d118917957d6554Steve Block if (oldHints != d->renderHints) 4222bde8e466a4451c7319e3a072d118917957d6554Steve Block update(); 4232bde8e466a4451c7319e3a072d118917957d6554Steve Block} 4242bde8e466a4451c7319e3a072d118917957d6554Steve Block 425643ca7872b450ea4efacab6188849e5aac2ba161Steve Block/*! \reimp 426643ca7872b450ea4efacab6188849e5aac2ba161Steve Block*/ 427231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockbool QGraphicsWebView::event(QEvent* event) 428231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 429231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block // Re-implemented in order to allows fixing event-related bugs in patch releases. 430231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 431231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (d->page) { 43281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch if (event->type() == QEvent::PaletteChange) 43381bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch d->page->setPalette(palette()); 434cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block#ifndef QT_NO_CONTEXTMENU 435cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block if (event->type() == QEvent::GraphicsSceneContextMenu) { 436cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block if (!isEnabled()) 437cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block return false; 438cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block 439cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block QGraphicsSceneContextMenuEvent* ev = static_cast<QGraphicsSceneContextMenuEvent*>(event); 440cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block QContextMenuEvent fakeEvent(QContextMenuEvent::Reason(ev->reason()), ev->pos().toPoint()); 441cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block if (d->page->swallowContextMenuEvent(&fakeEvent)) { 442cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block event->accept(); 443cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block return true; 444cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block } 445cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block d->page->updatePositionDependentActions(fakeEvent.pos()); 446cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block } else 447cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block#endif // QT_NO_CONTEXTMENU 448cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block { 449231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#ifndef QT_NO_CURSOR 450cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block if (event->type() == QEvent::CursorChange) { 451cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block // An unsetCursor will set the cursor to Qt::ArrowCursor. 452cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block // Thus this cursor change might be a QWidget::unsetCursor() 453cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block // If this is not the case and it came from WebCore, the 454cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block // QWebPageClient already has set its cursor internally 455cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block // to Qt::ArrowCursor, so updating the cursor is always 456cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block // right, as it falls back to the last cursor set by 457cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block // WebCore. 458cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block // FIXME: Add a QEvent::CursorUnset or similar to Qt. 459cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block if (cursor().shape() == Qt::ArrowCursor) 4606c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen d->page->d->client->resetCursor(); 461cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block } 462231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#endif 463cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block } 464231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 465231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return QGraphicsWidget::event(event); 466231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 467231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 4686c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsenvoid QGraphicsWebViewPrivate::detachCurrentPage() 469dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 470dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block if (!page) 471dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return; 472dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 4736c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen page->d->view.clear(); 474dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block page->d->client = 0; 475dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 476dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // if the page was created by us, we own it and need to 477dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // destroy it as well. 478dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 479dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block if (page->parent() == q) 480dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block delete page; 481dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block else 482dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block page->disconnect(q); 4836c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen 4846c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen page = 0; 485dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 486dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 487231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 488231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Makes \a page the new web page of the web graphicsitem. 489231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 490231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block The parent QObject of the provided page remains the owner 491231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block of the object. If the current document is a child of the web 492231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block view, it will be deleted. 493231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 494231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \sa page() 495231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 496231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::setPage(QWebPage* page) 497231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 498231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (d->page == page) 499231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return; 500231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 5016c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen d->detachCurrentPage(); 502231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page = page; 503dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 504231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!d->page) 505231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return; 506dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 5076c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen d->page->d->client = new PageClientQGraphicsWidget(this, page); // set the page client 508dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 509a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (d->overlay()) 510a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch d->overlay()->prepareGraphicsItemGeometryChange(); 511231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 512231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QSize size = geometry().size().toSize(); 513231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block page->setViewportSize(size); 514dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 515692e5dbf12901edacf14812a6fae25462920af42Steve Block if (d->resizesToContents) 516692e5dbf12901edacf14812a6fae25462920af42Steve Block d->updateResizesToContentsForPage(); 517231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 518231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QWebFrame* mainFrame = d->page->mainFrame(); 519231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 520643ca7872b450ea4efacab6188849e5aac2ba161Steve Block connect(mainFrame, SIGNAL(titleChanged(QString)), 521643ca7872b450ea4efacab6188849e5aac2ba161Steve Block this, SIGNAL(titleChanged(QString))); 522231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block connect(mainFrame, SIGNAL(iconChanged()), 523231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block this, SIGNAL(iconChanged())); 524643ca7872b450ea4efacab6188849e5aac2ba161Steve Block connect(mainFrame, SIGNAL(urlChanged(QUrl)), 525643ca7872b450ea4efacab6188849e5aac2ba161Steve Block this, SIGNAL(urlChanged(QUrl))); 526231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block connect(d->page, SIGNAL(loadStarted()), 527231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block this, SIGNAL(loadStarted())); 528231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block connect(d->page, SIGNAL(loadProgress(int)), 529643ca7872b450ea4efacab6188849e5aac2ba161Steve Block this, SIGNAL(loadProgress(int))); 530231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block connect(d->page, SIGNAL(loadFinished(bool)), 531231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block this, SLOT(_q_doLoadFinished(bool))); 532643ca7872b450ea4efacab6188849e5aac2ba161Steve Block connect(d->page, SIGNAL(statusBarMessage(QString)), 533643ca7872b450ea4efacab6188849e5aac2ba161Steve Block this, SIGNAL(statusBarMessage(QString))); 534643ca7872b450ea4efacab6188849e5aac2ba161Steve Block connect(d->page, SIGNAL(linkClicked(QUrl)), 535643ca7872b450ea4efacab6188849e5aac2ba161Steve Block this, SIGNAL(linkClicked(QUrl))); 536dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block connect(d->page, SIGNAL(destroyed()), 537dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block this, SLOT(_q_pageDestroyed())); 538f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) 539f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick connect(d->page, SIGNAL(microFocusChanged()), 54081bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch this, SLOT(updateMicroFocus())); 541f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick#endif 542231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 543231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 544231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 545231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \property QGraphicsWebView::url 546231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \brief the url of the web page currently viewed 547231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 548231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Setting this property clears the view and loads the URL. 549231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 550231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block By default, this property contains an empty, invalid URL. 551231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 552231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \sa load(), urlChanged() 553231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 554231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 555231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::setUrl(const QUrl &url) 556231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 557231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block page()->mainFrame()->setUrl(url); 558231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 559231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 560231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockQUrl QGraphicsWebView::url() const 561231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 562231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (d->page) 563231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return d->page->mainFrame()->url(); 564231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 565231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return QUrl(); 566231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 567231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 568231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 569231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \property QGraphicsWebView::title 570231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \brief the title of the web page currently viewed 571231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 572231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block By default, this property contains an empty string. 573231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 574231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \sa titleChanged() 575231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 576231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockQString QGraphicsWebView::title() const 577231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 578231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (d->page) 579231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return d->page->mainFrame()->title(); 580231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 581231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return QString(); 582231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 583231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 584231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 585231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \property QGraphicsWebView::icon 586231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \brief the icon associated with the web page currently viewed 587231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 588231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block By default, this property contains a null icon. 589231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 590231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \sa iconChanged(), QWebSettings::iconForUrl() 591231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 592231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockQIcon QGraphicsWebView::icon() const 593231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 594231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (d->page) 595231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return d->page->mainFrame()->icon(); 596231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 597231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return QIcon(); 598231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 599231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 600231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 601231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \property QGraphicsWebView::zoomFactor 602231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \brief the zoom factor for the view 603231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 604231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 605231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::setZoomFactor(qreal factor) 606231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 607231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (factor == page()->mainFrame()->zoomFactor()) 608231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return; 609231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 610231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block page()->mainFrame()->setZoomFactor(factor); 611231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 612231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 613231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockqreal QGraphicsWebView::zoomFactor() const 614231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 615231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return page()->mainFrame()->zoomFactor(); 616231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 617231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 618231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 619231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 620231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::updateGeometry() 621231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 622a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (d->overlay()) 623a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch d->overlay()->prepareGraphicsItemGeometryChange(); 624d0825bca7fe65beaee391d30da42e937db621564Steve Block 625231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsWidget::updateGeometry(); 626231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 627231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!d->page) 628231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return; 629231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 630231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QSize size = geometry().size().toSize(); 631231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->setViewportSize(size); 632231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 633231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 634231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 635231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 636231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::setGeometry(const QRectF& rect) 637231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 638231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsWidget::setGeometry(rect); 639231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 640a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (d->overlay()) 641a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch d->overlay()->prepareGraphicsItemGeometryChange(); 642d0825bca7fe65beaee391d30da42e937db621564Steve Block 643231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!d->page) 644231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return; 645231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 646231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block // NOTE: call geometry() as setGeometry ensures that 647231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block // the geometry is within legal bounds (minimumSize, maximumSize) 648231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QSize size = geometry().size().toSize(); 649231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->setViewportSize(size); 650231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 651231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 652231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 653231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Convenience slot that stops loading the document. 654231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 655231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \sa reload(), loadFinished() 656231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 657231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::stop() 658231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 659231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (d->page) 660231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->triggerAction(QWebPage::Stop); 661231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 662231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 663231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 664231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Convenience slot that loads the previous document in the list of documents 665231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block built by navigating links. Does nothing if there is no previous document. 666231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 667231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \sa forward() 668231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 669231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::back() 670231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 671231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (d->page) 672231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->triggerAction(QWebPage::Back); 673231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 674231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 675231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 676231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Convenience slot that loads the next document in the list of documents 677231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block built by navigating links. Does nothing if there is no next document. 678231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 679231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \sa back() 680231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 681231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::forward() 682231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 683231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (d->page) 684231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->triggerAction(QWebPage::Forward); 685231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 686231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 687231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 688231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Reloads the current document. 689231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 690231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \sa stop(), loadStarted() 691231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 692231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::reload() 693231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 694231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (d->page) 695231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->triggerAction(QWebPage::Reload); 696231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 697231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 698231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 699231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Loads the specified \a url and displays it. 700231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 701231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \note The view remains the same until enough data has arrived to display the new \a url. 702231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 703231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \sa setUrl(), url(), urlChanged() 704231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 705231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::load(const QUrl& url) 706231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 707231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block page()->mainFrame()->load(url); 708231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 709231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 710231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 711231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \fn void QGraphicsWebView::load(const QNetworkRequest &request, QNetworkAccessManager::Operation operation, const QByteArray &body) 712231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 713231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Loads a network request, \a request, using the method specified in \a operation. 714231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 715231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \a body is optional and is only used for POST operations. 716231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 717231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \note The view remains the same until enough data has arrived to display the new url. 718231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 719231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \sa url(), urlChanged() 720231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 721231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 722231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::load(const QNetworkRequest& request, 723231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QNetworkAccessManager::Operation operation, 724231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const QByteArray& body) 725231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 726231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block page()->mainFrame()->load(request, operation, body); 727231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 728231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 729231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 730643ca7872b450ea4efacab6188849e5aac2ba161Steve Block Sets the content of the web view to the specified \a html. 731231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 732643ca7872b450ea4efacab6188849e5aac2ba161Steve Block External objects such as stylesheets or images referenced in the HTML 733643ca7872b450ea4efacab6188849e5aac2ba161Steve Block document are located relative to \a baseUrl. 734231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 735231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block The \a html is loaded immediately; external objects are loaded asynchronously. 736231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 737643ca7872b450ea4efacab6188849e5aac2ba161Steve Block When using this method, WebKit assumes that external resources such as 738231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JavaScript programs or style sheets are encoded in UTF-8 unless otherwise 739231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block specified. For example, the encoding of an external script can be specified 740231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block through the charset attribute of the HTML script tag. Alternatively, the 741231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block encoding can also be specified by the web server. 742231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 743db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block This is a convenience function equivalent to setContent(html, "text/html", baseUrl). 744db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block 745db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block \warning This function works only for HTML, for other mime types (i.e. XHTML, SVG) 746db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block setContent() should be used instead. 747db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block 748db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block \sa load(), setContent(), QWebFrame::toHtml(), QWebFrame::setContent() 749231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 750231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::setHtml(const QString& html, const QUrl& baseUrl) 751231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 752231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block page()->mainFrame()->setHtml(html, baseUrl); 753231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 754231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 755231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 756231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Sets the content of the web graphicsitem to the specified content \a data. If the \a mimeType argument 757231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block is empty it is currently assumed that the content is HTML but in future versions we may introduce 758231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block auto-detection. 759231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 760231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block External objects referenced in the content are located relative to \a baseUrl. 761231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 762231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block The \a data is loaded immediately; external objects are loaded asynchronously. 763231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 764231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \sa load(), setHtml(), QWebFrame::toHtml() 765231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 766231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::setContent(const QByteArray& data, const QString& mimeType, const QUrl& baseUrl) 767231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 768231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block page()->mainFrame()->setContent(data, mimeType, baseUrl); 769231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 770231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 771231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 772231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Returns a pointer to the view's history of navigated web pages. 773231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 774231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block It is equivalent to 775231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 776231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 0 777231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 778231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockQWebHistory* QGraphicsWebView::history() const 779231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 780231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return page()->history(); 781231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 782231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 783231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 784643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \property QGraphicsWebView::modified 785643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \brief whether the document was modified by the user 786231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 787643ca7872b450ea4efacab6188849e5aac2ba161Steve Block Parts of HTML documents can be editable for example through the 788643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \c{contenteditable} attribute on HTML elements. 789231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 790643ca7872b450ea4efacab6188849e5aac2ba161Steve Block By default, this property is false. 791643ca7872b450ea4efacab6188849e5aac2ba161Steve Block*/ 792643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockbool QGraphicsWebView::isModified() const 793231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 794643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) 795643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return d->page->isModified(); 796643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return false; 797231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 798231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 799231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! 800231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Returns a pointer to the view/page specific settings object. 801231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 802231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block It is equivalent to 803231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 804231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 1 805231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 806231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block \sa QWebSettings::globalSettings() 807231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 808231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockQWebSettings* QGraphicsWebView::settings() const 809231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 810231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return page()->settings(); 811231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 812231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 813643ca7872b450ea4efacab6188849e5aac2ba161Steve Block/*! 814643ca7872b450ea4efacab6188849e5aac2ba161Steve Block Returns a pointer to a QAction that encapsulates the specified web action \a action. 815643ca7872b450ea4efacab6188849e5aac2ba161Steve Block*/ 816643ca7872b450ea4efacab6188849e5aac2ba161Steve BlockQAction *QGraphicsWebView::pageAction(QWebPage::WebAction action) const 817643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{ 818dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#ifdef QT_NO_ACTION 819dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block Q_UNUSED(action) 820dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return 0; 821dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#else 822643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return page()->action(action); 823dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#endif 824643ca7872b450ea4efacab6188849e5aac2ba161Steve Block} 825643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 826643ca7872b450ea4efacab6188849e5aac2ba161Steve Block/*! 827643ca7872b450ea4efacab6188849e5aac2ba161Steve Block Triggers the specified \a action. If it is a checkable action the specified 828643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \a checked state is assumed. 829643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 830643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \sa pageAction() 831643ca7872b450ea4efacab6188849e5aac2ba161Steve Block*/ 832643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid QGraphicsWebView::triggerPageAction(QWebPage::WebAction action, bool checked) 833643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{ 834643ca7872b450ea4efacab6188849e5aac2ba161Steve Block page()->triggerAction(action, checked); 835643ca7872b450ea4efacab6188849e5aac2ba161Steve Block} 836643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 837643ca7872b450ea4efacab6188849e5aac2ba161Steve Block/*! 838643ca7872b450ea4efacab6188849e5aac2ba161Steve Block Finds the specified string, \a subString, in the page, using the given \a options. 839643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 840643ca7872b450ea4efacab6188849e5aac2ba161Steve Block If the HighlightAllOccurrences flag is passed, the function will highlight all occurrences 841643ca7872b450ea4efacab6188849e5aac2ba161Steve Block that exist in the page. All subsequent calls will extend the highlight, rather than 842643ca7872b450ea4efacab6188849e5aac2ba161Steve Block replace it, with occurrences of the new string. 843643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 844643ca7872b450ea4efacab6188849e5aac2ba161Steve Block If the HighlightAllOccurrences flag is not passed, the function will select an occurrence 845643ca7872b450ea4efacab6188849e5aac2ba161Steve Block and all subsequent calls will replace the current occurrence with the next one. 846643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 847643ca7872b450ea4efacab6188849e5aac2ba161Steve Block To clear the selection, just pass an empty string. 848643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 849643ca7872b450ea4efacab6188849e5aac2ba161Steve Block Returns true if \a subString was found; otherwise returns false. 850643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 851643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \sa QWebPage::selectedText(), QWebPage::selectionChanged() 852643ca7872b450ea4efacab6188849e5aac2ba161Steve Block*/ 853643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockbool QGraphicsWebView::findText(const QString &subString, QWebPage::FindFlags options) 854643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{ 855643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) 856643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return d->page->findText(subString, options); 857643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return false; 858643ca7872b450ea4efacab6188849e5aac2ba161Steve Block} 859643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 860692e5dbf12901edacf14812a6fae25462920af42Steve Block/*! 861692e5dbf12901edacf14812a6fae25462920af42Steve Block \property QGraphicsWebView::resizesToContents 862692e5dbf12901edacf14812a6fae25462920af42Steve Block \brief whether the size of the QGraphicsWebView and its viewport changes to match the contents size 863692e5dbf12901edacf14812a6fae25462920af42Steve Block \since 4.7 864692e5dbf12901edacf14812a6fae25462920af42Steve Block 865692e5dbf12901edacf14812a6fae25462920af42Steve Block If this property is set, the QGraphicsWebView will automatically change its 866692e5dbf12901edacf14812a6fae25462920af42Steve Block size to match the size of the main frame contents. As a result the top level frame 867dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block will never have scrollbars. It will also make CSS fixed positioning to behave like absolute positioning 868dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block with elements positioned relative to the document instead of the viewport. 869692e5dbf12901edacf14812a6fae25462920af42Steve Block 870692e5dbf12901edacf14812a6fae25462920af42Steve Block This property should be used in conjunction with the QWebPage::preferredContentsSize property. 871692e5dbf12901edacf14812a6fae25462920af42Steve Block If not explicitly set, the preferredContentsSize is automatically set to a reasonable value. 872692e5dbf12901edacf14812a6fae25462920af42Steve Block 873dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block \sa QWebPage::setPreferredContentsSize() 874692e5dbf12901edacf14812a6fae25462920af42Steve Block*/ 875692e5dbf12901edacf14812a6fae25462920af42Steve Blockvoid QGraphicsWebView::setResizesToContents(bool enabled) 876692e5dbf12901edacf14812a6fae25462920af42Steve Block{ 877692e5dbf12901edacf14812a6fae25462920af42Steve Block if (d->resizesToContents == enabled) 878692e5dbf12901edacf14812a6fae25462920af42Steve Block return; 879692e5dbf12901edacf14812a6fae25462920af42Steve Block d->resizesToContents = enabled; 88006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen if (d->page) 881692e5dbf12901edacf14812a6fae25462920af42Steve Block d->updateResizesToContentsForPage(); 882692e5dbf12901edacf14812a6fae25462920af42Steve Block} 883692e5dbf12901edacf14812a6fae25462920af42Steve Block 884692e5dbf12901edacf14812a6fae25462920af42Steve Blockbool QGraphicsWebView::resizesToContents() const 885692e5dbf12901edacf14812a6fae25462920af42Steve Block{ 886692e5dbf12901edacf14812a6fae25462920af42Steve Block return d->resizesToContents; 887692e5dbf12901edacf14812a6fae25462920af42Steve Block} 888692e5dbf12901edacf14812a6fae25462920af42Steve Block 889dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block/*! 890dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block \property QGraphicsWebView::tiledBackingStoreFrozen 891dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block \brief whether the tiled backing store updates its contents 892dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block \since 4.7 893dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 894dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block If the tiled backing store is enabled using QWebSettings::TiledBackingStoreEnabled attribute, this property 895dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block can be used to disable backing store updates temporarily. This can be useful for example for running 896dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block a smooth animation that changes the scale of the QGraphicsWebView. 897dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 898dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block When the backing store is unfrozen, its contents will be automatically updated to match the current 899dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block state of the document. If the QGraphicsWebView scale was changed, the backing store is also 900dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block re-rendered using the new scale. 901dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 902dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block If the tiled backing store is not enabled, this property does nothing. 903dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 904dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block \sa QWebSettings::TiledBackingStoreEnabled 905dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block \sa QGraphicsObject::scale 906dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block*/ 907dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockbool QGraphicsWebView::isTiledBackingStoreFrozen() const 908dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 909dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#if ENABLE(TILED_BACKING_STORE) 910dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page()->mainFrame())->tiledBackingStore(); 911dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block if (!backingStore) 912dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return false; 913dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return backingStore->contentsFrozen(); 914dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#else 915dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return false; 916dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#endif 917dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 918dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 919dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockvoid QGraphicsWebView::setTiledBackingStoreFrozen(bool frozen) 920dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 921dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#if ENABLE(TILED_BACKING_STORE) 922dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page()->mainFrame())->tiledBackingStore(); 923dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block if (!backingStore) 924dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return; 925dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block backingStore->setContentsFrozen(frozen); 926dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#else 927dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block UNUSED_PARAM(frozen); 928dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#endif 929dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 930dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 931231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 932231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 933231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::hoverMoveEvent(QGraphicsSceneHoverEvent* ev) 934231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 935643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) { 936231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const bool accepted = ev->isAccepted(); 937231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QMouseEvent me = QMouseEvent(QEvent::MouseMove, 938231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ev->pos().toPoint(), Qt::NoButton, 939231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Qt::NoButton, Qt::NoModifier); 940231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->event(&me); 941231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ev->setAccepted(accepted); 942231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 943231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 944231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!ev->isAccepted()) 945231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsItem::hoverMoveEvent(ev); 946231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 947231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 948231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 949231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 950231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::hoverLeaveEvent(QGraphicsSceneHoverEvent* ev) 951231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 952231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Q_UNUSED(ev); 953231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 954231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 955231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 956231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 957231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent* ev) 958231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 959643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) { 960231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const bool accepted = ev->isAccepted(); 961231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->event(ev); 962231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ev->setAccepted(accepted); 963231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 964231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 965231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!ev->isAccepted()) 966231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsItem::mouseMoveEvent(ev); 967231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 968231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 969231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 970231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 971231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent* ev) 972231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 973643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) { 974231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const bool accepted = ev->isAccepted(); 975231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->event(ev); 976231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ev->setAccepted(accepted); 977231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 978231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 979231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!ev->isAccepted()) 980231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsItem::mousePressEvent(ev); 981231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 982231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 983231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 984231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 985231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) 986231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 987643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) { 988231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const bool accepted = ev->isAccepted(); 989231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->event(ev); 990231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ev->setAccepted(accepted); 991231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 992231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 993231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!ev->isAccepted()) 994231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsItem::mouseReleaseEvent(ev); 995231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 996231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 997231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 998231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 999231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* ev) 1000231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1001643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) { 1002231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const bool accepted = ev->isAccepted(); 1003231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->event(ev); 1004231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ev->setAccepted(accepted); 1005231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 1006231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1007231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!ev->isAccepted()) 1008231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsItem::mouseDoubleClickEvent(ev); 1009231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1010231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1011231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 1012231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 1013231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::keyPressEvent(QKeyEvent* ev) 1014231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1015643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) 1016231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->event(ev); 1017231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1018231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!ev->isAccepted()) 1019231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsItem::keyPressEvent(ev); 1020231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1021231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1022231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 1023231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 1024231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::keyReleaseEvent(QKeyEvent* ev) 1025231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1026643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) 1027231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->event(ev); 1028231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1029231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!ev->isAccepted()) 1030231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsItem::keyReleaseEvent(ev); 1031231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1032231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1033231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 1034231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 1035231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::focusInEvent(QFocusEvent* ev) 1036231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1037231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (d->page) 1038231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->event(ev); 1039231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block else 1040231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsItem::focusInEvent(ev); 1041231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1042231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1043231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 1044231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 1045231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::focusOutEvent(QFocusEvent* ev) 1046231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1047231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (d->page) 1048231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->event(ev); 1049231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block else 1050231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsItem::focusOutEvent(ev); 1051231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1052231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1053231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 1054231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 1055231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockbool QGraphicsWebView::focusNextPrevChild(bool next) 1056231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1057231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (d->page) 1058231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return d->page->focusNextPrevChild(next); 1059231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1060231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return QGraphicsWidget::focusNextPrevChild(next); 1061231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1062231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1063231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 1064231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 1065231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::dragEnterEvent(QGraphicsSceneDragDropEvent* ev) 1066231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1067231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#ifndef QT_NO_DRAGANDDROP 1068643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) 1069643ca7872b450ea4efacab6188849e5aac2ba161Steve Block d->page->event(ev); 1070231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#else 1071231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Q_UNUSED(ev); 1072231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#endif 1073231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1074231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1075231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 1076231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 1077231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::dragLeaveEvent(QGraphicsSceneDragDropEvent* ev) 1078231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1079231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#ifndef QT_NO_DRAGANDDROP 1080643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) { 1081231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const bool accepted = ev->isAccepted(); 1082231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->event(ev); 1083231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ev->setAccepted(accepted); 1084231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 1085231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1086231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!ev->isAccepted()) 1087231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsWidget::dragLeaveEvent(ev); 1088231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#else 1089231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Q_UNUSED(ev); 1090231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#endif 1091231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1092231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1093231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 1094231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 1095231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::dragMoveEvent(QGraphicsSceneDragDropEvent* ev) 1096231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1097231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#ifndef QT_NO_DRAGANDDROP 1098643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) { 1099231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const bool accepted = ev->isAccepted(); 1100231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->event(ev); 1101231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ev->setAccepted(accepted); 1102231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 1103231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1104231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!ev->isAccepted()) 1105231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsWidget::dragMoveEvent(ev); 1106231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#else 1107231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Q_UNUSED(ev); 1108231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#endif 1109231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1110231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1111231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 1112231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 1113231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::dropEvent(QGraphicsSceneDragDropEvent* ev) 1114231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1115231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#ifndef QT_NO_DRAGANDDROP 1116643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) { 1117231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const bool accepted = ev->isAccepted(); 1118231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->event(ev); 1119231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ev->setAccepted(accepted); 1120231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 1121231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1122231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!ev->isAccepted()) 1123231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsWidget::dropEvent(ev); 1124231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#else 1125231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block Q_UNUSED(ev); 1126231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#endif 1127231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1128231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1129231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#ifndef QT_NO_CONTEXTMENU 1130231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 1131231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 1132231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::contextMenuEvent(QGraphicsSceneContextMenuEvent* ev) 1133231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1134231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (d->page) { 1135231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const bool accepted = ev->isAccepted(); 1136231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->event(ev); 1137231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ev->setAccepted(accepted); 1138231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 1139231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1140231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#endif // QT_NO_CONTEXTMENU 1141231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1142231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#ifndef QT_NO_WHEELEVENT 1143231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 1144231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 1145231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::wheelEvent(QGraphicsSceneWheelEvent* ev) 1146231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1147643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) { 1148231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const bool accepted = ev->isAccepted(); 1149231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->event(ev); 1150231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ev->setAccepted(accepted); 1151231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 1152231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1153231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!ev->isAccepted()) 1154231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsItem::wheelEvent(ev); 1155231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1156231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#endif // QT_NO_WHEELEVENT 1157231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1158231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*! \reimp 1159231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block*/ 1160231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid QGraphicsWebView::inputMethodEvent(QInputMethodEvent* ev) 1161231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1162643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (d->page) 1163231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block d->page->event(ev); 1164231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1165231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!ev->isAccepted()) 1166231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block QGraphicsItem::inputMethodEvent(ev); 1167231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1168231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1169643ca7872b450ea4efacab6188849e5aac2ba161Steve Block/*! 1170643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \fn void QGraphicsWebView::statusBarMessage(const QString& text) 1171643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1172643ca7872b450ea4efacab6188849e5aac2ba161Steve Block This signal is emitted when the statusbar \a text is changed by the page. 1173643ca7872b450ea4efacab6188849e5aac2ba161Steve Block*/ 1174643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1175643ca7872b450ea4efacab6188849e5aac2ba161Steve Block/*! 1176643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \fn void QGraphicsWebView::loadProgress(int progress) 1177643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1178643ca7872b450ea4efacab6188849e5aac2ba161Steve Block This signal is emitted every time an element in the web page 1179643ca7872b450ea4efacab6188849e5aac2ba161Steve Block completes loading and the overall loading progress advances. 1180643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1181643ca7872b450ea4efacab6188849e5aac2ba161Steve Block This signal tracks the progress of all child frames. 1182643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1183643ca7872b450ea4efacab6188849e5aac2ba161Steve Block The current value is provided by \a progress and scales from 0 to 100, 1184643ca7872b450ea4efacab6188849e5aac2ba161Steve Block which is the default range of QProgressBar. 1185643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1186643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \sa loadStarted(), loadFinished() 1187643ca7872b450ea4efacab6188849e5aac2ba161Steve Block*/ 1188643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1189643ca7872b450ea4efacab6188849e5aac2ba161Steve Block/*! 1190643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \fn void QGraphicsWebView::linkClicked(const QUrl &url) 1191643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1192643ca7872b450ea4efacab6188849e5aac2ba161Steve Block This signal is emitted whenever the user clicks on a link and the page's linkDelegationPolicy 1193643ca7872b450ea4efacab6188849e5aac2ba161Steve Block property is set to delegate the link handling for the specified \a url. 1194643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1195643ca7872b450ea4efacab6188849e5aac2ba161Steve Block \sa QWebPage::linkDelegationPolicy() 1196643ca7872b450ea4efacab6188849e5aac2ba161Steve Block*/ 1197643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 119865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif // QT_NO_GRAPHICSVIEW 119965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 1200231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "moc_qgraphicswebview.cpp" 1201