Commit Graph

1942 Commits

Author SHA1 Message Date
Santhosh Kumar 1fca1477eb Add an example to create and use custom tree model in quick tree view
Add an example 'Table of Contents' to show how to create and use custom
tree model (derived from QAbstractItemModel) in the Quick TreeView
control.

Fixes: QTBUG-127016
Pick-to: 6.8
Change-Id: I9a5d9e837e1b18de322a0ec895d9832918fd5816
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2024-08-07 00:35:55 +02: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 3384c97e27 Android: QtQuickView example Qt Gradle Plugin changes
Modified
-settings.gradle to use Qt Maven (for now)
-build.gradle to use qtgradleplugin from Qt Maven
-did same for qtquickview_java and qtquickview_kotlin

Task-number: QTBUG-127621
Pick-to: 6.8
Change-Id: Ia3e3b54301c95033139101837460aeb370841afc
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-08-03 15:14:23 +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
Even Oscar Andersen f8b9bf5c52 wasm: Remove qmldir from RESOURCES in CMakeLists.txt
Having qmldir in RESOURCES causes it to be copied incorrectly
to the gallery subdirectory, causing this sequence of commands
to fail:

${QT}/bin/qt-cmake .
cmake --build . -t clean
cmake --build .

Or alternatively it will also fail if building in a separate
directory

The symptoms are:
After start, clicking Button in the menu, the following console
log entry is created:

qrc:/gallery.qml:192:5: QML StackView: push: qrc:/pages/ButtonPage.qml:8
ScrollablePage is not a type

Fixes: QTBUG-127572
Pick-to: 6.8
Change-Id: I7da9853dff5fcc11c2318ac5431b33ea9ce4b096
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2024-08-01 15:01:37 +00: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
Rami Potinkara 177a7f4e18 Android: Rename QtQuickView Java and Kotlin examples
Renamed qml_in_.. starting folders to qtquickview starting ones.
After the change this example follows a similar logic as other
declarative/examples/platform/android examples.
The change also shortened the path to address the Windows path
limitation of 260 characters.
Updated also documentation and manual tests.

Fixes: QTBUG-127067
Pick-to: 6.8
Change-Id: Ie564630e0f924d0b0694bf7c9d47931eab00b422
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-07-29 18:58:08 +03:00
Topi Reinio edb1a1206a Doc: Fix linking issues
Fixes the following warnings:

(qdoc) warning: Can't link to 'qquickattachedpropertypropagator.html'
(qdoc) warning: Can't link to 'Type Of Parameter In Signal Cannot Be Used'
(qdoc) warning: Can't link to 'QQmlEngine Class#QML_ELEMENT'
(qdoc) warning: Can't link to 'qml-qtqml-component.html'
(qdoc) warning: Can't link to 'import paths'
(qdoc) warning: Can't link to 'qml-var.html'
(qdoc) warning: Can't link to 'Qt Quick Shapes'
(qdoc) warning: Can't link to 'Qt Svg'
(qdoc) warning: Can't link to 'Native Menus'
(qdoc) warning: Can't link to 'Popup Items'
(qdoc) warning: Can't link to 'Popup Windows'
(qdoc) warning: Can't link to 'Grid QML Type'
(qdoc) warning: Can't link to 'layer.smooth'

Pick-to: 6.8
Change-Id: Ia61b0568f481018850027f445446f64122abb5fd
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2024-07-29 09:43:17 +00:00
MohammadHossein Qanbari 6db74d7340 Spreadsheets Example: Check if clipboard is supported
The Spreadsheets example does not build on QNX as it uses the clipboard,
which is not supported on QNX.

To fix this issue, it checks `QT_NO_CLIPBOARD` macro around the
clipboard usage and prints a warning if it is not supported.

Fixes: QTBUG-127273
Pick-to: 6.8
Change-Id: Ib677ecd79c216f4e7dde20d82875ee3f492a21ea
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2024-07-23 18:38:20 +02:00
Eskil Abrahamsen Blomfeldt a784238e81 Update generated assets in weather forecast example
This have been regenerated with an updated svgtoqml. One
change was needed in the example: The generator would
previously added a subitem inside the main item which was
transformed to fit the item to the requested size:

    Item {
        implicitWidth: foo; implicitHeight: bar
        Item {
            transform: ...
            Shape { ... }
        }
    }

This was since removed, likely because it's dead weight
(and removes the possibility of overriding it), so now
the transform is set directly on the generated root
object.

But the weather forecast example had made the map labels
children of the generated item, which means the scale was
now also applied to them. This was easy to fix in the
example, by creating the extra item ourselves in the
case where it's needed.

This patch also takes the liberty of fixing some minor
whitespace issues etc.

Pick-to: 6.8
Change-Id: Ic324815c71f990bb7e8e7caed659c14267b1777a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2024-07-22 12:15:59 +02:00
Jan Arve Sæther ccf59c66d9 Add Expanding size policy to some controls and items
Applies to the following Quick items:
* TextEdit
* TextInput
* Flickable

and Qt Quick Controls:
* ProgressBar
* Slider
* RangeSlider

It follows the same Expanding size policies as the corresponding widgets

Also enable size policies the following examples (and thus remove
several lines of Layout.fill.*):

* quick/layouts
* quickcontrols/ios/todolist

Task-number: QTBUG-117597
Pick-to: 6.8
Change-Id: Id4f552aa4c8e85a65b00ff1cf06f34dd7ddeb9fa
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2024-07-17 15:21:35 +00:00
MohammadHossein Qanbari 33b5ba74ed Spreadsheets Example: Fix bug in inserting a new row
When inserting a new row (above or below an existing row), it was
causing a crash.

There was a forgotten call of the previous() method on the iterator
that was supposed to iterate backward.

It has been fixed by adding this function call inside the loop.

Task-number: QTBUG-125767
Pick-to: 6.8
Change-Id: I6a4436bacb0348c1b6bccd929f715e36d0279754
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2024-07-12 20:59:51 +02:00
MohammadHossein Qanbari 74fef51927 Spreadsheets Example: Separate HeaderViews and TapHandlers as types
The Main.qml file was growing larger due to modifications in header
views. To prevent this, the header views have been separated into
ColumnHeaderView and RowHeaderView QML module types.

Similar to the header views, the tap handlers have been separated into
a QML module type to maintain consistent behavior for header views.

Additionally, the mouse tap handlers have been merged into a single
tap handler to manage mouse events with different combinations of
buttons and modifiers.

Task-number: QTBUG-125767
Pick-to: 6.8
Change-Id: Ib465b8b631cb8fe2aeeaaea229e2c4985619d2e9
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2024-07-10 13:37:32 +02:00
MohammadHossein Qanbari 1d344045a9 Spreadsheets Example: Use TapHandler instead of MouseArea
When MouseArea is used for the header views, it blocks events for the
column/row reordering event handler.

To fix this issue, TapHandler is used instead of MouseArea. With proper
configuration of TapHandler properties, the column/row reordering event
handler can access events when they're not accepted by TapHandler.

Task-number: QTBUG-125767
Pick-to: 6.8
Change-Id: Ie59dfc681bb3d853e0a73a05d46bdcd2607091b0
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2024-07-09 16:47:25 +02:00
Eirik Aavitsland 0aabb7c369 Use best practices in the Quick Shapes example
Circles and ellipses can now be expressed simpler with a single
PathAngleArc object, instead of two PathArcs. Similarly, use
PathRectangle instead of four PathLines.

Also fixes various minor qml issues flagged by qmllint.

As a drive-by, improves the doc of the new fillTransform property with
example code that matches one of the gallery examples.

Pick-to: 6.8
Change-Id: I4529cca08c0cffc51d495f8ce815b50c053e4aa3
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2024-07-03 19:46:31 +02:00
Fabian Kosmale 15a49ef0c1 Examples: use qt_standard_project_setup in more places
And remove the redundant AUTOMOC lines.
This also avoids a few policy related warnings.

Task-number: QTBUG-126201
Pick-to: 6.8
Change-Id: Idaa58d7fbc0236aa2091ead43d5a0e6f396647e1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2024-07-03 08:44:01 +02: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
Andreas Eliasson a7bd27f17d Doc: Fix qsTr() link
Fixes qdoc warning:
qtquickcontrols-texteditor.qdoc:128: Can't link to 'qsTr'

Pick-to: 6.8 6.7
Change-Id: Ib2543779cc97052fd754b417468cb315313503a9
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2024-07-01 05:21:46 +00:00
Konsta Alajärvi e13c89d293 Documentation follow up for strong typing changes in Kotlin example
Extend existing documentation of qml_in_android_studio_projects
to explain the adding and using of another QtQmlComponent in
qml_in_kotlin_based_android_project.

Task-number: QTBUG-126050
Pick-to: 6.8
Change-Id: Ib1444ed883c87bcf5c8e3fe9f423dbfef5c8fa66
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-06-28 12:43:00 +03:00
Lucie Gérard 746ee15415 Correct license for example files
According to QUIP-18 [1], all example files
should be LicenseRef-Qt-Commercial OR BSD-3-Clause
Example takes precedence over build system

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

Pick-to: 6.8
Task-number: QTBUG-121787
Change-Id: Ia60be3cc375a3a16af7e6ea7755a61cfe6e1573b
Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2024-06-27 09:17:10 +02:00
Konsta Alajärvi 31443dec1b Documentation follow up for strong typing changes in Java example
Extend existing documentation of qml_in_android_studio_projects
to explain the adding and using of another QtQmlComponent in
qml_in_java_based_android_project.

Task-number: QTBUG-126050
Pick-to: 6.8
Change-Id: Id5b0708c73c52efbe0c3cae46d2869014fb0bae5
Reviewed-by: Alexei Cazacov <alexei.cazacov@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2024-06-27 07:39:46 +03:00
Konsta Alajärvi 1d61d52098 Add another QML Component into qml_in_kotlin_based_android_project
Add implementation for second qml component in
qml_in_kotlin_based_android_project

Task-number: QTBUG-125099
Pick-to: 6.8
Change-Id: Id0b6c693aac2d67cceda74e623fcd18c9568b84a
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2024-06-24 13:09:33 +03:00
Konsta Alajärvi c62efe4d7f Add another Qml component to Java example
Adds another Qml component into the qml_in_android_view example
that can be used in qml_in_java_based_android_project.

Functionality to load another Qml component in
qml_in_java_based_android_project.

Task-number: QTBUG-125098
Pick-to: 6.8
Change-Id: If85e977ef0057ab9bca93e7b2136d37b01a5c7de
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2024-06-24 08:06:18 +03:00
Konsta Alajärvi fae951b94e Strong typing changes to Qml Embedding Kotlin example documentation
Change Qml Embedding examples docs to reflect the new strong typing
changes in the qml_in_kotlin_based_android_project.

Task-number: QTBUG-126050
Pick-to: 6.8
Change-Id: Ic8a6c8acefa32efed93faca90dd776b62c5b8a05
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2024-06-18 07:45:45 +00:00
Konsta Alajärvi 6dd80d7894 Strong typing changes to Qml Embedding Java example documentation
Change Qml Embedding examples docs to reflect the new strong typing
changes in the qml_in_java_based_android_project.

Task-number: QTBUG-126050
Pick-to: 6.8
Change-Id: I855a0f5043d956b644602dc9feba0d568d464b14
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2024-06-17 05:20:59 +00:00
Konsta Alajärvi 227d798d98 Use QtQuickView with strong typing in qml_in_kotlin_based_android_project
Changes the way QtQuickView is used in MainActivity.kt

Task-number: QTBUG-125099
Pick-to: 6.8
Change-Id: I9308fc08cd7ddbec8955baccf95fa0c05117e305
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-06-16 13:59:07 +03:00
Konsta Alajärvi 9eb9b6e41e Bumb Android minimum SDK version in qml_embedding Kotlin example
Bump Android minmum SDK version in qml_in_kotlin_based_android_project
gradle config from 26 -> 28.

Qml embedding Kotlin example has a minimum Android SDK set to 26
in the project gradle config. Qt androiddeployqt has a minimum
supported Android SDK set to 28 for Qt 6.8.

This creates a dependency issue with the included .aar lib built with
Qt.

Fixes: QTBUG-125961
Pick-to: 6.8
Change-Id: I2bc54d1303ee41e2697a296f973e0bab01f1356c
Reviewed-by: Olli Vuolteenaho <olli.vuolteenaho@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-06-13 12:58:37 +03:00
Even Oscar Andersen 7796a5632e wasm: Move OpenGLUnderQml to VertexBufferObject to satisfy WebGL
To make the example work under webassembly also

Change-Id: I9eb7ab4503efcffa68d4de3008c8275f723ec659
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2024-06-11 12:04:07 +02:00
MohammadHossein Qanbari 5bdf12fc6a Spreadsheet Example: Fix bug in update and minor improvement
If the user drags a column from outside the visible area and drops it
into the visible area when the column contains a formula that depends
on a visible cell, updating that cell will not update the cell
containing the formula.

The reason is that the update method in the SpreadModel updates the
wrong rows and columns. The visible rows and columns need to be mapped
to the model's rows and columns.

The improvement is that the update uses a mutex instead of enabling or
disabling the connection in the view. However, the blockConnection()
function has been kept because some actions need to update a large
amount of data in the model, and then the view can be updated without
any extra view updates.

The pan and reset_reordering icons are updated. The new icons have
been designed by the designers.

Task-number: QTBUG-125767
Pick-to: 6.8
Change-Id: I20ea1ef0bb777b5b0b04e7ae74df172ffc5b5ed8
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2024-06-11 05:23:07 +02:00
MohammadHossein Qanbari e0e2f447ad Spreadsheets Example: some fixes and improvements
The HelpDialog is improved by defining an inline component inside it.
The column selection issue is fixed by removing the unnecessary margins
and rows as well.
When the user tries to cut cell data and paste it onto an area including
the cell itself, that cell would be deleted because it was a cut action.
However, this is not correct because the value of that cell is replaced
with the data from the clipboard (mime data) already. To fix this bug,
before deleting the data of the cutting cell, that cell should be
checked to ensure it is not part of the target cells.

Task-number: QTBUG-125767
Pick-to: 6.8
Change-Id: I1adab2c17dab1cf07245bfaed03193904d7d7a2e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-06-11 05:23:03 +02:00
Konsta Alajärvi e0b1f70e27 Refactor Java example xml widget ids to be more descriptive
Refactor Java example xml widget ids, because some of them were a bit ambiguous.

Pick-to: 6.8
Change-Id: I49f6e1bb14d42859164bf12cb386b779dcaaee15
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-06-04 22:27:48 +03:00
MohammadHossein Qanbari 3de85ce8b9 Add the Spreadsheet example
The example demonstrates a Spreadsheet that provides adding, editing,
and deleting data, and also the ability to write formulas for numeric
data. Also, it's possible to select cells, rows, and columns for
deleting them or their data, copying or cutting the data, and dragging
them to other places. The user can hide columns or rows, and also show
them again. Thanks to the reordering API, columns and rows can be
reordered and also can be reset to the default order.

There is a SpreadModel class which handles the entered data. It only
stores the data of the cells that is provided by the user. It means
that it does not create any empty data structure for empty cells, in
order to reduce memory usage.

Task-number: QTBUG-125767
Pick-to: 6.8
Change-Id: I1d9cc5b4b8d902257e9ed508d4a712b0574490f3
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-06-03 17:27:22 +02:00
Konsta Alajärvi d2ffd5b59e Bump Android minimum SDK version in qml_embedding Java example
Bump Android minmum SDK version in qml_in_java_base_androi_project
gradle config from 26 -> 28.

Qml embedding Java example has a minimum Android SDK set to 26
in the project gradle config. Qt androiddeployqt has a minimum
supported Android SDK set to 28 for Qt 6.8.

This creates a dependency issue with the included .aar lib built with
Qt.

Fixes: QTBUG-125961
Pick-to: 6.8
Change-Id: I3b611669ec52621171e9b88f34286fa1b2492faf
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-06-03 11:51:28 +00:00
Konsta Alajärvi f16e05ade6 Use QtQuickView with strong typing in qml_in_java_based_android_project
Changes in the way QtQuickView is used in MainActivity.java

Task-number: QTBUG-125098
Change-Id: I4b60bde84df17b8d765bf6a974e4b13cb38f5bc2
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2024-06-02 08:39:30 +03:00
Konsta Alajärvi 8ff9a21709 Rename qml_in_android_view example main.qml and URI
Rename qml_in_android_view example main.qml to Main.qml because
qml files starting with lower case letters are considered to be only
files not components.

Rename qml_in_android_view example URI because if the URI and module name are same there is a class name clash with the Qml Component Java code generation.

Covers: QTBUG-125159

Task-number: QTBUG-125098
Change-Id: I40394d890ed680f17fe49d650bc42c2a3d3348e4
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-06-02 08:39:27 +03:00
Eskil Abrahamsen Blomfeldt b70dc1196c Texture fill for shapes
This introduces a "fillItem" property to ShapePath. Similar to
gradient, this enables filling a shape with any texture provider
item, such as an image, a ShaderEffectSource or a layer-enabled
item.

Fixes: QTBUG-104121
Change-Id: I8748a90c825e8eb4655a4ac90648c6ae74420527
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2024-05-27 17:36:45 +02:00
Laszlo Agocs 3d8c869768 graph example: Do not use GLSL functions as uniform names
Using textureSize in the uniform block leads to renaming it
to _textureSize when transpiling to GLSL. This is not
reflected in the reflection metadata for some reason.
For OpenGL this matters because the QRhi backend won't
be correctly able to set up the uniforms when the
names do not match. To overcome this, use a name
in the shader that does not conflict with a built-in
GLSL function. Strictly speaking the name (textureSize)
is somewhat incorrect anyway. Use texCoordScale to
express its meaning better.

Pick-to: 6.7 6.6 6.5 6.2
Change-Id: I863e98c6d56cc46fad895763b9b5106a40e2952c
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2024-05-27 09:36:13 +02:00
Eirik Aavitsland 22272aefeb Add PathRectangle, a PathElement for optionally rounded rectangles
This new path element type is particularly useful for QuickShapes,
where it can be used to mimic a Rectangle item. It provides the same
API for specifying common and/or individual corner radii.

[ChangeLog][QtQuick] Add PathRectangle, a PathElement for optionally rounded rectangles

Fixes: QTBUG-123913
Change-Id: Ia0de252f70c665bd70f63aa31e3010584cc9cd8c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2024-05-26 18:04:42 +02:00
Eirik Aavitsland 31d652d73b Add fillTransform property to ShapePath
This adds functionality corresponding to QBrush transform to QuickShapes.

Change-Id: I2b5903f8c228adec65a6f5be64e3816143879302
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2024-05-14 20:06:17 +02:00
Konsta Alajärvi 947986009d Adds documentation for the qml_in_kotlin_based_android_projects example
Documented the qml_in_kotlin_based_android_projects example in the
same .qdoc file as the qml_in_java_based_projects example.

Added snippets tags to MainActivity.kt.

Added support for code snippets from .kt files in qtquick.qdocconf.

Fixes: QTBUG-123423
Pick-to: 6.7
Change-Id: I5ac4d231bf77a23b4083ca26712949d66c2483c1
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2024-05-03 17:03:14 +03:00
Konsta Alajärvi e8060eac72 Add example showcasing embedding QML to native Android Kotlin project
Add new project folder qml_in_kotlin_based_android_project which
include the new Android Studio project.

Fixes: QTBUG-120717
Pick-to: 6.7
Change-Id: I53023c897c92d275018b4e40ab84a3b60e0afa1f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-05-02 13:17:15 +03:00
Kai Köhne 79c3fb123d Doc: Fix mentioning of QQW::createTextureFromNativeObject in example
The method got removed in Qt 6.0, and the example code was adjusted
accordingly (commit fb96109bbc).

While at it, also remove the mentioning of the even older
QQuickWindow::createTextureFromId(), as that is most likely
not relevant for new users looking into this example.

Pick-to: 6.6 6.7
Change-Id: I2ea3fcf3de78e13afec9e2b25aa8d4a6a9a9b571
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-04-19 16:15:15 +02:00
Even Oscar Andersen 793f81b1c6 Set correct shader version for CustomRenderNode example
The custom rendernode example uses the default GLSL which is:
"100es,120,150". The problem with this is that gl_VertexId only
exists in OpenGL ES 3.00 or later, and GLSL 1.30 and later
end result is that the shader compiles but does not run.

Change-Id: I1ac18e381b1e8b28368f67e4140f4bb43bb17e62
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2024-04-19 12:39:01 +02:00
Even Oscar Andersen 547de2d4e5 wasm: CustomMaterial: Change shader program so that it is accepted by WebGL
There are issues with for loops in GLSL, see for instance:
https://learnwebgl.brown37.net/12_shader_language/glsl_control_structures.html
The solution is to rewrite the shader so that it also works on WebGL.

Fixes: QTBUG-123593
Change-Id: Ia9fd4d9ef3f1b99a29d4bbabae20ad779fe4fbba
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2024-04-18 11:39:16 +02:00
Nicholas Bennett 0b594fb3ba Adds documentation for the qml_in_java_based_android_projects example
Added a qdoc file to the top folder and edited the qtquick.qdocconf
file to include it as src and for snippets.

Task-number: QTBUG-122964
Pick-to: 6.7
Change-Id: I581e369b0682804729a98288164492ac1c604194
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-04-17 02:00:15 +03:00
Mitch Curtis 85ea1653db Fix contactlist example not finding ContactList type on macOS
ec9312687e added
NO_RESOURCE_TARGET_PATH, which causes issues on macOS.

Fixes: QTBUG-123773
Pick-to: 6.5 6.7
Change-Id: I80f4cb740dde47549e4357f08b6ae00c243b77b5
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2024-04-15 09:27:29 +08:00