diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-12-01 13:10:00 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-12-03 08:20:52 +0100 |
commit | 34efbd202287b0fd0611b48938a1678edb2b2e45 (patch) | |
tree | 0e9b28fe393af34f870e9eea8b8de198e78f2432 /src/qml/doc/snippets | |
parent | fa60900205a2f6ace81273a404cbcb93e04d211a (diff) |
doc: Add a section about singleton types in qt_add_qml_module
QT_QML_SINGLETON_TYPE was only documented on the qt_target_qml_sources
page. Add a short section about singletons to the qt_add_qml_module
page and reference the other page.
Adjust the example in qt_target_qml_sources to show case how to set
the singleton source property.
Pick-to: 6.2
Fixes: QTBUG-97541
Change-Id: I11aa3cb7c0feb748eba1d7ac9ef81a8ac6cb16b1
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'src/qml/doc/snippets')
-rw-r--r-- | src/qml/doc/snippets/cmake/qt_target_qml_sources/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/qml/doc/snippets/cmake/qt_target_qml_sources/FunnySingleton.qml | 56 |
2 files changed, 60 insertions, 0 deletions
diff --git a/src/qml/doc/snippets/cmake/qt_target_qml_sources/CMakeLists.txt b/src/qml/doc/snippets/cmake/qt_target_qml_sources/CMakeLists.txt index 0bba788b20..d33f009e38 100644 --- a/src/qml/doc/snippets/cmake/qt_target_qml_sources/CMakeLists.txt +++ b/src/qml/doc/snippets/cmake/qt_target_qml_sources/CMakeLists.txt @@ -14,6 +14,9 @@ set_source_files_properties(TemplateFile.qml PROPERTIES QT_QML_SKIP_QMLLINT TRUE QT_QML_SKIP_CACHEGEN TRUE ) +set_source_files_properties(FunnySingleton.qml PROPERTIES + QT_QML_SINGLETON_TYPE TRUE +) qt_add_qml_module(qt_target_qml_sources_example URI Example VERSION 2.3 @@ -21,6 +24,7 @@ qt_add_qml_module(qt_target_qml_sources_example QML_FILES nested/way/down/File.qml TemplateFile.qml + FunnySingleton.qml ) set_source_files_properties(some_old_thing.qml PROPERTIES diff --git a/src/qml/doc/snippets/cmake/qt_target_qml_sources/FunnySingleton.qml b/src/qml/doc/snippets/cmake/qt_target_qml_sources/FunnySingleton.qml new file mode 100644 index 0000000000..4aec01c32d --- /dev/null +++ b/src/qml/doc/snippets/cmake/qt_target_qml_sources/FunnySingleton.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation 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] +pragma Singleton +import QtQml + +QtObject {} +//! [0] |