aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/doc/how-tos
Commit message (Collapse)AuthorAgeFilesLines
* Doc: use registerModule in "Use a C++ enum in JavaScript" how-toMitch Curtis2025-10-232-3/+8
| | | | | | | | | | | This is apparently better than using globalObject. registerModule was introduced in 3464655f5e2adaa1aed8925a9a54b8fb5f238f31. Pick-to: 6.8 6.10 Change-Id: Ic664e65d7e5f8d65004112802e8f19f4f790bb7d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQuickTest: add and use active focus macrosMitch Curtis2025-04-251-2/+3
| | | | | | | | | | | | | Also add support for popups (when controlstestutils_p.h is included). [ChangeLog][Qt Quick Test] Added QVERIFY_ACTIVE_FOCUS and QTRY_VERIFY_ACTIVE_FOCUS macros that can be used to get detailed failure messages for when QQuickItem::hasActiveFocus should be true but isn't. Task-number: QTBUG-133858 Change-Id: I30c67a84ccc16e3969bac5661648d0062bc3d62c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Tests: include QTest, not QtTestGiuseppe D'Angelo2025-04-154-4/+4
| | | | | | | | | | | | | Never use module-wide inclusions. They blow up build times. For QtTest this is usually just a typo (QTest was meant instead). Add missing includes as needed. In the diffs I've spotted other huge inclusions (QtQuick, QtQml), but those need more attention. Task-number: QTQAINFRA-7110 Pick-to: 6.9 6.8 Change-Id: I74bf3fe212f50a7a3a6af2b1c80bbcaabc2516d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tests: Swap QScopedPointer<QPointingDevice> for unique_ptr touchscreenShawn Rutledge2025-03-291-25/+25
| | | | | | | | | | | | The default device from QTest::createTouchDevice() is a touchscreen, so we should call it that, to disambiguate touchpads (a few tests use them). And QScopedPointer is discouraged nowadays. Task-number: QTBUG-132212 Pick-to: 6.8 6.9 Change-Id: I2aeaf8cee3c7b6041945506e11fa62d7c923c556 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Frederic Lefebvre <frederic.lefebvre@qt.io>
* Fix ambiguous qBound usage when qreal is floatDennis Oberst2025-03-141-1/+3
| | | | | | | | | | | | | | | | | | | | When building Qt with a non-double qreal type, i.e. QT_COORD_TYPE=float, explicit template specialization like: qBound<qreal>(0.0, qreal(0.5), 1.0); is ambiguous because the double literals conflict with qreal (float). This creates ambiguity when resolving between overloads such as: qBound<T>(const T&, const T&, const T&) qBound<T, U>(const T&, const U&, const T&) Fix this by porting to std::clamp(), which ensures consistent types and avoids the implicit conversions that made such ambiguities possible. Pick-to: 6.9 6.8 6.5 Change-Id: I45b430dd26a90fd0289111f1b336d40533c74841 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* How-to: Disable AUTOUIC explcitly in tst_how-to-cpp-gaugeOlivier De Cannière2024-10-211-0/+2
| | | | | | | | | | | uic shouldn't be necessary here and it can fail the cmake generation phase so just disable it. Amends baddb27f40308babc557578f3efe3f8c286457eb Change-Id: I140797d0d999e13e58c2c1bd3e4a385e101b98bf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Add a Gauge how-toMitch Curtis2024-10-1113-0/+1444
| | | | | | | | | | | | | | | | Gauge was part of Qt Quick Extras, but its implementation used Loader and was very heavy. This patch implements it using C++ to avoid that. As Gauge is quite complex and has a lot of possiblities for how users could style it, this patch offers an example that can be used as a starting point, and customized using a familiar delegate-based API. The goal is to provide a set of C++ and QML files that users can simply copy into their projects. Fixes: QTBUG-111770 Change-Id: I389058296d65063e9ab6f6e484c59eb526b058b0 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* tst_HowToQml::timePicker: remove debugging outputMitch Curtis2024-09-042-11/+0
| | | | | | | | | | This was added in f1b39fafe811a2478d608815b52cee7cdbe2dba0, but is no longer necessary as the test has stopped failing. Task-number: QTBUG-122679 Pick-to: 6.8 Change-Id: I7ee107aa633f644455546754ea732e10becfa85b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Add support for popup window types in the how-to-qml testEd Cooke2024-08-071-16/+23
| | | | | | | | | | | The how-to-qml test spawns a dialog and simulates mouse clicks. These clicks happen in the application window, but when using popupWindows, they instead should happen here. Task-number: QTBUG-127756 Pick-to: 6.8 Change-Id: I5c1b6262d7ecd17675d06a1b644bcd46914a5483 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Avoid policy warning in testFabian Kosmale2024-07-031-0/+1
| | | | | | | | Pick-to: 6.8 Task-number: QTBUG-126201 Change-Id: I3a3e9cc77307a1dc409cf829d24844912523cdb5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* tst_HowToQml::activeFocusDebugging: call requestActivateMitch Curtis2024-06-121-0/+1
| | | | | | | | | | | As was done for 77a11392b72442d04f4001e45febb554ff3b5d4e. It's important to request that the window be activated before checking that it's active. Task-number: QTBUG-126222 Pick-to: 6.5 6.7 6.8 Change-Id: I13121c57b03da365ba5e6770b24ee31c2be56f21 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Blacklist failing activeFocusDebugging() testUlf Hermann2024-06-111-0/+5
| | | | | | Task-number: QTBUG-126222 Change-Id: Ib105a678d30ef7d26a5eea22006aafa7ae303ef3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tst_HowToQml::timePicker: add more logging output to debug flakinessMitch Curtis2024-03-052-2/+14
| | | | | | Task-number: QTBUG-122679 Change-Id: Ie068ac579441f5ecc49a6543bcd989607ed96831 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Correct license for test filesLucie Gérard2024-02-2715-15/+15
| | | | | | | | | | | | | | According to QUIP-18 [1], all test files should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I26d72e8de04d4c7c57b3b7838af5d033265de5ba Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Kai Köhne <kai.koehne@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Attempt to stabilize tst_how-to-qml's timePicker testMitch Curtis2024-02-261-14/+18
| | | | | | | | | | | | | | | | | | Top-level animations within a transition are run in parallel, which meant that the NumberAnimations that animated the opacity of the labels could technically be conflicting (even though it visually looked correct). This could explain why the test was failing when checking for the opacity to equal 1, and it was instead 0.96. Reduce the duration of the animations now that they execute in succession, as originally intended. Amends d414c81f38d8fea47d91c9414bdecda9ea7761a1. Task-number: QTBUG-122679 Pick-to: 6.6 6.7 Change-Id: I51c62d8c95d54194fd2fb2273c9644378d4b61e5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* CMake: Make quick tests standalone projectsAlexandru Croitor2023-07-053-0/+18
| | | | | | | | | | | | | | | | | Add the boilerplate standalone test prelude to each test, so that they can be opened with an IDE without the qt-cmake-standalone-test script, but directly with qt-cmake or cmake. Boilerplate was added using the follow script: https://git.qt.io/alcroito/cmake_refactor Manual adjustments were made where the code was inserted in the wrong location. Task-number: QTBUG-93020 Change-Id: I7854e7f015535a4835ce3daf816f7f33aa242c2a Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Doc: add how-to for using C++ enums in JavaScriptMitch Curtis2023-05-246-0/+145
| | | | | | | | | | | | | | The best search result for "qt how do i expose a C++ enum to javascript" is currently a Qt Forum post, and the relevant information in our docs is hard to find within QJSEngine's page. Add a how-to to make it easier to find the answer. Task-number: QTBUG-109634 Pick-to: 6.5 Change-Id: Ia9c53c5d3826459655aa5b094c4d601b938ef3a3 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Replace AUTO_RESOURCE_PREFIX with QTP0001 policyAmir Masoud Abdol2023-04-042-2/+4
| | | | | | | | | | AUTO_RESOURCE_PREFIX is deprecated, and we should start using our CMake policies instead. Pick-to: 6.5 Change-Id: Ic0b317929a2d9b9297d113f4382e895d63673e1d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add an Android TimePickerDialog how-toMitch Curtis2023-03-317-1/+920
| | | | | | | | | | | | | | | | | | | | | | | | | This is a highly requested control, yet its implementation varies greatly between devices and platforms. Rather than try to implement an API and UI that fits every use case (and implement whatever infrastructure may be required for offering separate mobile and desktop controls), offer a specialized example: an Android time picker. The goal is to provide a set of QML files that users can simply copy into their projects. The screenshots were taken of the whole window on a MacBook whose display DPR is 2, and then adapted with the following commands: convert uncropped-light.png -crop 870x1030+280+220 how-to-time-picker-light.png convert uncropped-dark.png -crop 870x1030+280+220 how-to-time-picker-dark.png mogrify -resize 50% how-to-time-picker-*.png find . -name "how-to-time-picker-*.png" -exec optipng -o 7 -strip all {} \; Task-number: QTBUG-51167 Task-number: QTBUG-109634 Pick-to: 6.5 Change-Id: Ie11913ba4a83673d7c2467066d9cfef772055c1d Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Add how-to for active focus debuggingMitch Curtis2023-03-244-1/+112
| | | | | | | | | | | This is a popular question online: https://stackoverflow.com/q/47960622 Task-number: QTBUG-109634 Pick-to: 6.5 Change-Id: I640654a96f0cdd5d7571562b9140dc20f86e73b5 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add a how-to page for Qt Quick topicsMitch Curtis2023-03-246-0/+131
The goal for this page is to have an easily discoverable, useful reference that shows the simplest and best way of performing specific tasks using Qt Quick. Each task will have its own section title (so they can be linked to) in the form of a question. For example: How do I make a QML Button call C++ code when clicked? Each section will provide QML and/or C++ code snippets, or link to other parts of Qt's documentation where those snippets already exist. The QML-only snippets will be tested by tests/auto/quick/doc/how-tos/qml, and the mixed QML and C++ snippets will be tested by individual auto tests under tests/auto/quick/doc/how-tos. Fixes: QTBUG-109634 Pick-to: 6.5 Change-Id: I512e016db2c914fd9e0241d5e0738af82a98d08b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>