Commit Graph

32 Commits

Author SHA1 Message Date
Safiyyah Moosa db3120ddec Doc: Remove irrelevant images from Qt QML docs
Currently there are two images that serve no purpose in the docs,
as they do not provide any useful information.

This patch removes the following images:
- qml-i18n-example.png
- extending-qml-advanced-word-cloud.png

Fixes: QTBUG-137124
Change-Id: I224fc18eca8a59373fa1b48973816ad826a94625
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2025-05-26 17:05:21 +02:00
Ulf Hermann 277121d4a5 Doc: Mention resource prefix in docs about translations
If you use QQmlApplicationEngine to auto-load translations you need to
make them visible by placing them inside the relevant QML module.

Pick-to: 6.9 6.8
Fixes: QTBUG-116588
Change-Id: I4b768c6ad6ef763a5d6c43aaa794860f7751398a
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-02-21 16:20:38 +01:00
Fabian Kosmale 2a32ec77c0 examples: Consistently require Qt 6.8
This prevents policy warnings in a few cases, and we want people to
opt-in to new policies, so make our examples copy'n'paste friendly.

Pick-to: 6.8
Task-number: QTBUG-126201
Task-number: QTBUG-126468
Change-Id: Iefa666b61c2d2f767da3583f0f6efd8e4a2169e5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2024-07-03 08:43:43 +02:00
Olivier De Cannière a8f6a298ae Examples: Port the i18n example to loadFromModule
Change-Id: I81946dc3e1c23f0a0f2eaad866deff652a7c0563
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2024-04-04 10:46:13 +02:00
Alexandru Croitor a6bd1dc3e0 CMake: Add deployment API to our examples
Projects were modified using the tool at:
https://git.qt.io/alcroito/cmake_refactor

A few examples had to be adapted manually, mostly those that build
additional qml modules / plugins.

The INSTALL_EXAMPLESDIR and INSTALL_EXAMPLEDIR assignments were
removed, these are not needed anymore because example directory
selection is handled by the qt_internal_add_example calls.

The install(TARGETS) calls were modified according to our
documentation snippets for qt_generate_deploy_qml_app_script.

A qt_generate_deploy_qml_app_script call was added for each
executable target.

Note that the deployment step will be skipped in the CI for now,
because:
- we enable QT_DEPLOY_MINIMAL_EXAMPLES in the CI instructions and thus
  set QT_INTERNAL_SKIP_DEPLOYMENT to true
- standalone examples feature is not yet enabled in the CI, which
  means we continue to build examples in-tree, and deployment is
  disabled for in-tree prefix builds.
A small list of examples to deploy in the CI will be chosen in the
future, to ensure deployment coverage, without slowing down overall CI
times due to all the *deployqt invocations.

Even if deployment is disabled in the CI, the install(TARGETS) calls
for each example will still run, installing into an
'installed_examples' directory, which will not be archived by the CI.

The QtBundleQmlModuleForMacOS and bundle_shared code was removed,
because we can now depend on the MACOS_BUNDLE_POST_BUILD option of the
deployment api, to ensure macOS bundle examples run properly in the
build dir. This works even in prefix in-tree builds, when installation
deployment is disabled.

Finally, for all examples that build additional qml module libraries or
plugins, the libraries / plugins must be installed into the bin dir of
each project, along with a qmldir file.

This is to support running the installed project for platforms that
don't have deployment api yet, like boot2qt / yocto.

If we want to have super clean install / deployment rules in the
future, we won't be able to avoid adding ugly per-platform conditions.
The current status quo is deemed an improvement over what we had
before.

Pick-to: 6.7
Task-number: QTBUG-101340
Task-number: QTBUG-102056
Task-number: QTBUG-102057
Change-Id: I843d934668c25dbcd1abca52495b393579633fc5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-03-27 18:57:34 +01:00
Lucie Gérard 53295d9102 Correct license for examples files
Example takes precedent over build system file type.
According to QUIP-18 [1], all examples file should be
LicenseRef-Qt-Commercial OR BSD-3-Clause

[1]: https://contribute.qt-project.org/quips/18

Pick-to: 6.7 6.7.0
Task-number: QTBUG-121787
Change-Id: Ie8c2539e7659f53a1fd6b48f99ee883ee9aeb0a7
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2024-03-21 10:41:29 +01:00
Joerg Bornemann 7d1dd8d71d CMake: Rename I18N_*LANGUAGES variables and parameters
...according to the Qt 6.7 CMake API review.

Pick-to: 6.7
Task-number: QTBUG-122396
Change-Id: I36d716845d2ce9ed09ed9840f7a1564f59f36977
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-02-21 14:27:54 +01:00
Ulf Hermann 4dd7f9a102 Examples: Fix qmake version of qml-i18n example
Now that we load the QML file from a different resource directory we
have to adapt the resource paths in qmake, too.

Amends commit 69fce1185f.

Pick-to: 6.6 6.5
Change-Id: I25f3e0f1f77ad365426b859c5adc08b429976da3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-10-26 19:45:06 +02:00
Ulf Hermann 69fce1185f QML: Fix i18n example
We shouldn't use NO_RESOURCE_TARGET_PATH. Instead we can put the
translation into the QML module directory. This highlights that
qt_add_qml_module needs an option for adding translations.

Task-number: QTBUG-116588
Task-number: QTBUG-116589
Pick-to: 6.6 6.5
Change-Id: Ib60ec5eedbb395674fdcb9da8fd00ae2663620cc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-10-24 18:44:55 +02:00
Joerg Bornemann 89458093b9 Examples: Use the revisited qt_add_translations signature
Instead of specifying .ts files, we specify languages now.

The i18n/base.ts file is not supposed to be part of the project. It
serves as template for new translations. See the qml-i18n example's
documentation page.

Task-number: QTBUG-117463
Change-Id: I232c1a856e652fc6a31233e7119a1508fba49987
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Serg Kryvonos <serg.kryvonos@qt.io>
2023-10-05 11:38:06 +02:00
Inkamari Harjula 7cead93326 Doc: Add example category
Added example category User Interface Components to qtqml i18n file.

Task-number: QTBUG-116537
Pick-to: 6.5 6.6
Change-Id: Idef277a87b18134dbc40878bae7784820b4dd07e
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-09-11 07:50:12 +03:00
Kai Köhne 2e6403f8bf Examples: Use versioned CMake targets for Qt modules
Use e.g. Qt6::Core instead of Qt::Core. This is better matching the
find_package(Qt6 ...) call, and also avoids issues that the versionless
targets have.

Pick-to: 6.5
Task-number: QTBUG-113277
Change-Id: Ib80f885e9f73fb9ad54b9e9b22cae2318877dc07
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-02 12:12:35 +02:00
Ulf Hermann 2d44365f69 CMake: Allow omitting the version of QML modules
Also, drop all the VERSION 1.0 lines from the examples and tests. 1.0 is
actually a bad default version since it's before all the Qt versions.

[ChangeLog][QML] You can now omit the VERSION argument to
qt_add_qml_module(). This will automatically generate the highest
possible version.

Pick-to: 6.5
Task-number: QTBUG-99146
Change-Id: Ic10ec69b87c224e0e94e1785f65653815d4c778c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2023-01-27 19:16:39 +01:00
Leena Miettinen 18359e2244 Doc: Update QML I18N example docs
Describe the use of qsTr() and QQmlApplicationEngine, as well
as the CMake qt_add_translations command.

Task-number: QTBUG-110009
Change-Id: I7d2244a772fdb132acdb5f9f66294a7d772e0d36
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2023-01-18 15:50:31 +01:00
Lucie Gérard 1b9808737a Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: Id89ed14990804a5024183e75382cc539d4293da1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-09-07 17:01:30 +02:00
Kai Köhne b7f448f864 Examples: Do not use import version numbers anymore
Pick-to: 6.4
Change-Id: I1f4d4920bb9d132a846ac2dbcfdb8b660759d540
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-31 16:37:35 +02:00
Lucie Gérard 5a7b716474 Add license headers to cmake files
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.

Existing copyright statements remain intact

Task-number: QTBUG-88621
Change-Id: I72c89a98c42bbc9234d8495e9e503bec81d11037
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-07-08 10:41:06 +02:00
Lucie Gérard 0dc4fd240a Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-06-11 08:05:15 +02:00
Ulf Hermann 4a32ceec40 Fix URI of i18n example
It shouldn't be "dynamicscene" as that URI is already used by a
different example.

Change-Id: I35ac6b7ea70703f24304f640252f922d6a5b2371
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-02 02:42:52 +02:00
Fabian Kosmale 612d988243 Add cmake support for examples
qml-i18n needed to be ported to CMake first. It uses qt_add_translations
introduced in 6.2

As a drive-by, move find_package calls from examples' CML to the top
level CML, and make the QtSql dependency optional. Also make sure that
we only add the dynamicscene example when the Quick target is available.

Pick-to: 6.2 6.3
Fixes: QTBUG-90964
Change-Id: Id357eb14e4704753386e01393300966eb89b4e86
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-29 22:12:43 +02:00
Tor Arne Vestbø d0eb261836 Remove use of deprecated High-DPI application attributes
Change-Id: Ibfb50fdcbb51ba93d6e5d11f9e8ce0e7b3bfde79
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-09-02 17:17:33 +02:00
Assam Boudjelthia 069afedec9 Examples: add .pro project for qml-i18n example
Currently only the .qmlproject is available for this project, which
won't deploy on Android, thus adding .pro project files. Also, since
the translation won't work without the *.qm files being present as
resources, those files are included by default with example.

Task-number: QTBUG-80717
Change-Id: I86ac6c4097e4207b7f62d628f9a72439e78639db
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-03-05 11:18:50 +02:00
Kai Koehne 369998639b i18n examples: Add en translation dummies
We endorse using QTranslator::install(const QLocale&...), because
it tries loading translations from all QLocale::uiLanguages() instead
of the commonly used QLocale::system().name() setup.

Anyhow, the first method requires an English translation - otherwise
a second favorite language might be used.

Pave the way to making the switch by adding (empty) English translations
to our examples.

Task-number: QTBUG-69196
Change-Id: Ie85be875e34e29e80c1693bbf477b962e35a7d87
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2018-07-17 08:55:11 +00:00
Kai Koehne 33a9fb9f4b i18n examples: Update .ts files
Change-Id: I3c1987bac8251b087fab98d6caaaba267dcc4be8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-07-17 08:55:06 +00:00
Paul Wicking ed3a93feee Doc: Add missing dots (qtdeclarative)
Task-number: QTBUG-68933
Change-Id: Ibb5aa227e82825085e7214e17dcffcb17fd44157
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2018-06-19 12:44:48 +00:00
Kai Koehne 341a04377b Fix outdated FDL license header
Change-Id: I76dccf547de40b5e72fd7abaa062fa96cb2c118a
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2017-10-17 11:18:21 +00:00
Kai Koehne ea6cd0de3c Fix outdated BSD license header
Change-Id: Icc08925454445fc9497fb3bfd2c26efe90605983
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2017-10-17 11:18:11 +00:00
Simon Hausmann 2647ea9481 Fix qml-i18n example
Commit f0e2853818 renamed the example, but
it did not adjust the context in the translations. From that point on the
context didn't match anymore and the entire example stopped working.

Change-Id: I491d518235aea07768b69c52d13b2bbf5060f61f
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2015-05-05 07:38:58 +00:00
Jani Heikkinen 20c207815a Fixed license headers
Change-Id: I4d5640ff95e1361ec7e65fb3e87d7726d8185ff5
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
2015-02-17 13:33:18 +00:00
Jani Heikkinen c5796292ad Update copyright headers
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.

Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9
Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
2015-02-12 10:28:11 +00:00
Sze Howe Koh ef9f85ad8d Doc: Fix broken links
Change-Id: I4c4577edde96978a986606bf30fbb925f871bd42
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2013-12-30 12:13:29 +01:00
Jerome Pasion f0e2853818 Doc: Renamed and moved examples/qml/i18n to examples/qml/qml-i18n
-the generated HTML page conflicts with the i18n.html page from qtdoc.
-edited the content.

Task-number: QTBUG-32580
Change-Id: I32ded1913d9faecb95e28043983e957ccd0e8749
Reviewed-by: Martin Smith <martin.smith@digia.com>
2013-08-13 14:52:27 +02:00