summaryrefslogtreecommitdiffstats
path: root/examples/webview
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <[email protected]>2014-08-20 10:28:12 +0200
committerEskil Abrahamsen Blomfeldt <[email protected]>2014-08-20 10:30:13 +0200
commita2dd3fb028d731b3971e442db81b693c98849900 (patch)
tree457a392b5710da2f0f8f170ba105623239fcd297 /examples/webview
Long live Qt Web View!
Diffstat (limited to 'examples/webview')
-rw-r--r--examples/webview/webview.pro2
-rw-r--r--examples/webview/webview/deployment.pri27
-rw-r--r--examples/webview/webview/doc/images/qtwebview-example.pngbin0 -> 103586 bytes
-rw-r--r--examples/webview/webview/doc/src/webview.qdoc37
-rw-r--r--examples/webview/webview/main.cpp52
-rw-r--r--examples/webview/webview/main.qml103
-rw-r--r--examples/webview/webview/qml.qrc5
-rw-r--r--examples/webview/webview/webview.pro13
8 files changed, 239 insertions, 0 deletions
diff --git a/examples/webview/webview.pro b/examples/webview/webview.pro
new file mode 100644
index 0000000..38985c5
--- /dev/null
+++ b/examples/webview/webview.pro
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS += webview
diff --git a/examples/webview/webview/deployment.pri b/examples/webview/webview/deployment.pri
new file mode 100644
index 0000000..5441b63
--- /dev/null
+++ b/examples/webview/webview/deployment.pri
@@ -0,0 +1,27 @@
+android-no-sdk {
+ target.path = /data/user/qt
+ export(target.path)
+ INSTALLS += target
+} else:android {
+ x86 {
+ target.path = /libs/x86
+ } else: armeabi-v7a {
+ target.path = /libs/armeabi-v7a
+ } else {
+ target.path = /libs/armeabi
+ }
+ export(target.path)
+ INSTALLS += target
+} else:unix {
+ isEmpty(target.path) {
+ qnx {
+ target.path = /tmp/$${TARGET}/bin
+ } else {
+ target.path = /opt/$${TARGET}/bin
+ }
+ export(target.path)
+ }
+ INSTALLS += target
+}
+
+export(INSTALLS)
diff --git a/examples/webview/webview/doc/images/qtwebview-example.png b/examples/webview/webview/doc/images/qtwebview-example.png
new file mode 100644
index 0000000..40f2611
--- /dev/null
+++ b/examples/webview/webview/doc/images/qtwebview-example.png
Binary files differ
diff --git a/examples/webview/webview/doc/src/webview.qdoc b/examples/webview/webview/doc/src/webview.qdoc
new file mode 100644
index 0000000..034be45
--- /dev/null
+++ b/examples/webview/webview/doc/src/webview.qdoc
@@ -0,0 +1,37 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \title Qt WebView Examples - WebView
+ \example qtwebview
+ \brief WebView is an example that demonstrates how to use the Qt WebView module with Qt Quick.
+ \image qtwebview-example.png
+ \ingroup qtwebview-examples
+
+ The WebView example creates a simple browser using Qt Quick Controls
+ and Qt WebView.
+*/
diff --git a/examples/webview/webview/main.cpp b/examples/webview/webview/main.cpp
new file mode 100644
index 0000000..8525bc2
--- /dev/null
+++ b/examples/webview/webview/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+
+ return app.exec();
+}
diff --git a/examples/webview/webview/main.qml b/examples/webview/webview/main.qml
new file mode 100644
index 0000000..5b1e951
--- /dev/null
+++ b/examples/webview/webview/main.qml
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Dialogs 1.2
+import QtWebView 1.0
+
+ApplicationWindow {
+ id: topLevel
+ visible: true
+ width: 640
+ height: 480
+ title: qsTr("QtWebView Browser")
+
+ Label {
+ id: title
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ horizontalAlignment: Label.AlignHCenter
+ text: webView.title
+ }
+
+ Rectangle {
+ id: addressBar
+ anchors.top: title.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: parent.height / 10
+ color: "black"
+
+ Button {
+ id: goButton
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ anchors.margins: topLevel.width / 30
+ text: qsTr("Go")
+ onClicked: {
+ webView.url = addressField.text
+ }
+ }
+
+ TextField {
+ id: addressField
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: goButton.left
+ anchors.margins: topLevel.width / 30
+ }
+ }
+
+ WebView {
+ id: webView
+ anchors.top: addressBar.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ url: "http://qt-project.org"
+ onUrlChanged: {
+ addressField.text = url
+ }
+ }
+}
diff --git a/examples/webview/webview/qml.qrc b/examples/webview/webview/qml.qrc
new file mode 100644
index 0000000..5f6483a
--- /dev/null
+++ b/examples/webview/webview/qml.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/webview/webview/webview.pro b/examples/webview/webview/webview.pro
new file mode 100644
index 0000000..77cbe78
--- /dev/null
+++ b/examples/webview/webview/webview.pro
@@ -0,0 +1,13 @@
+TEMPLATE = app
+
+QT += qml quick
+
+SOURCES += main.cpp
+
+RESOURCES += qml.qrc
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH =
+
+# Default rules for deployment.
+include(deployment.pri)