|
@@ -9,6 +9,8 @@ Even the program'@q'@>s about window is primarily a web view.
|
9
|
9
|
In order to simplify the implementation of certain features, we subclass
|
10
|
10
|
|QWebView| and provide some additional functionality.
|
11
|
11
|
|
|
12
|
+@s QWebElement int
|
|
13
|
+
|
12
|
14
|
@(webview.h@>=
|
13
|
15
|
#include <QWebView>
|
14
|
16
|
#include <QFile>
|
|
@@ -22,21 +24,21 @@ In order to simplify the implementation of certain features, we subclass
|
22
|
24
|
#ifndef TypicaWebViewHeader
|
23
|
25
|
#define TypicaWebViewHeader
|
24
|
26
|
|
25
|
|
-class TypicaWebView : public QWebView
|
|
27
|
+class TypicaWebView : public QWebView@/
|
26
|
28
|
{
|
27
|
|
- Q_OBJECT
|
28
|
|
- public:
|
|
29
|
+ @[Q_OBJECT@]@;
|
|
30
|
+ public:@/
|
29
|
31
|
TypicaWebView();
|
30
|
|
- Q_INVOKABLE void load(const QString &url);
|
31
|
|
- Q_INVOKABLE void print();
|
32
|
|
- Q_INVOKABLE void setHtml(const QString &html, const QUrl &baseUrl = QUrl());
|
33
|
|
- Q_INVOKABLE void setContent(QIODevice *device);
|
34
|
|
- Q_INVOKABLE QString saveXml();
|
35
|
|
- Q_INVOKABLE QWebElement documentElement();
|
36
|
|
- Q_INVOKABLE QWebElement findFirstElement(const QString &selector);
|
37
|
|
- signals:
|
|
32
|
+ @[Q_INVOKABLE@,@, void@]@, load(const QString &url);@t\2\2@>@/
|
|
33
|
+ @[Q_INVOKABLE@,@, void@]@, print();@t\2\2@>@/
|
|
34
|
+ @[Q_INVOKABLE@,@, void@]@, setHtml(const QString &html, const QUrl &baseUrl = QUrl());@t\2\2@>@/
|
|
35
|
+ @[Q_INVOKABLE@,@, void@]@, setContent(QIODevice *device);@t\2\2@>@/
|
|
36
|
+ @[Q_INVOKABLE@,@, QString@]@, saveXml();@t\2\2@>@/
|
|
37
|
+ @[Q_INVOKABLE@,@, QWebElement@]@, documentElement();@t\2\2@>@/
|
|
38
|
+ @[Q_INVOKABLE@,@, QWebElement@]@, findFirstElement(const QString &selector);@t\2\2@>@/
|
|
39
|
+ @[signals@]:@/
|
38
|
40
|
void scriptLinkClicked(const QString &link);
|
39
|
|
- private slots:
|
|
41
|
+ @[private slots@]:@/
|
40
|
42
|
void linkDelegate(const QUrl &url);
|
41
|
43
|
};
|
42
|
44
|
|
|
@@ -228,7 +230,7 @@ QScriptValue QWebElement_toScriptValue(QScriptEngine *engine, const QWebElement
|
228
|
230
|
|
229
|
231
|
void QWebElement_fromScriptValue(const QScriptValue &value, QWebElement &element)
|
230
|
232
|
{
|
231
|
|
- element = value.toVariant().value<QWebElement>();
|
|
233
|
+ element = value.toVariant().@[value<QWebElement>()@];
|
232
|
234
|
}
|
233
|
235
|
|
234
|
236
|
@ These methods must be registered with the engine.
|
|
@@ -247,22 +249,22 @@ simple wrapper class.
|
247
|
249
|
#ifndef TypicaWebElementHeader
|
248
|
250
|
#define TypicaWebElementHeader
|
249
|
251
|
|
250
|
|
-class TypicaWebElement : public QObject
|
251
|
|
-{
|
252
|
|
- Q_OBJECT
|
253
|
|
- public:
|
|
252
|
+class TypicaWebElement : public QObject@/
|
|
253
|
+{@/
|
|
254
|
+ @[Q_OBJECT@]@;
|
|
255
|
+ public:@/
|
254
|
256
|
TypicaWebElement(QWebElement element);
|
255
|
|
- Q_INVOKABLE void appendInside(const QString &markup);
|
256
|
|
- Q_INVOKABLE void appendOutside(const QString &markup);
|
257
|
|
- Q_INVOKABLE void prependInside(const QString &markup);
|
258
|
|
- Q_INVOKABLE void prependOutside(const QString &markup);
|
259
|
|
- Q_INVOKABLE void removeFromDocument();
|
260
|
|
- Q_INVOKABLE void replace(const QString &markup);
|
261
|
|
- Q_INVOKABLE void setInnerXml(const QString &markup);
|
262
|
|
- Q_INVOKABLE void setOuterXml(const QString &markup);
|
263
|
|
- Q_INVOKABLE void setPlainText(const QString &text);
|
264
|
|
- private:
|
265
|
|
- QWebElement e;
|
|
257
|
+ @[Q_INVOKABLE@,@, void@]@, appendInside(const QString &markup);@t\2\2@>@/
|
|
258
|
+ @[Q_INVOKABLE@,@, void@]@, appendOutside(const QString &markup);@t\2\2@>@/
|
|
259
|
+ @[Q_INVOKABLE@,@, void@]@, prependInside(const QString &markup);@t\2\2@>@/
|
|
260
|
+ @[Q_INVOKABLE@,@, void@]@, prependOutside(const QString &markup);@t\2\2@>@/
|
|
261
|
+ @[Q_INVOKABLE@,@, void@]@, removeFromDocument();@t\2\2@>@/
|
|
262
|
+ @[Q_INVOKABLE@,@, void@]@, replace(const QString &markup);@t\2\2@>@/
|
|
263
|
+ @[Q_INVOKABLE@,@, void@]@, setInnerXml(const QString &markup);@t\2\2@>@/
|
|
264
|
+ @[Q_INVOKABLE@,@, void@]@, setOuterXml(const QString &markup);@t\2\2@>@/
|
|
265
|
+ @[Q_INVOKABLE@,@, void@]@, setPlainText(const QString &text);@t\2\2@>@/
|
|
266
|
+ private:@/
|
|
267
|
+ QWebElement e;@/
|
266
|
268
|
};
|
267
|
269
|
|
268
|
270
|
#endif
|