Commit Graph

37 Commits

Author SHA1 Message Date
Olli Vuolteenaho 3837355aed QtQ4A: Update Gradle and Kotlin plugin versions in examples
Gradle 8.10 -> 8.14.2
Kotlin Android Gradle plugin 2.1.0 -> 2.2.0

Pick-to: 6.10
Task-number: QTBUG-137782
Change-Id: I62b54d2730b1fc48139057d1a4ef0ce4061aaeb0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2025-07-15 11:33:07 +03:00
Jani Heikkinen ef2d29eba0 Bump version to 6.11.0
Change-Id: If24576debc2246a2a8c244a56c4a69e9a2f6b2e6
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2025-06-14 02:36:26 +01:00
Olli Vuolteenaho 61149d1822 Android: Fix linter problems in QtQ4A examples
In 6.9.1 the Q4A compile SDK version was bumped to 35, which includes
a new edge-to-edge feature. For now this was disabled until we can add
official support for the feature.

When building the QtQ4A examples from the command line a linter is run
as part of the build process and this raises a complaint about the
disabling of the edge-to-edge feature, as that is not supported until
API level 35 and the minSDKLevel is still 28.

This should be safe to be ignored which we can do by setting the
linter-specific "tools:targetApi" attribute to the element.

Amends 3d3f2dcb5a.

Task-number: QTBUG-134880
Fixes: QTBUG-136933
Pick-to: 6.9 6.9.1 6.8
Change-Id: Ie86fdc429ffb9f89ebe23999967a329cd630f194
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
2025-05-19 11:29:54 +03:00
Konsta Alajärvi 3d3f2dcb5a Disable edge-to-edge feature in qtquickview examples
After bumping the Android compile and target versions to 35,
disable edge-to-edge feature that arrives with Android 15, because it
will be easier for users to work with this for now.

Later we'll add support for edge-to-edge feature.

Task-number: QTBUG-134880
Pick-to: 6.9 6.8
Change-Id: I8d703c6c6b925a39da9ac8ea6a3d23eaa9b3c3a0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-03-20 10:56:51 +02:00
Rami Potinkara f90812878b Android: update Qt Quick for Android examples to SDK 35
This patch updates qtdeclarative examples to use
SDK 35 as a target and compile version SDK.

Task-number: QTBUG-130285
Task-number: QTBUG-129461
Pick-to: 6.9 6.8
Change-Id: Ie11f8bebff7dfeb4c1a87c07826f9e9ef0f78d4b
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-03-20 08:56:43 +00:00
Tim Blechmann ba95147535 examples: android compile fix
* add dummy CMakeLists.txt files
* add qtabstractlistmodel examples to the examples CMakeLists.txt

Change-Id: I9af5bcb79a5cc71e7a4a50a5a674b97ba70538b0
Reviewed-by: Soheil Armin <soheil.armin@qt.io>
Reviewed-by: Konsta Alajärvi <konsta.alajarvi@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-03-07 02:23:05 +08:00
Olli Vuolteenaho 567ece7681 QtQ4A: Fix deprecation warnings in examples
Android Studio will default to using JDK21 from Ladybug onwards. This
causes deprecation warnings about settings the source/target
compatibility to Java 8.

The more modern fix would be to use toolchains, but that would
apparently require adding a toolchain resolver. To keep it simple let's
just update the values to Java 17.

Fixes: QTBUG-132802
Pick-to: 6.8 6.9
Change-Id: Ic278a4ea7da8d598cee963dbfce0f6d6c00f0603
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-02-19 12:32:53 +02:00
Konsta Alajärvi 131cb7016b Qt Quick for Android: Remove manual orientation handling from examples
Remove any code related to manual target device orientation handling
from Qt Quick for Android examples. Provide alternative landscape
specific layout for examples.

Remove unused variables and imports.

Move unnecessary global variables to local.

Fix couple variable namings in qtquickview_kotlin MainActivity.kt.

Fixes: QTBUG-133325
Change-Id: I55ae0df59dd8b02b5f6cfadccc94095d4b7d4ac1
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-02-19 05:54:17 +00:00
Olli Vuolteenaho 314c8eb498 Update Gradle versions in QtQ4A examples
These versions are currently all over the board, and the intention is
to have them in line with the Qt for Android requirements (which is
Gradle 8.10 and AGP 8.6). Also update the Kotlin plugins while at it.

Task-number: QTBUG-132815
Pick-to: 6.9 6.8
Change-Id: I72d8cb15d80b8b69301bbc2bbfeebf779ef137df
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-01-15 20:14:36 +02:00
Rami Potinkara 2b4327ab1e Android: remove an extra repository definition
This change removes a duplicate mavenCentral repository
definition from qtabstractitemmodel_java settings.gradle
file of Qt Quick for Android example.

Fixes: QTBUG-132792
Pick-to: 6.9 6.8
Change-Id: Ib4d719a7c12ff536a7da588387badd097edeeeb6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-01-15 15:07:08 +02:00
Konsta Alajärvi 7dacc8bce1 Update Qt Quick for Android qtabstractitemmodel_java example docs
qtabstractitemmodel_java example was changed to use editable model.
Reflect that change in the example docs.

Fixes: QTBUG-132395
Change-Id: Ia4d1b33b9b8862efad502fe45e6fbd3584ca274f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-01-10 10:11:41 +00:00
Jani Heikkinen 496bf62b15 Bump version to 6.10.0
Change-Id: I08b4527cc13f4fb88a2fc5d5c24163e3315e99c9
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2025-01-03 11:57:39 +01:00
Konsta Alajärvi c7bb2af66a Qt Quick for Android: Add editable model to qtabstractitemmodel example
Since setData() and dataChanged() methods were added to
QtAbstractItemModel Java class, modify the existing model in
qtabstractitemmodel example to an editable one to showcase these
methods.

Changes includes:
- Main.qml:
    - Minor QML coding convention based changes
    - Changed cell size
    - Changes that enable cell text editing and
      forwarding the changes to the model
    - Changed Text alignment inside cell
    - Cell text is fetched from new "edit" role

MyDataModel.java:
    - Added override for setData()
    - Removed not needed roles "column" and "row" and
      replaced them with new "edit" role
    - Modified the Cell class to suit better editable model
    - Squashed generateRow() and generateNewRow() into one
      generateNewRow()
    - Added internal datalist updating to removeColumn()

Fixes: QTBUG-130254
Change-Id: I791ad33e3b729617a7f53f6553e11fc39878edae
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-12-20 07:57:33 +02:00
Olli Vuolteenaho 63cf552d92 Remove QtTAS 1.0 leftovers from examples
These were used in early versions of the Android Studio plugin to copy
and package the libraries created by Qt build before AAR builds were a
thing. Probably at some point they were accidentally committed into the
examples.

I tried builds after these were removed and there was no change to the
behavior of the app.

Task-number: QTBUG-131673
Pick-to: 6.8
Change-Id: I9f49d24bea3d7da8ba898af966066fb4050defc5
Reviewed-by: Nikunj Arora <nikunj.arora@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-11-29 12:18:46 +02:00
Olli Vuolteenaho 686400f78a Remove useLegacyPackaging from Kotlin examples
The reasons are the same as mentioned in
88660cd34a, but that commit didn't touch
the Kotlin examples, probably because of a mistake(?).

I tried removing the blocks, and deploying the examples worked without
issues.

Task-number: QTBUG-131673
Change-Id: I166b39935c479220935a895778fc618119119552
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-11-29 11:57:54 +02:00
Inkamari Harjula 7715c5f056 Fix String '6.8.0' found in 6.9.0 sources in qtdeclarative
Occurrences fixed.

Task-number: QTBUG-130833
Change-Id: Ideda05852ce9bbfbce3dfa7bdf7c06155c598f46
Reviewed-by: Mats Honkamaa <mats.honkamaa@qt.io>
2024-11-12 14:55:12 +02:00
Olli Vuolteenaho 32bf5c7143 Fix indentation in QtBuild tasks in QtQ4A examples
For some reason the Java-based examples have one extra leading
whitespace character in the QtBuild task block in build.gradle(.kts).

Remove those because they don't look nice and parsing them requires a
bit more work.

Pick-to: 6.8
Change-Id: Ifbe5cd2e911612f83563a0cc3ec4b16138ce7e5e
Reviewed-by: Tero Koponen <tero.koponen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-11-07 08:04:57 +02:00
Assam Boudjelthia 88660cd34a Android: remove packagingOptions.jniLibs.useLegacyPackaging property
This is not needed after 0db5b424cdaede8724886e8a1eda1380382d9aaf.

Change-Id: Ic5fc2bccf260cfdc159212324fb066d9137753c0
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
2024-10-31 13:49:56 +03:00
Soheil Armin 0007adef5b Android: Replace Qt snapshot maven, with release maven repo
This change replaces the 0.1 SNAPSHOT versions with
1.+ version which means 1.0 and above.

We should also remove Qt maven repository URL so the
plugin can be fetched from mavenCentral.

Task-number: QTBUG-128417
Pick-to: 6.8
Change-Id: Id1006b64f6bf3f0d13d03a4f26b441236aa77cc7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2024-09-10 16:18:55 +03:00
Konsta Alajärvi ba7223823f Android: Remove and rephrase comments in examples build.gradle files
Remove optional qtKitDir variable and explanation from examples
build.gradle files, as it is already mentioned in documentation.

Rephrase "Relative for pre-installed (Installer or MaintenanceTool)
installations." comment in examples build.gradle files.

Task-number: QTTA-111
Pick-to: 6.8
Change-Id: Iee2eda91a994ddab061d636c739a480bd7a946f5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-09-02 08:48:18 +03:00
Konsta Alajärvi fd6fea8818 Android: qtabstractlistmodel_kotlin example settings.gradle.kts
settings.gradle.kts include statement not working.

Pick-to: 6.8
Task-number: QTTA-111
Change-Id: I0dc0ab8b2bf9ad722bdaece05e99651f6914863f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-08-30 11:08:08 +00:00
Konsta Alajärvi 0a8a14d14d Android: Change qtabstractlistmodel_kotlin example QtBuild projectPath
qtabstractlistmodel_kotlin example QtBuild projectPath points to
non existing project. Change to correct one.

Pick-to: 6.8
Change-Id: Ic8ff620e6a058ddc83948d9a7f207d4912c64e55
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-08-30 11:08:07 +00:00
Konsta Alajärvi 8d5f510527 Android: Change qtabstractlistmodel_kotlin example package name
Pick-to: 6.8
Change-Id: I59940e0f8110793e2043bdd10c35db3b307c3400
Reviewed-by: Soheil Armin <soheil.armin@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-08-30 14:08:07 +03:00
Konsta Alajärvi 1ed1bdde28 Android: migrate examples build confs to Kotlin KTS
Refactor build.gradle(app and top level) from both qtquickview_kotlin
and abstractlistmodel_kotlin to Kotlin.

Rename build.gradle file extensions

Refactor settings.gradle from both examples to Kotlin.

Rename settings.gradle file extensions

Update build.gradle dependencies in qtquickview_kotlin

Task-number: QTTA-111
Pick-to: 6.8
Change-Id: Ife72ba1e7c88d46506292d5aa7f925f485d51866
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-08-25 10:58:52 +00:00
Soheil Armin 3ae2b98a7f Android: Change member names and related docs to .loadContent rename
As the QtQuickView.loadComponent() became QtQuickView.loadContent()
and the QtQmlComponent renamed to QtQuickViewContent, the member names
in examples and related documentation content and documentation links
need to reflect the change, where required.

This change includes renamings, where they are applicable. There are
some cases that the word "component" is a better match, eg. when the
sentence is referring to signals or properties which are directly
talking about the QML component but not the QtQuickViewContent.

Task-number: QTBUG-127084
Pick-to: 6.8
Change-Id: I33ff259d3dfc97fb6b776dd676c19c3eea0842e4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-08-25 11:05:00 +03:00
Soheil Armin 2578058747 Android: Reflect renaming of QtQuickView.loadContent() in examples
Task-number: QTBUG-127084
Pick-to: 6.8
Change-Id: I087e80e8a826c4db6a1ef15ec52185d2128140d0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-08-24 14:46:17 +03:00
Konsta Alajärvi 1512e2011f Fix button texts and strings.xml in qtabstractitemmodel_java
Move hardcoded strings in buttons in activity_main.xml to strings.xml.

Remove unused strings in strings.xml.

Pick-to: 6.8
Change-Id: Ie7a0da20e7b40a4d6338f5f99f6290c39d32ac97
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-08-15 08:33:26 +03:00
Konsta Alajärvi 64f323ef24 Android: Support multiple display densities in qtabstractlistmodel_kotlin
Added dimens.xml files for different display densities from where
the button margins, textsizes and paddings are fetched according to
the current display density.

Added corner radiuses for the buttons, to make the corners look the
same on different densities.

Added top and bottom margins and padding for the buttons, to make them
look the same on different densities.

Task-number: QTBUG-127848
Pick-to: 6.8
Change-Id: I9e7332af7abe71a4df3d2555803839017aec0896
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-08-14 11:12:10 +00:00
Konsta Alajärvi 11ab690faa Android: Support multiple display densities in qtabstractitemmodel_java
Added dimens.xml files for different display densities from where
the button margins, textsizes and paddings are fetched according to
the current display density.

Added corner radiuses for the buttons, to make the corners look the
similar on different densities.

Task-number: QTBUG-127848
Pick-to: 6.8
Change-Id: Idef43338b7636aabb3884efe4a4292489e307849
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-08-14 10:48:16 +03:00
Petri Virkkunen 50aea1f6a3 Android: Add documentation for QtAbstractListModel example
This change includes code snippet markers, some minimal code changes
(moving code around for snippet clarity), a screenshot of the example
and the main documentation page for the example.

Task-number: QTBUG-126841
Pick-to: 6.8
Change-Id: I2a10571f37a70a55b8411f1b7989b47810639386
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2024-08-13 22:28:03 +03:00
Petri Virkkunen b000b72e41 Android: Correct QtAbstractListModel example directory names
To make it more clear that these examples are for the java/kotlin side
of QtAbstractListModel, name them according to that class name.

Task-number: QTBUG-125976
Pick-to: 6.8
Change-Id: Ie4c3f9a82ab5798035930b186b3ee5b539d69683
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-08-07 01:35:54 +03:00
Rami Potinkara 8bea7773ff Android: QtAbstractItemModel example synchronization
Added synchronized to each function to synchronize
thread execution in the example. Exception is the
constructor that can't take synchronized.

Task-number: QTBUG-127467
Pick-to: 6.8
Change-Id: I7c7bf8f245dbe484ca8e556769b3acd6732527ee
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-08-03 12:27:25 +03:00
Konsta Alajärvi ce65c63748 Android: Add documentation for QtAbstractItemModel Java API example
Adds documentation for Android Studio example application project.
Explains how to handle complex data types between Java and QML.
Explains the project structure and thread contextes with code examples.

Example opens up the usage of two Java API classes
QtAbstractItemModel (QtAIM) and QtModelIndex (QtMI).

Task-number: QTBUG-126457
Pick-to: 6.8
Change-Id: Ibbd10b74aa415985f3edd0affa8d0301d71aa8c0
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2024-08-01 18:01:37 +03:00
Rami Potinkara 891cf09400 Android: QtAbstractItemModel example Qt Gradle Plugin changes
Modified
-settings.gradle to use Qt Maven (for now)
-build.gradle to use qtgradleplugin from Qt Maven

Fixes: QTBUG-127622
Pick-to: 6.8
Change-Id: I35401f4c098fcb5b150c5c68e93ab08d98028eb2
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Olli Vuolteenaho <olli.vuolteenaho@qt.io>
2024-08-01 09:44:34 +03:00
Petri Virkkunen 8c9381dfba Android: QtAbstractListModel kotlin example synchronization
Annotated each member function of MyListModel with @Synchronized,
and added synchronized-block to constructor.

Task-number: QTBUG-127467
Pick-to: 6.8
Change-Id: I9fe2d23d0706bf5d247dcaf82a8aa7a987a37286
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-07-31 13:45:13 +00:00
Konsta Alajärvi 1b85df0a2e Android: QML Embedding: Add Kotlin example showcasing QtAbstractListModel
This commit adds two projects, one for Android Studio and the other a
regular Qt QML project.

The Android Studio project provides two buttons which add and remove
rows, a frame for the embedded QML Component to be drawn on, and the
QtAbstractListModel which is passed to the QML Component.

The QtAbstractListModel contains a list of UUID strings which are
randomly generated at init and on request via the Android UI. This data
provided to QML has two properties: the UUID string and the row of the
requested data as an int.

The QML project simply has a ListView that uses the provided
QtAbstractListModel to draw elements that display the element data.

Task-number: QTBUG-125976
Pick-to: 6.8
Change-Id: I315a85e6d0043c1ff3a15e12458c27f38f573e0b
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-07-31 13:45:13 +00:00
Konsta Alajärvi bd4b643bad Android: Add QtAbstractItemModel Android Java example
Patch adds an Android Studio example application project.
Project has a Android project and a Qt project. Qt project
can be imported into Android project.

Example shows how to handle complex data types between Java and QML.
In QML the data use is demonstrated with TableView item and in Java
side with model of two-dimensional ArrayList items for Cell's.
First dimension of the array list is rows and second is columns.
Example uses 26 rows and columns, that matches to amount of
alphabets from A to Z.

Example opens up the usage of two Java API classes
QtAbstractItemModel (QtAIM) and QtModelIndex (QtMI).

Task-number: QTBUG-125606
Pick-to: 6.8
Change-Id: I61dee80618d852bf6e42f97f28e0a064987557e0
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-07-31 13:57:08 +03:00