diff options
Diffstat (limited to 'examples/quick/threading')
16 files changed, 0 insertions, 948 deletions
diff --git a/examples/quick/threading/CMakeLists.txt b/examples/quick/threading/CMakeLists.txt deleted file mode 100644 index 3dcc58158e..0000000000 --- a/examples/quick/threading/CMakeLists.txt +++ /dev/null @@ -1,130 +0,0 @@ -# Generated from threading.pro. - -cmake_minimum_required(VERSION 3.14) -project(threading LANGUAGES CXX) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/threading") - -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Quick) -find_package(Qt6 COMPONENTS Qml) - -qt_add_executable(threading - main.cpp -) -set_target_properties(threading PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) -target_link_libraries(threading PUBLIC - Qt::Core - Qt::Gui - Qt::Qml - Qt::Quick -) - - -# Resources: -set(threading_resource_files - "threadedlistmodel/dataloader.mjs" - "threadedlistmodel/timedisplay.qml" - "threading.qml" - "workerscript/Spinner.qml" - "workerscript/workerscript.mjs" - "workerscript/workerscript.qml" -) - -qt6_add_resources(threading "threading" - PREFIX - "/threading" - FILES - ${threading_resource_files} -) -set_source_files_properties("../shared/Button.qml" - PROPERTIES QT_RESOURCE_ALIAS "Button.qml" -) -set_source_files_properties("../shared/CheckBox.qml" - PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" -) -set_source_files_properties("../shared/FlickrRssModel.qml" - PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" -) -set_source_files_properties("../shared/Label.qml" - PROPERTIES QT_RESOURCE_ALIAS "Label.qml" -) -set_source_files_properties("../shared/LauncherList.qml" - PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" -) -set_source_files_properties("../shared/SimpleLauncherDelegate.qml" - PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" -) -set_source_files_properties("../shared/Slider.qml" - PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" -) -set_source_files_properties("../shared/TabSet.qml" - PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" -) -set_source_files_properties("../shared/TextField.qml" - PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" -) -set_source_files_properties("../shared/images/back.png" - PROPERTIES QT_RESOURCE_ALIAS "images/back.png" -) -set_source_files_properties("../shared/images/checkmark.png" - PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" -) -set_source_files_properties("../shared/images/next.png" - PROPERTIES QT_RESOURCE_ALIAS "images/next.png" -) -set_source_files_properties("../shared/images/qt-logo.png" - PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" -) -set_source_files_properties("../shared/images/slider_handle.png" - PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" -) -set_source_files_properties("../shared/images/tab.png" - PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" -) -set(shared_resource_files - "Button.qml" - "CheckBox.qml" - "FlickrRssModel.qml" - "Label.qml" - "LauncherList.qml" - "SimpleLauncherDelegate.qml" - "Slider.qml" - "TabSet.qml" - "TextField.qml" - "images/back.png" - "images/checkmark.png" - "images/next.png" - "images/qt-logo.png" - "images/slider_handle.png" - "images/tab.png" -) - -qt6_add_resources(threading "shared" - PREFIX - "/shared" - BASE - "../shared" - FILES - ${shared_resource_files} -) - -install(TARGETS threading - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/quick/threading/doc/images/qml-threading-example.png b/examples/quick/threading/doc/images/qml-threading-example.png Binary files differdeleted file mode 100644 index 6ed79ab190..0000000000 --- a/examples/quick/threading/doc/images/qml-threading-example.png +++ /dev/null diff --git a/examples/quick/threading/doc/src/threading.qdoc b/examples/quick/threading/doc/src/threading.qdoc deleted file mode 100644 index f5e5139916..0000000000 --- a/examples/quick/threading/doc/src/threading.qdoc +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ -/*! - \title Qt Quick Examples - Threading - \example threading - \brief This is a collection of QML multithreading examples. - \image qml-threading-example.png - \ingroup qtquickexamples - - \e Threading is a collection of QML multithreading examples. - - \include examples-run.qdocinc - - \section1 Threaded ListModel - - \e{Threaded ListModel} contains a \l ListView and a \l ListModel. - The ListModel object is updated asynchronously in another thread, and the - results propagate back to the main thread. A timer requests updates from the - worker thread periodically: - \snippet threading/threadedlistmodel/timedisplay.qml 0 - - Inside the worker thread, the ListModel is synchronized once the data is - finished loading: - \snippet threading/threadedlistmodel/dataloader.mjs 0 - - \section1 WorkerScript - - \e WorkerScript contains an example of using a \l WorkerScript to offload - expensive calculations into another thread. This keeps the UI from being - blocked. This example calculates numbers in Pascal's Triangle, and not in a - very optimal way, so it will often take several seconds to complete the - calculation. By doing this in a WorkerScript in another thread, the UI is - not blocked during this time. - - When the UI needs another value, a request is sent to the WorkerScript: - \snippet threading/workerscript/workerscript.qml 0 - - The workerscript then is free to take a really long time to calculate it: - \snippet threading/workerscript/workerscript.mjs 0 - - When it's done, the result returns to the main scene via the WorkerScript - type: - \snippet threading/workerscript/workerscript.qml 1 -*/ diff --git a/examples/quick/threading/main.cpp b/examples/quick/threading/main.cpp deleted file mode 100644 index 75b6cab482..0000000000 --- a/examples/quick/threading/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(threading/threading) diff --git a/examples/quick/threading/threadedlistmodel/dataloader.mjs b/examples/quick/threading/threadedlistmodel/dataloader.mjs deleted file mode 100644 index 86a4424dbc..0000000000 --- a/examples/quick/threading/threadedlistmodel/dataloader.mjs +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -// ![0] -WorkerScript.onMessage = function(msg) { - if (msg.action == 'appendCurrentTime') { - var data = {'time': new Date().toTimeString()}; - msg.model.append(data); - msg.model.sync(); // updates the changes to the list - } -} -// ![0] diff --git a/examples/quick/threading/threadedlistmodel/doc/src/threadedlistmodel.qdoc b/examples/quick/threading/threadedlistmodel/doc/src/threadedlistmodel.qdoc deleted file mode 100644 index 12596cfdac..0000000000 --- a/examples/quick/threading/threadedlistmodel/doc/src/threadedlistmodel.qdoc +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Threaded ListModel Example - \example threading/threadedlistmodel - \brief The Threaded ListModel example shows how to use a ListModel from multiple - threads using WorkerScript. - - This example shows how to use a ListModel from multiple threads using - WorkerScript. -*/ - diff --git a/examples/quick/threading/threadedlistmodel/threadedlistmodel.qmlproject b/examples/quick/threading/threadedlistmodel/threadedlistmodel.qmlproject deleted file mode 100644 index 361f4ba0d3..0000000000 --- a/examples/quick/threading/threadedlistmodel/threadedlistmodel.qmlproject +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 QmlProject 1.1 - -Project { - mainFile: "timedisplay.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/threading/threadedlistmodel/timedisplay.qml b/examples/quick/threading/threadedlistmodel/timedisplay.qml deleted file mode 100644 index c4e6e7b249..0000000000 --- a/examples/quick/threading/threadedlistmodel/timedisplay.qml +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.0 - -Rectangle { - color: "white" - width: 200 - height: 300 - - ListView { - anchors.fill: parent - model: listModel - delegate: Component { - Text { - required property string time - text: time - } - } - - ListModel { id: listModel } - - WorkerScript { - id: worker - source: "dataloader.mjs" - } - -// ![0] - Timer { - id: timer - interval: 2000; repeat: true - running: true - triggeredOnStart: true - - onTriggered: { - var msg = {'action': 'appendCurrentTime', 'model': listModel}; - worker.sendMessage(msg); - } - } -// ![0] - } -} diff --git a/examples/quick/threading/threading.pro b/examples/quick/threading/threading.pro deleted file mode 100644 index cd9ed25e0c..0000000000 --- a/examples/quick/threading/threading.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = app - -QT += quick qml -SOURCES += main.cpp -RESOURCES += \ - threading.qrc \ - ../shared/shared.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/threading -INSTALLS += target diff --git a/examples/quick/threading/threading.qml b/examples/quick/threading/threading.qml deleted file mode 100644 index 674e4a4bc6..0000000000 --- a/examples/quick/threading/threading.qml +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.0 -import "../shared" as Examples - -Item { - height: 480 - width: 320 - Examples.LauncherList { - id: ll - anchors.fill: parent - Component.onCompleted: { - addExample("Threaded ListModel", "Updates a ListModel in another thread", Qt.resolvedUrl("threadedlistmodel/timedisplay.qml")); - addExample("WorkerScript", "Performs calculations in another thread", Qt.resolvedUrl("workerscript/workerscript.qml")); - } - } -} diff --git a/examples/quick/threading/threading.qmlproject b/examples/quick/threading/threading.qmlproject deleted file mode 100644 index d17405d4dc..0000000000 --- a/examples/quick/threading/threading.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "threading.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/threading/threading.qrc b/examples/quick/threading/threading.qrc deleted file mode 100644 index 5dc6dff443..0000000000 --- a/examples/quick/threading/threading.qrc +++ /dev/null @@ -1,10 +0,0 @@ -<RCC> - <qresource prefix="/threading"> - <file>threading.qml</file> - <file>threadedlistmodel/timedisplay.qml</file> - <file>threadedlistmodel/dataloader.mjs</file> - <file>workerscript/Spinner.qml</file> - <file>workerscript/workerscript.mjs</file> - <file>workerscript/workerscript.qml</file> - </qresource> -</RCC> diff --git a/examples/quick/threading/workerscript/Spinner.qml b/examples/quick/threading/workerscript/Spinner.qml deleted file mode 100644 index a2257f8639..0000000000 --- a/examples/quick/threading/workerscript/Spinner.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.0 - -Rectangle { - width: 64 - height: 64 - property alias value: list.currentIndex - property alias label: caption.text - - Text { - id: caption - text: "Spinner" - anchors.horizontalCenter: parent.horizontalCenter - } - - Rectangle { - anchors.top: caption.bottom - anchors.topMargin: 4 - anchors.horizontalCenter: parent.horizontalCenter - height: 48 - width: 32 - color: "black" - ListView { - id: list - anchors.fill: parent - highlightRangeMode: ListView.StrictlyEnforceRange - preferredHighlightBegin: height/3 - preferredHighlightEnd: height/3 - clip: true - model: 64 - delegate: Text { - required property int index - font.pixelSize: 18; - color: "white"; - text: index; - anchors.horizontalCenter: parent.horizontalCenter - } - } - Rectangle { - anchors.fill: parent - gradient: Gradient { - GradientStop { position: 0.0; color: "#FF000000" } - GradientStop { position: 0.2; color: "#00000000" } - GradientStop { position: 0.8; color: "#00000000" } - GradientStop { position: 1.0; color: "#FF000000" } - } - } - } -} diff --git a/examples/quick/threading/workerscript/workerscript.mjs b/examples/quick/threading/workerscript/workerscript.mjs deleted file mode 100644 index 9953958086..0000000000 --- a/examples/quick/threading/workerscript/workerscript.mjs +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -//Will be initialized when WorkerScript{} is instantiated -var cache = new Array(64); -for (var i = 0; i < 64; i++) - cache[i] = new Array(64); - -function triangle(row, column) { - if (cache[row][column]) - return cache[row][column] - if (column < 0 || column > row) - return -1; - if (column == 0 || column == row) - return 1; - return triangle(row-1, column-1) + triangle(row-1, column); -} -//! [0] -WorkerScript.onMessage = function(message) { - //Calculate result (may take a while, using a naive algorithm) - var calculatedResult = triangle(message.row, message.column); - //Send result back to main thread - WorkerScript.sendMessage( { row: message.row, - column: message.column, - result: calculatedResult} ); -} -//! [0] diff --git a/examples/quick/threading/workerscript/workerscript.qml b/examples/quick/threading/workerscript/workerscript.qml deleted file mode 100644 index eb8ad43d01..0000000000 --- a/examples/quick/threading/workerscript/workerscript.qml +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.0 - -Rectangle { - width: 320; height: 480 - -//! [1] - WorkerScript { - id: myWorker - source: "workerscript.mjs" - - onMessage: (messageObject) => { - if (messageObject.row == rowSpinner.value && messageObject.column == columnSpinner.value){ //Not an old result - if (messageObject.result == -1) - resultText.text = "Column must be <= Row"; - else - resultText.text = messageObject.result; - } - } - } -//! [1] - Row { - y: 24 - spacing: 24 - anchors.horizontalCenter: parent.horizontalCenter -//! [0] - Spinner { - id: rowSpinner - label: "Row" - onValueChanged: { - resultText.text = "Loading..."; - myWorker.sendMessage( { row: rowSpinner.value, column: columnSpinner.value } ); - } - } -//! [0] - - Spinner { - id: columnSpinner - label: "Column" - onValueChanged: { - resultText.text = "Loading..."; - myWorker.sendMessage( { row: rowSpinner.value, column: columnSpinner.value } ); - } - } - } - - Text { - id: resultText - y: 180 - width: parent.width - horizontalAlignment: Text.AlignHCenter - wrapMode: Text.WordWrap - font.pixelSize: 32 - } - - Text { - text: "Pascal's Triangle Calculator" - anchors { horizontalCenter: parent.horizontalCenter; bottom: parent.bottom; bottomMargin: 50 } - } -} diff --git a/examples/quick/threading/workerscript/workerscript.qmlproject b/examples/quick/threading/workerscript/workerscript.qmlproject deleted file mode 100644 index 6ab433e63b..0000000000 --- a/examples/quick/threading/workerscript/workerscript.qmlproject +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 QmlProject 1.1 - -Project { - mainFile: "workerscript.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} |