aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/xmlhttprequest/xmlhttprequest.qml
diff options
context:
space:
mode:
authorOliver Eftevaag <oliver.eftevaag@qt.io>2021-08-13 09:56:59 +0200
committerOliver Eftevaag <oliver.eftevaag@qt.io>2021-09-03 10:39:37 +0200
commit5d751f3ce6e2b5758dd0f1184d59e69370cdeb8a (patch)
tree86c9b5f6b1ad707e2dcb9993fd9cdd0ba91900f4 /examples/qml/xmlhttprequest/xmlhttprequest.qml
parentb0e567e7e3927945c904e9a613af4b9064d70bc1 (diff)
Simplify the XmlHttpRequest example
The XmlHttpRequest example contains a lot of unnecessary code, and I felt that most of it could just be removed. The point of the example project is to showcase how to use the XMLHttpRequest javascript object to make requests. Which is why I felt that we could remove any outside dependencies for the project (like the LauncherList from the 'quick/shared' directory), and reduce the amount of components down to the minimum. Fixes: QTBUG-95734 Pick-to: 6.2 Change-Id: I9b062f4d7e942db4a2669a8c65f7488aa4a54740 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'examples/qml/xmlhttprequest/xmlhttprequest.qml')
-rw-r--r--examples/qml/xmlhttprequest/xmlhttprequest.qml29
1 files changed, 20 insertions, 9 deletions
diff --git a/examples/qml/xmlhttprequest/xmlhttprequest.qml b/examples/qml/xmlhttprequest/xmlhttprequest.qml
index e6c7b10e16..31aa1824e9 100644
--- a/examples/qml/xmlhttprequest/xmlhttprequest.qml
+++ b/examples/qml/xmlhttprequest/xmlhttprequest.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,17 +48,28 @@
**
****************************************************************************/
-import QtQuick 2.0
-import "../../quick/shared" as Examples
+import QtQuick
+import QtQuick.Controls
+import "methods.js" as Utils
+
Item {
height: 480
width: 320
- Examples.LauncherList {
- id: ll
- anchors.fill: parent
- Component.onCompleted: {
- addExample("Get data", "Send get request and show received header and body", Qt.resolvedUrl("Get.qml"));
- }
+
+ property alias msg: ttext
+
+ Label { id: ttext; anchors.fill: parent; anchors.margins: 10 }
+
+ Button {
+ id: button
+ anchors.horizontalCenter: parent.horizontalCenter;
+ anchors.bottom: parent.bottom
+ anchors.margins: 10
+ antialiasing: true
+
+ text: qsTr("Request data.xml")
+
+ onClicked: Utils.makeRequest()
}
}