| author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
| Wed, 21 Apr 2010 12:15:23 +0300 | |
| branch | RCL_3 |
| changeset 13 | cc75c76972ee |
| parent 5 | d3bac044e0f0 |
| child 30 | 5dc02b23752f |
| permissions | -rw-r--r-- |
| 0 | 1 |
/* |
2 |
Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
|
3 |
Copyright (C) 2008 Holger Hans Peter Freyther |
|
4 |
Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> |
|
5 |
||
6 |
This library is free software; you can redistribute it and/or |
|
7 |
modify it under the terms of the GNU Library General Public |
|
8 |
License as published by the Free Software Foundation; either |
|
9 |
version 2 of the License, or (at your option) any later version. |
|
10 |
||
11 |
This library is distributed in the hope that it will be useful, |
|
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 |
Library General Public License for more details. |
|
15 |
||
16 |
You should have received a copy of the GNU Library General Public License |
|
17 |
along with this library; see the file COPYING.LIB. If not, write to |
|
18 |
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
19 |
Boston, MA 02110-1301, USA. |
|
20 |
*/ |
|
21 |
||
22 |
#include "config.h" |
|
23 |
#include "qwebview.h" |
|
24 |
||
25 |
#include "QWebPageClient.h" |
|
26 |
#include "qwebframe.h" |
|
27 |
#include "qwebpage_p.h" |
|
28 |
||
29 |
#include "qbitmap.h" |
|
30 |
#include "qevent.h" |
|
31 |
#include "qpainter.h" |
|
32 |
#include "qprinter.h" |
|
33 |
#include "qdir.h" |
|
34 |
#include "qfile.h" |
|
35 |
||
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
36 |
class QWebViewPrivate {
|
| 0 | 37 |
public: |
38 |
QWebViewPrivate(QWebView *view) |
|
39 |
: view(view) |
|
40 |
, page(0) |
|
41 |
, renderHints(QPainter::TextAntialiasing) |
|
42 |
{
|
|
43 |
Q_ASSERT(view); |
|
44 |
} |
|
45 |
||
46 |
void _q_pageDestroyed(); |
|
47 |
||
48 |
QWebView *view; |
|
49 |
QWebPage *page; |
|
50 |
||
51 |
QPainter::RenderHints renderHints; |
|
52 |
}; |
|
53 |
||
54 |
void QWebViewPrivate::_q_pageDestroyed() |
|
55 |
{
|
|
56 |
page = 0; |
|
57 |
view->setPage(0); |
|
58 |
} |
|
59 |
||
|
5
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
60 |
#ifdef Q_WS_MAEMO_5 |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
61 |
#include "qabstractkineticscroller.h" |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
62 |
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
63 |
class QWebViewKineticScroller : public QAbstractKineticScroller {
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
64 |
public: |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
65 |
QWebViewKineticScroller() : QAbstractKineticScroller() {}
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
66 |
// remember the frame where the button was pressed |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
67 |
bool eventFilter(QObject* o, QEvent* ev) |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
68 |
{
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
69 |
switch (ev->type()) {
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
70 |
case QEvent::MouseButtonPress: {
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
71 |
QWebFrame* hitFrame = scrollingFrameAt(static_cast<QMouseEvent*>(ev)->pos()); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
72 |
if (hitFrame) |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
73 |
m_frame = hitFrame; |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
74 |
break; |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
75 |
} |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
76 |
default: |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
77 |
break; |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
78 |
} |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
79 |
return QAbstractKineticScroller::eventFilter(o, ev); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
80 |
} |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
81 |
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
82 |
protected: |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
83 |
QWebFrame* currentFrame() const |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
84 |
{
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
85 |
if (!m_frame.isNull()) |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
86 |
return m_frame.data(); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
87 |
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
88 |
QWebView* view = static_cast<QWebView*>(widget()); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
89 |
QWebFrame* frame = view->page()->mainFrame(); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
90 |
return frame; |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
91 |
} |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
92 |
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
93 |
// Returns the innermost frame at the given position that can scroll. |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
94 |
QWebFrame* scrollingFrameAt(const QPoint& pos) const |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
95 |
{
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
96 |
QWebView* view = static_cast<QWebView*>(widget()); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
97 |
QWebFrame* mainFrame = view->page()->mainFrame(); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
98 |
QWebFrame* hitFrame = mainFrame->hitTestContent(pos).frame(); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
99 |
QSize range = hitFrame->contentsSize() - hitFrame->geometry().size(); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
100 |
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
101 |
while (hitFrame && range.width() <= 1 && range.height() <= 1) |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
102 |
hitFrame = hitFrame->parentFrame(); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
103 |
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
104 |
return hitFrame; |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
105 |
} |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
106 |
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
107 |
void attachToWidget() |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
108 |
{
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
109 |
QWebView* view = static_cast<QWebView*>(widget()); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
110 |
QWebFrame* mainFrame = view->page()->mainFrame(); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
111 |
m_oldHorizontalScrollBarPolicy = mainFrame->scrollBarPolicy(Qt::Horizontal); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
112 |
m_oldVerticalScrollBarPolicy = mainFrame->scrollBarPolicy(Qt::Vertical); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
113 |
mainFrame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
114 |
mainFrame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
115 |
view->installEventFilter(this); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
116 |
} |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
117 |
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
118 |
void removeFromWidget() |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
119 |
{
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
120 |
QWebView* view = static_cast<QWebView*>(widget()); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
121 |
view->removeEventFilter(this); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
122 |
QWebFrame* mainFrame = view->page()->mainFrame(); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
123 |
mainFrame->setScrollBarPolicy(Qt::Vertical, m_oldVerticalScrollBarPolicy); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
124 |
mainFrame->setScrollBarPolicy(Qt::Horizontal, m_oldHorizontalScrollBarPolicy); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
125 |
} |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
126 |
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
127 |
QRect positionRange() const |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
128 |
{
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
129 |
QRect r; |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
130 |
QWebFrame* frame = currentFrame(); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
131 |
r.setSize(frame->contentsSize() - frame->geometry().size()); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
132 |
return r; |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
133 |
} |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
134 |
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
135 |
QPoint position() const |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
136 |
{
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
137 |
QWebFrame* frame = currentFrame(); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
138 |
return frame->scrollPosition(); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
139 |
} |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
140 |
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
141 |
QSize viewportSize() const |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
142 |
{
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
143 |
return static_cast<QWebView*>(widget())->page()->viewportSize(); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
144 |
} |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
145 |
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
146 |
void setPosition(const QPoint& point, const QPoint& /* overShootDelta */) |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
147 |
{
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
148 |
QWebFrame* frame = currentFrame(); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
149 |
frame->setScrollPosition(point); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
150 |
} |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
151 |
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
152 |
QPointer<QWebFrame> m_frame; |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
153 |
Qt::ScrollBarPolicy m_oldVerticalScrollBarPolicy; |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
154 |
Qt::ScrollBarPolicy m_oldHorizontalScrollBarPolicy; |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
155 |
}; |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
156 |
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
157 |
#endif // Q_WS_MAEMO_5 |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
158 |
|
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
159 |
|
| 0 | 160 |
/*! |
161 |
\class QWebView |
|
162 |
\since 4.4 |
|
163 |
\brief The QWebView class provides a widget that is used to view and edit |
|
164 |
web documents. |
|
165 |
\ingroup advanced |
|
166 |
||
167 |
\inmodule QtWebKit |
|
168 |
||
169 |
QWebView is the main widget component of the QtWebKit web browsing module. |
|
170 |
It can be used in various applications to display web content live from the |
|
171 |
Internet. |
|
172 |
||
173 |
The image below shows QWebView previewed in \QD with a Nokia website. |
|
174 |
||
175 |
\image qwebview-url.png |
|
176 |
||
177 |
A web site can be loaded onto QWebView with the load() function. Like all |
|
178 |
Qt widgets, the show() function must be invoked in order to display |
|
179 |
QWebView. The snippet below illustrates this: |
|
180 |
||
181 |
\snippet webkitsnippets/simple/main.cpp Using QWebView |
|
182 |
||
183 |
Alternatively, setUrl() can also be used to load a web site. If you have |
|
184 |
the HTML content readily available, you can use setHtml() instead. |
|
185 |
||
186 |
The loadStarted() signal is emitted when the view begins loading. The |
|
187 |
loadProgress() signal, on the other hand, is emitted whenever an element of |
|
188 |
the web view completes loading, such as an embedded image, a script, etc. |
|
189 |
Finally, the loadFinished() signal is emitted when the view has loaded |
|
190 |
completely. It's argument - either \c true or \c false - indicates |
|
191 |
load success or failure. |
|
192 |
||
193 |
The page() function returns a pointer to the web page object. See |
|
194 |
\l{Elements of QWebView} for an explanation of how the web page
|
|
195 |
is related to the view. To modify your web view's settings, you can access |
|
196 |
the QWebSettings object with the settings() function. With QWebSettings, |
|
197 |
you can change the default fonts, enable or disable features such as |
|
198 |
JavaScript and plugins. |
|
199 |
||
200 |
The title of an HTML document can be accessed with the title() property. |
|
201 |
Additionally, a web site may also specify an icon, which can be accessed |
|
202 |
using the icon() property. If the title or the icon changes, the corresponding |
|
203 |
titleChanged() and iconChanged() signals will be emitted. The |
|
204 |
textSizeMultiplier() property can be used to change the overall size of |
|
205 |
the text displayed in the web view. |
|
206 |
||
207 |
If you require a custom context menu, you can implement it by reimplementing |
|
208 |
\l{QWidget::}{contextMenuEvent()} and populating your QMenu with the actions
|
|
209 |
obtained from pageAction(). More functionality such as reloading the view, |
|
210 |
copying selected text to the clipboard, or pasting into the view, is also |
|
211 |
encapsulated within the QAction objects returned by pageAction(). These |
|
212 |
actions can be programmatically triggered using triggerPageAction(). |
|
213 |
Alternatively, the actions can be added to a toolbar or a menu directly. |
|
214 |
QWebView maintains the state of the returned actions but allows |
|
215 |
modification of action properties such as \l{QAction::}{text} or
|
|
216 |
\l{QAction::}{icon}.
|
|
217 |
||
218 |
A QWebView can be printed onto a QPrinter using the print() function. |
|
219 |
This function is marked as a slot and can be conveniently connected to |
|
220 |
\l{QPrintPreviewDialog}'s \l{QPrintPreviewDialog::}{paintRequested()}
|
|
221 |
signal. |
|
222 |
||
223 |
If you want to provide support for web sites that allow the user to open |
|
224 |
new windows, such as pop-up windows, you can subclass QWebView and |
|
225 |
reimplement the createWindow() function. |
|
226 |
||
227 |
\section1 Elements of QWebView |
|
228 |
||
229 |
QWebView consists of other objects such as QWebFrame and QWebPage. The |
|
230 |
flowchart below shows these elements are related. |
|
231 |
||
232 |
\image qwebview-diagram.png |
|
233 |
||
234 |
\note It is possible to use QWebPage and QWebFrame, without using QWebView, |
|
235 |
if you do not require QWidget attributes. Nevertheless, QtWebKit depends |
|
236 |
on QtGui, so you should use a QApplication instead of QCoreApplication. |
|
237 |
||
238 |
\sa {Previewer Example}, {Web Browser}, {Form Extractor Example},
|
|
239 |
{Google Chat Example}, {Fancy Browser Example}
|
|
240 |
*/ |
|
241 |
||
242 |
/*! |
|
243 |
Constructs an empty QWebView with parent \a parent. |
|
244 |
||
245 |
\sa load() |
|
246 |
*/ |
|
247 |
QWebView::QWebView(QWidget *parent) |
|
248 |
: QWidget(parent) |
|
249 |
{
|
|
250 |
d = new QWebViewPrivate(this); |
|
251 |
||
252 |
#if !defined(Q_WS_QWS) && !defined(Q_OS_SYMBIAN) |
|
253 |
setAttribute(Qt::WA_InputMethodEnabled); |
|
254 |
#endif |
|
255 |
||
|
5
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
256 |
#if defined(Q_WS_MAEMO_5) |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
257 |
QAbstractKineticScroller* scroller = new QWebViewKineticScroller(); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
258 |
scroller->setWidget(this); |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
259 |
#endif |
| 0 | 260 |
setAcceptDrops(true); |
261 |
||
262 |
setMouseTracking(true); |
|
263 |
setFocusPolicy(Qt::WheelFocus); |
|
264 |
} |
|
265 |
||
266 |
/*! |
|
267 |
Destroys the web view. |
|
268 |
*/ |
|
269 |
QWebView::~QWebView() |
|
270 |
{
|
|
271 |
if (d->page) {
|
|
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
272 |
#if QT_VERSION >= 0x040600 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
273 |
d->page->d->view.clear(); |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
274 |
#else |
| 0 | 275 |
d->page->d->view = 0; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
276 |
#endif |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
277 |
delete d->page->d->client; |
| 0 | 278 |
d->page->d->client = 0; |
279 |
} |
|
280 |
||
281 |
if (d->page && d->page->parent() == this) |
|
282 |
delete d->page; |
|
283 |
delete d; |
|
284 |
} |
|
285 |
||
286 |
/*! |
|
287 |
Returns a pointer to the underlying web page. |
|
288 |
||
289 |
\sa setPage() |
|
290 |
*/ |
|
291 |
QWebPage *QWebView::page() const |
|
292 |
{
|
|
293 |
if (!d->page) {
|
|
294 |
QWebView *that = const_cast<QWebView *>(this); |
|
295 |
that->setPage(new QWebPage(that)); |
|
296 |
} |
|
297 |
return d->page; |
|
298 |
} |
|
299 |
||
300 |
/*! |
|
301 |
Makes \a page the new web page of the web view. |
|
302 |
||
303 |
The parent QObject of the provided page remains the owner |
|
304 |
of the object. If the current document is a child of the web |
|
305 |
view, it will be deleted. |
|
306 |
||
307 |
\sa page() |
|
308 |
*/ |
|
309 |
void QWebView::setPage(QWebPage* page) |
|
310 |
{
|
|
311 |
if (d->page == page) |
|
312 |
return; |
|
313 |
if (d->page) {
|
|
314 |
d->page->d->client = 0; // unset the page client |
|
315 |
if (d->page->parent() == this) |
|
316 |
delete d->page; |
|
317 |
else |
|
318 |
d->page->disconnect(this); |
|
319 |
} |
|
320 |
d->page = page; |
|
321 |
if (d->page) {
|
|
322 |
d->page->setView(this); |
|
323 |
d->page->setPalette(palette()); |
|
324 |
// #### connect signals |
|
325 |
QWebFrame *mainFrame = d->page->mainFrame(); |
|
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
326 |
connect(mainFrame, SIGNAL(titleChanged(QString)), |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
327 |
this, SIGNAL(titleChanged(QString))); |
| 0 | 328 |
connect(mainFrame, SIGNAL(iconChanged()), |
329 |
this, SIGNAL(iconChanged())); |
|
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
330 |
connect(mainFrame, SIGNAL(urlChanged(QUrl)), |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
331 |
this, SIGNAL(urlChanged(QUrl))); |
| 0 | 332 |
|
333 |
connect(d->page, SIGNAL(loadStarted()), |
|
334 |
this, SIGNAL(loadStarted())); |
|
335 |
connect(d->page, SIGNAL(loadProgress(int)), |
|
336 |
this, SIGNAL(loadProgress(int))); |
|
337 |
connect(d->page, SIGNAL(loadFinished(bool)), |
|
338 |
this, SIGNAL(loadFinished(bool))); |
|
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
339 |
connect(d->page, SIGNAL(statusBarMessage(QString)), |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
340 |
this, SIGNAL(statusBarMessage(QString))); |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
341 |
connect(d->page, SIGNAL(linkClicked(QUrl)), |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
342 |
this, SIGNAL(linkClicked(QUrl))); |
| 0 | 343 |
|
344 |
connect(d->page, SIGNAL(microFocusChanged()), |
|
345 |
this, SLOT(updateMicroFocus())); |
|
346 |
connect(d->page, SIGNAL(destroyed()), |
|
347 |
this, SLOT(_q_pageDestroyed())); |
|
348 |
} |
|
349 |
setAttribute(Qt::WA_OpaquePaintEvent, d->page); |
|
350 |
update(); |
|
351 |
} |
|
352 |
||
353 |
/*! |
|
354 |
Loads the specified \a url and displays it. |
|
355 |
||
356 |
\note The view remains the same until enough data has arrived to display the new \a url. |
|
357 |
||
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
358 |
\sa setUrl(), url(), urlChanged(), QUrl::fromUserInput() |
| 0 | 359 |
*/ |
360 |
void QWebView::load(const QUrl &url) |
|
361 |
{
|
|
362 |
page()->mainFrame()->load(url); |
|
363 |
} |
|
364 |
||
365 |
/*! |
|
366 |
\fn void QWebView::load(const QNetworkRequest &request, QNetworkAccessManager::Operation operation, const QByteArray &body) |
|
367 |
||
368 |
Loads a network request, \a request, using the method specified in \a operation. |
|
369 |
||
370 |
\a body is optional and is only used for POST operations. |
|
371 |
||
372 |
\note The view remains the same until enough data has arrived to display the new url. |
|
373 |
||
374 |
\sa url(), urlChanged() |
|
375 |
*/ |
|
376 |
||
377 |
#if QT_VERSION < 0x040400 && !defined(qdoc) |
|
378 |
void QWebView::load(const QWebNetworkRequest &request) |
|
379 |
#else |
|
380 |
void QWebView::load(const QNetworkRequest &request, |
|
381 |
QNetworkAccessManager::Operation operation, |
|
382 |
const QByteArray &body) |
|
383 |
#endif |
|
384 |
{
|
|
385 |
page()->mainFrame()->load(request |
|
386 |
#if QT_VERSION >= 0x040400 |
|
387 |
, operation, body |
|
388 |
#endif |
|
389 |
); |
|
390 |
} |
|
391 |
||
392 |
/*! |
|
393 |
Sets the content of the web view to the specified \a html. |
|
394 |
||
395 |
External objects such as stylesheets or images referenced in the HTML |
|
396 |
document are located relative to \a baseUrl. |
|
397 |
||
398 |
The \a html is loaded immediately; external objects are loaded asynchronously. |
|
399 |
||
400 |
When using this method, WebKit assumes that external resources such as |
|
401 |
JavaScript programs or style sheets are encoded in UTF-8 unless otherwise |
|
402 |
specified. For example, the encoding of an external script can be specified |
|
403 |
through the charset attribute of the HTML script tag. Alternatively, the |
|
404 |
encoding can also be specified by the web server. |
|
405 |
||
406 |
\sa load(), setContent(), QWebFrame::toHtml() |
|
407 |
*/ |
|
408 |
void QWebView::setHtml(const QString &html, const QUrl &baseUrl) |
|
409 |
{
|
|
410 |
page()->mainFrame()->setHtml(html, baseUrl); |
|
411 |
} |
|
412 |
||
413 |
/*! |
|
414 |
Sets the content of the web view to the specified content \a data. If the \a mimeType argument |
|
415 |
is empty it is currently assumed that the content is HTML but in future versions we may introduce |
|
416 |
auto-detection. |
|
417 |
||
418 |
External objects referenced in the content are located relative to \a baseUrl. |
|
419 |
||
420 |
The \a data is loaded immediately; external objects are loaded asynchronously. |
|
421 |
||
422 |
\sa load(), setHtml(), QWebFrame::toHtml() |
|
423 |
*/ |
|
424 |
void QWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) |
|
425 |
{
|
|
426 |
page()->mainFrame()->setContent(data, mimeType, baseUrl); |
|
427 |
} |
|
428 |
||
429 |
/*! |
|
430 |
Returns a pointer to the view's history of navigated web pages. |
|
431 |
||
432 |
It is equivalent to |
|
433 |
||
434 |
\snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 0 |
|
435 |
*/ |
|
436 |
QWebHistory *QWebView::history() const |
|
437 |
{
|
|
438 |
return page()->history(); |
|
439 |
} |
|
440 |
||
441 |
/*! |
|
442 |
Returns a pointer to the view/page specific settings object. |
|
443 |
||
444 |
It is equivalent to |
|
445 |
||
446 |
\snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 1 |
|
447 |
||
448 |
\sa QWebSettings::globalSettings() |
|
449 |
*/ |
|
450 |
QWebSettings *QWebView::settings() const |
|
451 |
{
|
|
452 |
return page()->settings(); |
|
453 |
} |
|
454 |
||
455 |
/*! |
|
456 |
\property QWebView::title |
|
457 |
\brief the title of the web page currently viewed |
|
458 |
||
459 |
By default, this property contains an empty string. |
|
460 |
||
461 |
\sa titleChanged() |
|
462 |
*/ |
|
463 |
QString QWebView::title() const |
|
464 |
{
|
|
465 |
if (d->page) |
|
466 |
return d->page->mainFrame()->title(); |
|
467 |
return QString(); |
|
468 |
} |
|
469 |
||
470 |
/*! |
|
471 |
\property QWebView::url |
|
472 |
\brief the url of the web page currently viewed |
|
473 |
||
474 |
Setting this property clears the view and loads the URL. |
|
475 |
||
476 |
By default, this property contains an empty, invalid URL. |
|
477 |
||
478 |
\sa load(), urlChanged() |
|
479 |
*/ |
|
480 |
||
481 |
void QWebView::setUrl(const QUrl &url) |
|
482 |
{
|
|
483 |
page()->mainFrame()->setUrl(url); |
|
484 |
} |
|
485 |
||
486 |
QUrl QWebView::url() const |
|
487 |
{
|
|
488 |
if (d->page) |
|
489 |
return d->page->mainFrame()->url(); |
|
490 |
return QUrl(); |
|
491 |
} |
|
492 |
||
493 |
/*! |
|
494 |
\property QWebView::icon |
|
495 |
\brief the icon associated with the web page currently viewed |
|
496 |
||
497 |
By default, this property contains a null icon. |
|
498 |
||
499 |
\sa iconChanged(), QWebSettings::iconForUrl() |
|
500 |
*/ |
|
501 |
QIcon QWebView::icon() const |
|
502 |
{
|
|
503 |
if (d->page) |
|
504 |
return d->page->mainFrame()->icon(); |
|
505 |
return QIcon(); |
|
506 |
} |
|
507 |
||
508 |
/*! |
|
509 |
\property QWebView::selectedText |
|
510 |
\brief the text currently selected |
|
511 |
||
512 |
By default, this property contains an empty string. |
|
513 |
||
514 |
\sa findText(), selectionChanged() |
|
515 |
*/ |
|
516 |
QString QWebView::selectedText() const |
|
517 |
{
|
|
518 |
if (d->page) |
|
519 |
return d->page->selectedText(); |
|
520 |
return QString(); |
|
521 |
} |
|
522 |
||
523 |
/*! |
|
524 |
Returns a pointer to a QAction that encapsulates the specified web action \a action. |
|
525 |
*/ |
|
526 |
QAction *QWebView::pageAction(QWebPage::WebAction action) const |
|
527 |
{
|
|
528 |
return page()->action(action); |
|
529 |
} |
|
530 |
||
531 |
/*! |
|
532 |
Triggers the specified \a action. If it is a checkable action the specified |
|
533 |
\a checked state is assumed. |
|
534 |
||
535 |
The following example triggers the copy action and therefore copies any |
|
536 |
selected text to the clipboard. |
|
537 |
||
538 |
\snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 2 |
|
539 |
||
540 |
\sa pageAction() |
|
541 |
*/ |
|
542 |
void QWebView::triggerPageAction(QWebPage::WebAction action, bool checked) |
|
543 |
{
|
|
544 |
page()->triggerAction(action, checked); |
|
545 |
} |
|
546 |
||
547 |
/*! |
|
548 |
\property QWebView::modified |
|
549 |
\brief whether the document was modified by the user |
|
550 |
||
551 |
Parts of HTML documents can be editable for example through the |
|
552 |
\c{contenteditable} attribute on HTML elements.
|
|
553 |
||
554 |
By default, this property is false. |
|
555 |
*/ |
|
556 |
bool QWebView::isModified() const |
|
557 |
{
|
|
558 |
if (d->page) |
|
559 |
return d->page->isModified(); |
|
560 |
return false; |
|
561 |
} |
|
562 |
||
563 |
/* |
|
564 |
Qt::TextInteractionFlags QWebView::textInteractionFlags() const |
|
565 |
{
|
|
566 |
// ### FIXME (add to page) |
|
567 |
return Qt::TextInteractionFlags(); |
|
568 |
} |
|
569 |
*/ |
|
570 |
||
571 |
/* |
|
572 |
\property QWebView::textInteractionFlags |
|
573 |
\brief how the view should handle user input |
|
574 |
||
575 |
Specifies how the user can interact with the text on the page. |
|
576 |
*/ |
|
577 |
||
578 |
/* |
|
579 |
void QWebView::setTextInteractionFlags(Qt::TextInteractionFlags flags) |
|
580 |
{
|
|
581 |
Q_UNUSED(flags) |
|
582 |
// ### FIXME (add to page) |
|
583 |
} |
|
584 |
*/ |
|
585 |
||
586 |
/*! |
|
587 |
\reimp |
|
588 |
*/ |
|
589 |
QSize QWebView::sizeHint() const |
|
590 |
{
|
|
591 |
return QSize(800, 600); // ####... |
|
592 |
} |
|
593 |
||
594 |
/*! |
|
595 |
\property QWebView::zoomFactor |
|
596 |
\since 4.5 |
|
597 |
\brief the zoom factor for the view |
|
598 |
*/ |
|
599 |
||
600 |
void QWebView::setZoomFactor(qreal factor) |
|
601 |
{
|
|
602 |
page()->mainFrame()->setZoomFactor(factor); |
|
603 |
} |
|
604 |
||
605 |
qreal QWebView::zoomFactor() const |
|
606 |
{
|
|
607 |
return page()->mainFrame()->zoomFactor(); |
|
608 |
} |
|
609 |
||
610 |
/*! |
|
611 |
\property QWebView::textSizeMultiplier |
|
612 |
\brief the scaling factor for all text in the frame |
|
613 |
\obsolete |
|
614 |
||
615 |
Use setZoomFactor instead, in combination with the |
|
616 |
ZoomTextOnly attribute in QWebSettings. |
|
617 |
||
618 |
\note Setting this property also enables the |
|
619 |
ZoomTextOnly attribute in QWebSettings. |
|
620 |
||
621 |
By default, this property contains a value of 1.0. |
|
622 |
*/ |
|
623 |
||
624 |
/*! |
|
625 |
Sets the value of the multiplier used to scale the text in a Web page to |
|
626 |
the \a factor specified. |
|
627 |
*/ |
|
628 |
void QWebView::setTextSizeMultiplier(qreal factor) |
|
629 |
{
|
|
630 |
page()->mainFrame()->setTextSizeMultiplier(factor); |
|
631 |
} |
|
632 |
||
633 |
/*! |
|
634 |
Returns the value of the multiplier used to scale the text in a Web page. |
|
635 |
*/ |
|
636 |
qreal QWebView::textSizeMultiplier() const |
|
637 |
{
|
|
638 |
return page()->mainFrame()->textSizeMultiplier(); |
|
639 |
} |
|
640 |
||
641 |
/*! |
|
642 |
\property QWebView::renderHints |
|
643 |
\since 4.6 |
|
644 |
\brief the default render hints for the view |
|
645 |
||
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
646 |
These hints are used to initialize QPainter before painting the Web page. |
| 0 | 647 |
|
648 |
QPainter::TextAntialiasing is enabled by default. |
|
649 |
||
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
650 |
\note This property is not available on Symbian. However, the getter and |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
651 |
setter functions can still be used directly. |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
652 |
|
| 0 | 653 |
\sa QPainter::renderHints() |
654 |
*/ |
|
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
655 |
|
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
656 |
/*! |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
657 |
\since 4.6 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
658 |
Returns the render hints used by the view to render content. |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
659 |
|
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
660 |
\sa QPainter::renderHints() |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
661 |
*/ |
| 0 | 662 |
QPainter::RenderHints QWebView::renderHints() const |
663 |
{
|
|
664 |
return d->renderHints; |
|
665 |
} |
|
666 |
||
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
667 |
/*! |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
668 |
\since 4.6 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
669 |
Sets the render hints used by the view to the specified \a hints. |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
670 |
|
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
671 |
\sa QPainter::setRenderHints() |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
672 |
*/ |
| 0 | 673 |
void QWebView::setRenderHints(QPainter::RenderHints hints) |
674 |
{
|
|
675 |
if (hints == d->renderHints) |
|
676 |
return; |
|
677 |
d->renderHints = hints; |
|
678 |
update(); |
|
679 |
} |
|
680 |
||
681 |
/*! |
|
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
682 |
\since 4.6 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
683 |
If \a enabled is true, enables the specified render \a hint; otherwise |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
684 |
disables it. |
| 0 | 685 |
|
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
686 |
\sa renderHints, QPainter::renderHints() |
| 0 | 687 |
*/ |
688 |
void QWebView::setRenderHint(QPainter::RenderHint hint, bool enabled) |
|
689 |
{
|
|
690 |
QPainter::RenderHints oldHints = d->renderHints; |
|
691 |
if (enabled) |
|
692 |
d->renderHints |= hint; |
|
693 |
else |
|
694 |
d->renderHints &= ~hint; |
|
695 |
if (oldHints != d->renderHints) |
|
696 |
update(); |
|
697 |
} |
|
698 |
||
699 |
||
700 |
/*! |
|
701 |
Finds the specified string, \a subString, in the page, using the given \a options. |
|
702 |
||
703 |
If the HighlightAllOccurrences flag is passed, the function will highlight all occurrences |
|
704 |
that exist in the page. All subsequent calls will extend the highlight, rather than |
|
705 |
replace it, with occurrences of the new string. |
|
706 |
||
707 |
If the HighlightAllOccurrences flag is not passed, the function will select an occurrence |
|
708 |
and all subsequent calls will replace the current occurrence with the next one. |
|
709 |
||
710 |
To clear the selection, just pass an empty string. |
|
711 |
||
712 |
Returns true if \a subString was found; otherwise returns false. |
|
713 |
||
714 |
\sa selectedText(), selectionChanged() |
|
715 |
*/ |
|
716 |
bool QWebView::findText(const QString &subString, QWebPage::FindFlags options) |
|
717 |
{
|
|
718 |
if (d->page) |
|
719 |
return d->page->findText(subString, options); |
|
720 |
return false; |
|
721 |
} |
|
722 |
||
723 |
/*! \reimp |
|
724 |
*/ |
|
725 |
bool QWebView::event(QEvent *e) |
|
726 |
{
|
|
727 |
if (d->page) {
|
|
728 |
#ifndef QT_NO_CONTEXTMENU |
|
729 |
if (e->type() == QEvent::ContextMenu) {
|
|
730 |
if (!isEnabled()) |
|
731 |
return false; |
|
732 |
QContextMenuEvent *event = static_cast<QContextMenuEvent *>(e); |
|
733 |
if (d->page->swallowContextMenuEvent(event)) {
|
|
734 |
e->accept(); |
|
735 |
return true; |
|
736 |
} |
|
737 |
d->page->updatePositionDependentActions(event->pos()); |
|
738 |
} else |
|
739 |
#endif // QT_NO_CONTEXTMENU |
|
740 |
if (e->type() == QEvent::ShortcutOverride) {
|
|
741 |
d->page->event(e); |
|
742 |
#ifndef QT_NO_CURSOR |
|
743 |
#if QT_VERSION >= 0x040400 |
|
744 |
} else if (e->type() == QEvent::CursorChange) {
|
|
745 |
// An unsetCursor will set the cursor to Qt::ArrowCursor. |
|
746 |
// Thus this cursor change might be a QWidget::unsetCursor() |
|
747 |
// If this is not the case and it came from WebCore, the |
|
748 |
// QWebPageClient already has set its cursor internally |
|
749 |
// to Qt::ArrowCursor, so updating the cursor is always |
|
750 |
// right, as it falls back to the last cursor set by |
|
751 |
// WebCore. |
|
752 |
// FIXME: Add a QEvent::CursorUnset or similar to Qt. |
|
753 |
if (cursor().shape() == Qt::ArrowCursor) |
|
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
754 |
d->page->d->client->resetCursor(); |
| 0 | 755 |
#endif |
756 |
#endif |
|
757 |
} else if (e->type() == QEvent::Leave) |
|
758 |
d->page->event(e); |
|
759 |
} |
|
760 |
||
761 |
return QWidget::event(e); |
|
762 |
} |
|
763 |
||
764 |
/*! |
|
765 |
Prints the main frame to the given \a printer. |
|
766 |
||
767 |
\sa QWebFrame::print(), QPrintPreviewDialog |
|
768 |
*/ |
|
769 |
void QWebView::print(QPrinter *printer) const |
|
770 |
{
|
|
771 |
#ifndef QT_NO_PRINTER |
|
772 |
page()->mainFrame()->print(printer); |
|
773 |
#endif |
|
774 |
} |
|
775 |
||
776 |
/*! |
|
777 |
Convenience slot that stops loading the document. |
|
778 |
||
779 |
It is equivalent to |
|
780 |
||
781 |
\snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 3 |
|
782 |
||
783 |
\sa reload(), pageAction(), loadFinished() |
|
784 |
*/ |
|
785 |
void QWebView::stop() |
|
786 |
{
|
|
787 |
if (d->page) |
|
788 |
d->page->triggerAction(QWebPage::Stop); |
|
789 |
} |
|
790 |
||
791 |
/*! |
|
792 |
Convenience slot that loads the previous document in the list of documents |
|
793 |
built by navigating links. Does nothing if there is no previous document. |
|
794 |
||
795 |
It is equivalent to |
|
796 |
||
797 |
\snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 4 |
|
798 |
||
799 |
\sa forward(), pageAction() |
|
800 |
*/ |
|
801 |
void QWebView::back() |
|
802 |
{
|
|
803 |
if (d->page) |
|
804 |
d->page->triggerAction(QWebPage::Back); |
|
805 |
} |
|
806 |
||
807 |
/*! |
|
808 |
Convenience slot that loads the next document in the list of documents |
|
809 |
built by navigating links. Does nothing if there is no next document. |
|
810 |
||
811 |
It is equivalent to |
|
812 |
||
813 |
\snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 5 |
|
814 |
||
815 |
\sa back(), pageAction() |
|
816 |
*/ |
|
817 |
void QWebView::forward() |
|
818 |
{
|
|
819 |
if (d->page) |
|
820 |
d->page->triggerAction(QWebPage::Forward); |
|
821 |
} |
|
822 |
||
823 |
/*! |
|
824 |
Reloads the current document. |
|
825 |
||
826 |
\sa stop(), pageAction(), loadStarted() |
|
827 |
*/ |
|
828 |
void QWebView::reload() |
|
829 |
{
|
|
830 |
if (d->page) |
|
831 |
d->page->triggerAction(QWebPage::Reload); |
|
832 |
} |
|
833 |
||
834 |
/*! \reimp |
|
835 |
*/ |
|
836 |
void QWebView::resizeEvent(QResizeEvent *e) |
|
837 |
{
|
|
838 |
if (d->page) |
|
839 |
d->page->setViewportSize(e->size()); |
|
840 |
} |
|
841 |
||
842 |
/*! \reimp |
|
843 |
*/ |
|
844 |
void QWebView::paintEvent(QPaintEvent *ev) |
|
845 |
{
|
|
846 |
if (!d->page) |
|
847 |
return; |
|
848 |
#ifdef QWEBKIT_TIME_RENDERING |
|
849 |
QTime time; |
|
850 |
time.start(); |
|
851 |
#endif |
|
852 |
||
853 |
QWebFrame *frame = d->page->mainFrame(); |
|
854 |
QPainter p(this); |
|
855 |
p.setRenderHints(d->renderHints); |
|
856 |
||
857 |
frame->render(&p, ev->region()); |
|
858 |
||
859 |
#ifdef QWEBKIT_TIME_RENDERING |
|
860 |
int elapsed = time.elapsed(); |
|
861 |
qDebug() << "paint event on " << ev->region() << ", took to render = " << elapsed; |
|
862 |
#endif |
|
863 |
} |
|
864 |
||
865 |
/*! |
|
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
866 |
This function is called from the createWindow() method of the associated QWebPage, |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
867 |
each time the page wants to create a new window of the given \a type. This might |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
868 |
be the result, for example, of a JavaScript request to open a document in a new window. |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
869 |
|
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
870 |
\note If the createWindow() method of the associated page is reimplemented, this |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
871 |
method is not called, unless explicitly done so in the reimplementation. |
| 0 | 872 |
|
873 |
\sa QWebPage::createWindow() |
|
874 |
*/ |
|
875 |
QWebView *QWebView::createWindow(QWebPage::WebWindowType type) |
|
876 |
{
|
|
877 |
Q_UNUSED(type) |
|
878 |
return 0; |
|
879 |
} |
|
880 |
||
881 |
/*! \reimp |
|
882 |
*/ |
|
883 |
void QWebView::mouseMoveEvent(QMouseEvent* ev) |
|
884 |
{
|
|
885 |
if (d->page) {
|
|
886 |
const bool accepted = ev->isAccepted(); |
|
887 |
d->page->event(ev); |
|
888 |
ev->setAccepted(accepted); |
|
889 |
} |
|
890 |
} |
|
891 |
||
892 |
/*! \reimp |
|
893 |
*/ |
|
894 |
void QWebView::mousePressEvent(QMouseEvent* ev) |
|
895 |
{
|
|
896 |
if (d->page) {
|
|
897 |
const bool accepted = ev->isAccepted(); |
|
898 |
d->page->event(ev); |
|
899 |
ev->setAccepted(accepted); |
|
900 |
} |
|
901 |
} |
|
902 |
||
903 |
/*! \reimp |
|
904 |
*/ |
|
905 |
void QWebView::mouseDoubleClickEvent(QMouseEvent* ev) |
|
906 |
{
|
|
907 |
if (d->page) {
|
|
908 |
const bool accepted = ev->isAccepted(); |
|
909 |
d->page->event(ev); |
|
910 |
ev->setAccepted(accepted); |
|
911 |
} |
|
912 |
} |
|
913 |
||
914 |
/*! \reimp |
|
915 |
*/ |
|
916 |
void QWebView::mouseReleaseEvent(QMouseEvent* ev) |
|
917 |
{
|
|
918 |
if (d->page) {
|
|
919 |
const bool accepted = ev->isAccepted(); |
|
920 |
d->page->event(ev); |
|
921 |
ev->setAccepted(accepted); |
|
922 |
} |
|
923 |
} |
|
924 |
||
925 |
#ifndef QT_NO_CONTEXTMENU |
|
926 |
/*! \reimp |
|
927 |
*/ |
|
928 |
void QWebView::contextMenuEvent(QContextMenuEvent* ev) |
|
929 |
{
|
|
930 |
if (d->page) {
|
|
931 |
const bool accepted = ev->isAccepted(); |
|
932 |
d->page->event(ev); |
|
933 |
ev->setAccepted(accepted); |
|
934 |
} |
|
935 |
} |
|
936 |
#endif // QT_NO_CONTEXTMENU |
|
937 |
||
938 |
#ifndef QT_NO_WHEELEVENT |
|
939 |
/*! \reimp |
|
940 |
*/ |
|
941 |
void QWebView::wheelEvent(QWheelEvent* ev) |
|
942 |
{
|
|
943 |
if (d->page) {
|
|
944 |
const bool accepted = ev->isAccepted(); |
|
945 |
d->page->event(ev); |
|
946 |
ev->setAccepted(accepted); |
|
947 |
} |
|
948 |
} |
|
949 |
#endif // QT_NO_WHEELEVENT |
|
950 |
||
951 |
/*! \reimp |
|
952 |
*/ |
|
953 |
void QWebView::keyPressEvent(QKeyEvent* ev) |
|
954 |
{
|
|
955 |
if (d->page) |
|
956 |
d->page->event(ev); |
|
957 |
if (!ev->isAccepted()) |
|
958 |
QWidget::keyPressEvent(ev); |
|
959 |
} |
|
960 |
||
961 |
/*! \reimp |
|
962 |
*/ |
|
963 |
void QWebView::keyReleaseEvent(QKeyEvent* ev) |
|
964 |
{
|
|
965 |
if (d->page) |
|
966 |
d->page->event(ev); |
|
967 |
if (!ev->isAccepted()) |
|
968 |
QWidget::keyReleaseEvent(ev); |
|
969 |
} |
|
970 |
||
971 |
/*! \reimp |
|
972 |
*/ |
|
973 |
void QWebView::focusInEvent(QFocusEvent* ev) |
|
974 |
{
|
|
975 |
if (d->page) |
|
976 |
d->page->event(ev); |
|
977 |
else |
|
978 |
QWidget::focusInEvent(ev); |
|
979 |
} |
|
980 |
||
981 |
/*! \reimp |
|
982 |
*/ |
|
983 |
void QWebView::focusOutEvent(QFocusEvent* ev) |
|
984 |
{
|
|
985 |
if (d->page) |
|
986 |
d->page->event(ev); |
|
987 |
else |
|
988 |
QWidget::focusOutEvent(ev); |
|
989 |
} |
|
990 |
||
991 |
/*! \reimp |
|
992 |
*/ |
|
993 |
void QWebView::dragEnterEvent(QDragEnterEvent* ev) |
|
994 |
{
|
|
995 |
#ifndef QT_NO_DRAGANDDROP |
|
996 |
if (d->page) |
|
997 |
d->page->event(ev); |
|
998 |
#endif |
|
999 |
} |
|
1000 |
||
1001 |
/*! \reimp |
|
1002 |
*/ |
|
1003 |
void QWebView::dragLeaveEvent(QDragLeaveEvent* ev) |
|
1004 |
{
|
|
1005 |
#ifndef QT_NO_DRAGANDDROP |
|
1006 |
if (d->page) |
|
1007 |
d->page->event(ev); |
|
1008 |
#endif |
|
1009 |
} |
|
1010 |
||
1011 |
/*! \reimp |
|
1012 |
*/ |
|
1013 |
void QWebView::dragMoveEvent(QDragMoveEvent* ev) |
|
1014 |
{
|
|
1015 |
#ifndef QT_NO_DRAGANDDROP |
|
1016 |
if (d->page) |
|
1017 |
d->page->event(ev); |
|
1018 |
#endif |
|
1019 |
} |
|
1020 |
||
1021 |
/*! \reimp |
|
1022 |
*/ |
|
1023 |
void QWebView::dropEvent(QDropEvent* ev) |
|
1024 |
{
|
|
1025 |
#ifndef QT_NO_DRAGANDDROP |
|
1026 |
if (d->page) |
|
1027 |
d->page->event(ev); |
|
1028 |
#endif |
|
1029 |
} |
|
1030 |
||
1031 |
/*! \reimp |
|
1032 |
*/ |
|
1033 |
bool QWebView::focusNextPrevChild(bool next) |
|
1034 |
{
|
|
1035 |
if (d->page && d->page->focusNextPrevChild(next)) |
|
1036 |
return true; |
|
1037 |
return QWidget::focusNextPrevChild(next); |
|
1038 |
} |
|
1039 |
||
1040 |
/*!\reimp |
|
1041 |
*/ |
|
1042 |
QVariant QWebView::inputMethodQuery(Qt::InputMethodQuery property) const |
|
1043 |
{
|
|
1044 |
if (d->page) |
|
1045 |
return d->page->inputMethodQuery(property); |
|
1046 |
return QVariant(); |
|
1047 |
} |
|
1048 |
||
1049 |
/*!\reimp |
|
1050 |
*/ |
|
1051 |
void QWebView::inputMethodEvent(QInputMethodEvent *e) |
|
1052 |
{
|
|
1053 |
if (d->page) |
|
1054 |
d->page->event(e); |
|
1055 |
} |
|
1056 |
||
1057 |
/*!\reimp |
|
1058 |
*/ |
|
1059 |
void QWebView::changeEvent(QEvent *e) |
|
1060 |
{
|
|
1061 |
if (d->page && e->type() == QEvent::PaletteChange) |
|
1062 |
d->page->setPalette(palette()); |
|
1063 |
QWidget::changeEvent(e); |
|
1064 |
} |
|
1065 |
||
1066 |
/*! |
|
1067 |
\fn void QWebView::titleChanged(const QString &title) |
|
1068 |
||
1069 |
This signal is emitted whenever the \a title of the main frame changes. |
|
1070 |
||
1071 |
\sa title() |
|
1072 |
*/ |
|
1073 |
||
1074 |
/*! |
|
1075 |
\fn void QWebView::urlChanged(const QUrl &url) |
|
1076 |
||
1077 |
This signal is emitted when the \a url of the view changes. |
|
1078 |
||
1079 |
\sa url(), load() |
|
1080 |
*/ |
|
1081 |
||
1082 |
/*! |
|
1083 |
\fn void QWebView::statusBarMessage(const QString& text) |
|
1084 |
||
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1085 |
This signal is emitted when the status bar \a text is changed by the page. |
| 0 | 1086 |
*/ |
1087 |
||
1088 |
/*! |
|
1089 |
\fn void QWebView::iconChanged() |
|
1090 |
||
1091 |
This signal is emitted whenever the icon of the page is loaded or changes. |
|
1092 |
||
1093 |
In order for icons to be loaded, you will need to set an icon database path |
|
1094 |
using QWebSettings::setIconDatabasePath(). |
|
1095 |
||
1096 |
\sa icon(), QWebSettings::setIconDatabasePath() |
|
1097 |
*/ |
|
1098 |
||
1099 |
/*! |
|
1100 |
\fn void QWebView::loadStarted() |
|
1101 |
||
1102 |
This signal is emitted when a new load of the page is started. |
|
1103 |
||
1104 |
\sa loadProgress(), loadFinished() |
|
1105 |
*/ |
|
1106 |
||
1107 |
/*! |
|
1108 |
\fn void QWebView::loadFinished(bool ok) |
|
1109 |
||
1110 |
This signal is emitted when a load of the page is finished. |
|
1111 |
\a ok will indicate whether the load was successful or any error occurred. |
|
1112 |
||
1113 |
\sa loadStarted() |
|
1114 |
*/ |
|
1115 |
||
1116 |
/*! |
|
1117 |
\fn void QWebView::selectionChanged() |
|
1118 |
||
1119 |
This signal is emitted whenever the selection changes. |
|
1120 |
||
1121 |
\sa selectedText() |
|
1122 |
*/ |
|
1123 |
||
1124 |
/*! |
|
1125 |
\fn void QWebView::loadProgress(int progress) |
|
1126 |
||
1127 |
This signal is emitted every time an element in the web page |
|
1128 |
completes loading and the overall loading progress advances. |
|
1129 |
||
1130 |
This signal tracks the progress of all child frames. |
|
1131 |
||
1132 |
The current value is provided by \a progress and scales from 0 to 100, |
|
1133 |
which is the default range of QProgressBar. |
|
1134 |
||
1135 |
\sa loadStarted(), loadFinished() |
|
1136 |
*/ |
|
1137 |
||
1138 |
/*! |
|
1139 |
\fn void QWebView::linkClicked(const QUrl &url) |
|
1140 |
||
1141 |
This signal is emitted whenever the user clicks on a link and the page's linkDelegationPolicy |
|
1142 |
property is set to delegate the link handling for the specified \a url. |
|
1143 |
||
1144 |
\sa QWebPage::linkDelegationPolicy() |
|
1145 |
*/ |
|
1146 |
||
1147 |
#include "moc_qwebview.cpp" |
|
1148 |