Commit Graph

135 Commits

Author SHA1 Message Date
Mitch Curtis 53144f16c6 gallery: fix some QML compiler warnings
Not all compiler warnings can be fixed, because the example
supports multiple styles through one executable, and hence
cannot use compile-time style selection. Document this.

Fixes: QTBUG-110827
Pick-to: 6.5 6.6
Change-Id: I80a92890d427967ff21d4f457c373e75a937195f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-07-12 11:25:37 +08:00
Jan Arve Sæther 6e99bddb9e Move imagine/musicplayer to tests/manual/imagine/musicplayer
imagine/automotive already demonstrate the imagine style

Pick-to: 6.5 6.6
Task-number: QTBUG-108751
Change-Id: Ibb1fe187571b6693b85dfc0a310fc806908194dc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-07-10 13:07:04 +02:00
Santhosh Kumar 7c7e3a1fdf Add explicit option for landscape mode in gallery example
The patch set 730c1d1630 adds support for
landscape mode in gallery example. But this causes glitch when window
resizes dynamically (as in this scenario, the virtual keyboard shows up
and it dynamically resizes window).

This patch adds an option in settings to enable landscape mode only
when required and disabled by default.

Fixes: QTBUG-114693
Pick-to: 6.5 6.6
Change-Id: I64cd4d48ade10a4f43615663a0b7aef3e13a2895
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-07-10 13:07:04 +02:00
Olivier De Cannière fb64096a25 Fix wearable example on macOS and Windows
- Use add_qml_module_to_macos_app_bundle and copy other things from examples
  like attachedstyleproperties and painteditem in order to get it to work on
  macOS.
- Move qt_standard_project_setup() before qt_add_qml_module() (which is
  called by the three add_subdirectory calls). This is required to avoid
  issues with subdirectories on Windows.

Pick-to: 6.5 6.6
Change-Id: Ie0d859c743d0b8b798238346cc2c738ece362c99
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-07 16:32:31 +08:00
Kai Köhne 8f1e6aa0ed Examples: Fix license to Commercial or BSD-3-Clause
Pick-to: 6.5 6.6
Change-Id: Ieb1db96846e02c3b93888ed409af82bfb3567c19
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-06-26 16:23:24 +02:00
Mitch Curtis fda497e892 automotive: fix the dial's height and background assets
- Don't allow it to fill vertically, because it results in downscaling
  artifacts.
- Update the background images to be 128x128 so that no downscaling
  occurs (when using the correct size hints in QML).

Fixes: QTBUG-114492
Pick-to: 6.2 6.5 6.6
Change-Id: I473ee26f5ad630bbfa1f89c2a977081fae9eaa4e
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-06-20 17:38:43 +08:00
Mitch Curtis fd477cf587 Improve automotive example
- Elide radio station name and frequency text.
- Remove "MHz" text. It's not necessary for the end user and it saves horizontal space.
- Move "Sort by" label above options to save horizontal space.
- Fix "Compact" button not being checkable.
- Reduced excessive vertical spacing between some elements.

Fixes: QTBUG-114407
Pick-to: 6.2 6.5 6.6
Change-Id: I0dc2401b6e9ef48fae3212df9c36dd8f5d04a4e9
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-06-14 08:14:25 +08:00
Topi Reinio 73a62921d0 Doc: QtQuickControls Wearable example: Fix file quoting
Fix \quotefile path as source files have been moved. Also, add .theme
as a valid extension for example files.

Pick-to: 6.5
Change-Id: Icfcb85fdfb99e86eb97ef6e1b53e4fa5771095a3
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2023-06-02 16:31:18 +00:00
Mitch Curtis cd61b622f4 Improve wearable example
- Move all (non-icon) images into one directory for simplicity.
- Add explicit qrc prefix to image paths to make them absolute
  and ensure they're found, fixing some errors.
- Fix "XMLHttpRequest: Using GET on a local file is disabled by
  default" warning by setting QML_XHR_ALLOW_FILE_READ to 1.
- Fix "Parameter "page" is not declared" warning.
- Replace qt6_add_resources with qt_standard_project_setup and
  qt_add_qml_module.
- Remove unnecessary quotes from CMake file paths.
- Replace local settings instance that was accessed via the
  root context through several files with a singleton.
- Make the custom Controls style a proper QML module.
  - Make the settings singleton its own module to avoid cyclic imports.
- Adapt documentation to new paths.
- Some ids (in Main.qml) are unused by QML, but used by the
  documentation, so those are left alone.
- Fix qmake build files after these changes.

Fixes: QTBUG-112618
Pick-to: 6.5
Change-Id: I10f6e1f2013fe35eaf4e1e0f4aaa98e6a1ab9c15
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-05-24 10:29:05 +08: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
Alexandru Croitor 32f6cbe9f0 Fix filesystemexplorer example to work in macOS bundles
The FileSystemModule qmldir was explicitly put into the "/" resource
prefix, but that prefix is not a default qml import path. That caused
the qml module not to be found when building on macOS as an app
bundle, which relies only on resources and not the file system to find
the module.

To ensure the module qmldir is found in the resources, we want it to
be placed in the default qml import path ':/qt/qml'. To do that,
remove the previously specified RESOURCE_PREFIX option and enable
the QTP0001 policy by requiring Qt 6.5+, which will put the module
qmldir into :/qt/qml/FileSystemModule/qmldir.

Because the policy also changes the resource prefix for other
resources (images), adjust all Image source urls to be relative paths
(relative to the component), instead of absolute paths.

Also adjust the qmake generated qrc file to place the files into the
new resource prefix.

Amends 213e932e13

Fixes: QTBUG-112683
Change-Id: I5205cf6d399a6faaf7cce68d55c71dade37479a7
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-04-12 09:36:57 +02:00
Topi Reinio 820516ec76 Doc: Use the \examplecategory macro to tag examples
The '\meta category' command was used for tagging examples with a
specific category, used in Qt Creators Welcome mode.

As we want to also generate lists of examples belonging to a category
elsewhere in the documentation, replace the command with a macro that
expands to the original \meta command and also adds the example to
a group using the \ingroup command. This way, the category names can
be used as arguments to the \generatelist or \annotatedlist commands.

Pick-to: 6.5
Task-number: QTBUG-112731
Change-Id: I673207be9dd73a010069828b92146c37e45e9143
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-04-11 15:27:41 +00:00
Friedemann Kleint a841da2c75 Gallery/Text editor: Update example logos
Pick-to: 6.5
Change-Id: I552edf074958be3af8c72042e65c6586308f434f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-03-27 08:22:16 +01:00
Topi Reinio 9c8a63b6c0 Doc: Fix documentation warnings
* Remove \generatelist example[files|images] commands, they do not
  produce any output, only warnings.
* Add missing full stop to \brief descriptions.

Pick-to: 6.5
Change-Id: I90c67b8c3f3bbe901fa083f781e9056da7763671
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-03-20 21:40:00 +00:00
Oliver Eftevaag ef7c39ecf5 Gallery example: translate all user facing strings
This patch wraps user facing strings inside qsTr()

Task-number: QTBUG-110989
Pick-to: 6.5
Change-Id: I3c5220ba7b552101c006d10c4c86efe8c2b8843c
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-03-16 16:21:34 +01:00
Dennis Oberst c5daa8cd8f File System Explorer example: Add to qmake targets
Amends 213e932e13.

Task-number: QTBUG-108289
Change-Id: Idd1012761579faae76a8b9b22deb7e51c93a4cd0
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-03-16 14:03:21 +00:00
Santhosh Kumar 730c1d1630 Improve gallery example
* Fix qmllint warnings
  * Added support for landscape mode
  * Updated docs

Fixes: QTBUG-110989
Pick-to: 6.5
Change-Id: Id7422ad19b4336c64c866309dd07116d982ecff2
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-03-07 10:24:50 +01:00
Santhosh Kumar c2b09e89da Remove side-panel and swipe-to-remove quickcontrol examples
The quickcontrol feature represented in side-panel and swipe-to-remove
were already part of gallery example and hence, removing these two
examples

Fixes: QTBUG-110989
Pick-to: 6.5.0
Change-Id: I496dfe7ee2bea98f918b4e3b72673388c51cda6b
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-03-03 07:37:00 +00:00
Friedemann Kleint 211d578def File System Explorer example: Make QMimeDatabase a static variable
QMimeDatabase is potentially expensive to initialize, avoid
doing this repetitively.

Amends 213e932e13.

Task-number: QTBUG-108289
Change-Id: I66e5aeb22ffade9b86635e27b9d518c9e40aee4f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-02-22 08:16:55 +01:00
Amir Masoud Abdol 8f7080fd09 Replace AUTO_RESOURCE_PREFIX with Qt CMake Policy in examples, tests
Every instance of AUTO_RESOURCE_PREFIX has been replaced by either
qt_standard_project_setup(REQUIRES 6.5) or with
qt_policy(SET QTP0001 NEW), mainly in tests.

In addition, I added a warning message for the case where
AUTO_RESOURCE_PREFIX is used.

Pick-to: 6.5
Task-number: QTBUG-96233
Change-Id: I323a15e9d0bb5fe6ba649365314af9fc2ad67bda
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-02-21 19:45:44 +01:00
Friedemann Kleint 3689e9cc4a Chat tutorial: Fix deprecation warning
Adapt to qtbase/14f9f00fdb2dc428610c08e3d9d03e38e9602166, fixing:
sqlcontactmodel.cpp:40:13: warning: void QSqlQueryModel::setQuery(const QSqlQuery&) is deprecated: QSqlQuery is
 not meant to be copied. Pass it by move instead.
 [-Wdeprecated-declarations]

Pick-to: 6.5 6.4 6.2
Change-Id: I88d7f30247876f55b0114785efcf4ce580de0ab8
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-02-16 08:04:48 +00:00
Dennis Oberst 213e932e13 Add File System Explorer example
This example shows the customization of Qt Quick Controls by
implementing a simple file system explorer. Using a C++ model, entries
are visualized in a TreeView, and text files can be read.

Fixes: QTBUG-108289
Change-Id: I966dcf65e40d3b727889dc14c65edd0ffcc1b878
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-02-14 13:32:13 +01:00
Joerg Bornemann 05d713a2ba CMake: Fix configuration errors in quickcontrols chat tutorial
Amends 32dac75fb4.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I4fb2ca6d7ce29f6495c7f2bacaeb3596d1fd8e08
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-02-14 08:57:02 +00:00
Tor Arne Vestbø c0918d6306 Adapt to Qt::Appearance to Qt::ColorScheme rename
Pick-to: 6.5
Change-Id: I5830af713e024fa9a7086e8c56e6808ff8593394
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-13 12:52:54 +01:00
Mitch Curtis 528de1de71 Remove unused code in attachedstyleproperties example
Amends 49b9f1f1e8.

Pick-to: 6.5
Change-Id: Ia0ab5ab01397c2a60ee119823936d68383ccc8b6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-02-13 14:19:32 +08:00
Friedemann Kleint 32dac75fb4 Examples: Exclude tutorials from CMake Unity (Jumbo) builds
They don't build due to clashing static helper functions.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I57e407ce4ac3342ec0dbd52b5cf958f44a18e4ae
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-02-10 23:22:30 +01:00
Sze Howe Koh 27878fdef7 Doc: Don't auto-close popup in Attached Style Properties Example
So that users can see the theme change while the popup is open

Change-Id: I9cac09badc04c5dcace45dadaa9282900b093e17
Pick-to: 6.5
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-02-03 22:23:40 +08:00
Sze Howe Koh ecdbc277ab Doc: Fix compile-time warnings in Attached Style Properties Example
Fixes: QTBUG-110831
Pick-to: 6.5
Change-Id: Iee931d5595cab1c6fb40b5ddff0596ce6195788a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-02-03 22:23:33 +08:00
Fabian Kosmale ec452fc6e8 qt_add_qml_module: Make usage of AUTO_RESOURCE_PREFIX a policy
Writing AUTO_RESOURCE_PREFIX in every qt_add_qml_module call seems
rather pointless.

In addition:
- Add documentation for QTP0001.
- Adjust some of the examples to use QTP0001 policy.
- Improved the error message.

Pick-to: 6.5
Task-number: QTBUG-96233
Change-Id: I6e19a491acba97493893bf1953fca3462296c1ea
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-02-01 23:39:19 +01: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
Ulf Hermann 34331019c2 TextEditor example: Avoid deprecation warning
What we want there is intercept the URL through the QML engine. No need
to dig out the specific QQmlFileSelector for that.

Pick-to: 6.5
Fixes: QTBUG-102777
Change-Id: I5ca59316a2434013f91afdf92d3e397ea2711128
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2023-01-11 10:14:00 +01:00
Joerg Bornemann 9fb766ecd0 qmake: Fix build of quickcontrols examples
The QuickControls2 module has been moved to src/quickcontrols. Its
examples are in examples/quickcontrols.

Adjust the .pro file name in examples/quickcontrols and fix the SUBDIRS
entry to it.

This amends commit 4bd87b903b.

Pick-to: 6.5
Task-number: QTBUG-109383
Change-Id: I9de70a773a11344398c01b3e84e557213268c935
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-14 17:39:55 +01:00
Nicholas Bennett 6f778249e1 Docs: Add an animation of the app in action
Added a gif image.

Fixes: QTBUG-108417
Change-Id: Ieeca1a8fd3d76e594581ff5732ebc771a4f367fb
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-12-12 08:58:37 +00:00
Mitch Curtis 8b100bed52 Doc: remove "2" from Qt Quick Controls files
Work on this was already started for the documentation in
1abdfe5d5a.

The CMake target (docs_QuickControls2) probably can't be renamed
until we rename the library, which won't happen until Qt 7.

Task-number: QTBUG-95413
Change-Id: Ied20805a91286436606577c3de39671a447f27dd
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-01 10:26:28 +08:00
Mitch Curtis 4bd87b903b Remove "2" from Qt Quick Controls directories
Qt Quick Controls 2 was named that way because it was a follow-up to
Qt Quick Controls 1.x. Now that Qt Quick Controls 1 is no longer
supported, we don't need to have "2" in the name. Work on this was
already started for the documentation in
1abdfe5d5a.

By doing this renaming a few weeks before feature freeze, it won't
affect the release but still results in as little time possible spent
manually fixing conflicts in cherry-picks from non-LTS releases as a
result of the renaming.

This patch does the following:

- Renames directories.
- Adapts CMakeLists.txt and other files to account for the new paths.

A follow-up patch will handle documentation.

It does not touch library names or other user-facing stuff, as that
will have to be done in Qt 7.

Task-number: QTBUG-95413
Change-Id: I170d8db19033ee71e495ff0c5c1a517a41ed7634
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-12-01 10:26:20 +08:00