summaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Fix QDoc link errors in qttoolsJerome Pasion7 days2-7/+7
| | | | | | | | | | | Add dependency in .qdocconf files Fix link syntax Whitespace fixes when applicable Fixes: QTBUG-142504 Pick-to: 6.10 6.11 Change-Id: I8dfa717a71eb71ba7f1b6f334ec7162d620bf83c Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* linguist examples: remove i18n exampleMasoud Jami2025-11-1725-1233/+0
| | | | | | | | | | | | | | | | | | | | This example demonstrates that translations can be provided later without any modifications to the code. In order to do so, it provides a dialog with choices for several languages. Upon clicking on each language, the translation is installed on the app and a new MainWindow is created to show the new installed translation. Clicking on more languages creates multiple windows. The goal of this example is not justified by its implementation. The documentation is missing and the fact that translations can be added later doesn't need a whole new example. A somewhat existing similar example is localizedclock-switchlocale which demonstrates how the language can be changed at runtime, by selecting different languages on a list, without creating a new window everytime. Task-number: QTBUG-71856 Change-Id: Ib80e4811e166df75cc89cd50fd8edf9213029c69 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* linguist examples: remove hellotr exampleMasoud Jami2025-11-1411-316/+0
| | | | | | | | | | | This patch removes the hellotr example from qttools. The example demonstrates the basic usage of tr commands in a simple project. Since we have the more modern example localizedclock that covers the simple usage of tr commands using most recent Qt features and best practices, there is no need for hellotr anymore. Change-Id: I387f3ccc86f0b0e1781be98a5daf789d1fefbd9d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* linguist: add new example for Qt i18n for ID based translationMasoud Jami2025-11-0724-0/+1118
| | | | | | | | | | | | | | | | | This patch adds an example to demonstrate ID based translation in Qt. The example is a simple clock in Qml that counts the seconds (plural forms) and presents the time and date. The application allows the user to change the time zone of the clock, by opening a dialog (in C++ widgets) that contains a list of time zones. The example shows how the same translation can be reused with the same ID across Qml and Widgets. It also show cases the best practices in integrating Qt i18n for ID based translation in CMake. Pick-to: 6.10 Fixes: QTBUG-71856 Change-Id: I40b707afc3fa1e7e57c35507b0a73c6e48ca1139 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Doc: Add alt text for \image tags for qttoolsEren Bursali2025-11-0714-30/+56
| | | | | | | | Adding alt texts that were needed for QDoc Pick-to: 6.10 Change-Id: Ic499b403f62452c8779097a4ef878b7a51a690c0 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* linguist: add new example for Qt i18n in runtime language changesMasoud Jami2025-08-0820-0/+588
| | | | | | | | | | | | | | | | | This patch adds an example to demonstrate switching languages in applications at runtime. The example is a simple clock in Qt Quick that counts the seconds (plural forms) and presents the time and date. The application allows the user to switch the language of the UI at runtime by clicking on a button and choosing a new language from the menu. It also show cases the best practices in integrating Qt i18n in CMake. Fixes: QTBUG-71856 Pick-to: 6.10 Change-Id: I8ba866902e690b52a41cafbbe5e1ce88b3d63ebd Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Doc: Add alt text for example UI image in QtUiTools docsDheerendra Purohit2025-07-041-3/+3
| | | | | | | | | | Add alt text to textfinder-example-userinterface.webp in QtUiTools docs. Resolve missing alt text issue and improve accessibility. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-136158 Change-Id: Id9056dd5cbe0c385cb7a4d3f7bcfdc56a46fc6f7 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* linguist: add new example for Qt i18n in plurals and time formatsMasoud Jami2025-06-1618-1/+648
| | | | | | | | | | | | | | | | This patch adds an example to demonstrate use of plural forms, and showcasing the localized time formats. The example is a simple clock in Qml that counts the seconds (plural forms) and presents the time and date (time formats), in the localized format. It also show cases the best practices in integrating Qt i18n in CMake. Fixes: QTBUG-71856 Pick-to: 6.10 Change-Id: If28950a1d3e6be4ff2a49d28b13ba09eac472281 Reviewed-by: Kai Köhne <kai.koehne@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Improve CalculatorBuilder exampleKai Köhne2025-04-113-23/+16
| | | | | | | | | | | | * Use canonical names and structure in CMakeLists.txt * Use C++ class header instead of module header * Assert if loading from resource system fails, instead of just returning Pick-to: 6.9 Change-Id: I6f548d0536354e1b68ee85a2903df9ae9380b182 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix compiler warnings in textfinder exampleKai Köhne2025-04-112-13/+13
| | | | | | | | | | | | | | | | | Since Qt 6.10, ignoring the return value of QFile::open() leads to a compiler warning: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result] Fix this by asserting if the resource file cannot be opened. While at it, make the description more accurate, in particular removing the incorrect mentioning that the code forces UTF-8 reading (this is the default). Pick-to: 6.9 Change-Id: Ifb60c7b7552151df49746125efeaa0338055e12a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Doc: Fix capitalization of QUiLoaderKai Köhne2025-04-101-1/+1
| | | | | | Change-Id: I7aa7a785779c0c61a72ed843400623c06404a5e4 Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io> Reviewed-by: Alexei Cazacov <alexei.cazacov@qt.io>
* CMake: Add TS_OUTPUT_DIRECTORY argument to qt_add_translationsJoerg Bornemann2025-02-171-1/+1
| | | | | | | | | | | | | [ChangeLog][CMake] For consistency with qt_add_translations' argument QM_OUTPUT_DIRECTORY, we introduced the argument TS_OUTPUT_DIRECTORY to specify where automatically generated .ts files are placed. The old argument name, TS_FILE_DIR, is still available as alias to keep older project files working. Pick-to: 6.9 Fixes: QTBUG-133724 Change-Id: I1ff499d0c48c30a08bdd1cde95a61a46e25883d6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: fix configuration when designer is disabledTim Blechmann2025-01-081-1/+3
| | | | | | | | When the designer is disabled, configuring the designer examples fails. Pick-to: 6.8 6.9 Change-Id: Ib6ef1f53b157d8a86f778ae89ce5baff00f2c358 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Update MainWindow to dynamically display the active file namePatryk Stachniak2024-11-294-0/+12
| | | | | | | | | | | | | | | | | | | | Added functionality to update the main window's title with the name of the currently opened file in the text editor. This change improves user experience by providing a clear indication of the file being viewed or edited. Introduced a fileNameChanged signal in TextEdit to notify changes in the active file. Connected the signal to a new slot in MainWindow to update the window title dynamically. Adjusted FindFileDialog and TextEdit::setContents to emit the signal when a new file is opened. This enhancement addresses user feedback regarding better context visibility in the application. Task-number: QTBUG-118728 Pick-to: 6.8 Change-Id: Ib951592388943fcbc40efd7d41a6fc0452fc9b40 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Docs: Add a screenshot for the Context-Sensitive Help exampleAlexei Cazacov2024-10-162-0/+2
| | | | | | | Task-number: QTBUG-69988 Pick-to: 6.8 Change-Id: If1a68431943aad5d259ac315605ba3ca0c93b111 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* ContextSensitiveHelp: Fix path to docs in case of insource buildJarek Kobus2024-10-103-2/+28
| | | | | | | | | Do a similar thing to what was done for examples/assistant/simpletextviewer. Fixes: QTBUG-129833 Pick-to: 6.8 Change-Id: Ib4bf1aa426f2c8c58b7c77ddfb5a2a9f331340ed Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Docs: Update the screenshots for the Qt Tools examplesAlexei Cazacov2024-10-1014-0/+3
| | | | | | | | | | This commit updates the screenshots for the Qt Assistant and Qt Designer examples. Task-number: QTBUG-69988 Pick-to: 6.8 Change-Id: I17da7c173a7a8cac4d55f91aecefdf5473eef98a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add initial plurals .ts files for i18n examplesJoerg Bornemann2024-09-103-0/+30
| | | | | | | | | | | | | Since we automatically create a plurals .ts file with qt_add_translations, the i18n examples pollute the source tree of Qt with generated .ts files. Fix this by adding initial .ts files to the repository. Pick-to: 6.7 6.8 Fixes: QTBUG-124709 Change-Id: I875c8395a975f7182d0a10781d96a9a78b2c1e4a Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Trollprint example: use string literalsAxel Spoerl2024-07-101-3/+4
| | | | | | | | | | | The example breaks a qttools build, due to constructing a QString with a string literal "1.0". Use a static constexpr for the version instead. Pick-to: 6.8 Change-Id: I53e16765534fc10de06c44cfe7c6d2b3522b5e51 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Correct license for documentation filesLucie Gérard2024-04-042-2/+2
| | | | | | | | | | | | According to QUIP-18 [1], all documentation files should be LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: Ifedcaf2716ca6bf5b69d373a7ddf7ec5085384b3 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Change license for build file in exampleLucie Gérard2024-03-1517-17/+17
| | | | | | | | | | | | 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 Task-number: QTBUG-121787 Change-Id: Iace5eb946b0291ecdf54f7e42ba56e8912ea438b Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* CMake: Rename I18N_*LANGUAGES variables and parametersJoerg Bornemann2024-02-254-4/+4
| | | | | | | | | | ...according to the Qt 6.7 CMake API review. Pick-to: 6.7 Task-number: QTBUG-122396 Change-Id: Ica4e6ae91ee708ccb0890d8d32fd1a9fd2bf8d29 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Rename 'Qt Designer' to 'Qt Widgets Designer'Friedemann Kleint2024-02-196-10/+10
| | | | | | Task-number: QTBUG-122253 Change-Id: I64b4b1deb758b716355159c4abb8f7ba914a3e1a Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Qt Designer: Use \QD macro in documentationFriedemann Kleint2024-02-154-12/+12
| | | | | | | Task-number: QTBUG-122253 Pick-to: 6.7 Change-Id: I108e94cf3e0097383de379dbf6f5d42561b55201 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Remove 'Internationalization' categoryKai Köhne2024-02-154-4/+4
| | | | | | | | | | The category is too small. Merge it with the 'User Interface Components' category, as translations are mostly used in this context. Pick-to: 6.6 6.7 Change-Id: I619aba35368773ca52b85f6778f96bae24839402 Reviewed-by: Mats Honkamaa <mats.honkamaa@qt.io>
* Fix misleading variable name in i18n exampleJoerg Bornemann2024-01-161-4/+4
| | | | | | | | | Rename 'qmlFile' to 'qmFile', because it contains the path to a .qm file. Pick-to: 6.6 6.7 Change-Id: Idcd195e8fb7f3d5985cc46fa98a3f12589ff59e9 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Clean up CMakeLists.txt file for qhelp exampleKai Köhne2023-12-201-7/+6
| | | | | | Pick-to: 6.7 Change-Id: I59a85f258216ba259e139a87b926d22a4a648df4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Refurbish the custom widget exampleMatthias Rauter2023-11-172-17/+40
| | | | | | | | | | | | The custom widget has the appearance of the analog clock, which was refurbished with 619ec1a6406a8be7bfa9d96b9e693e7a3323d8dc. This change applies the refurbished design to the custom widget. Task: QTBUG-118871 Pick-to: 6.6 Change-Id: I4a751a54d91d7eaa13f2282a9f1a1a26d91a204c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Examples: Use the revisited qt_add_translations signatureJoerg Bornemann2023-09-284-24/+12
| | | | | | | | Instead of specifying .ts files, we specify languages now. Fixes: QTBUG-117463 Change-Id: Iebb540d7d8062eef241f0e90df93ff3539a166e2 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Fix meta data of the Qt Designer "Multiple Inheritance" exampleFriedemann Kleint2023-09-251-1/+1
| | | | | | | | | Amends db7a30bd1dca12b04f04a2617d54e22c61e5cf70 Pick-to: 6.6 6.5 Fixes: QTBUG-117214 Change-Id: If95937fd606c05c96b6ee83fd9ad73c771a49781 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* lupdate: remove number heuristicsLucie Gérard2023-09-133-26/+13
| | | | | | | | | | | | | | Adapt the troll print example [ChangeLog][lupdate][Important Behavior Changes] Removed the number heuristics feature. Users are advised to avoid hard-coded numbers in translatable strings and use QString::arg instead. Pick-to: 6.5 6.6 Task-number: QTBUG-115962 Change-Id: I64e920e7b6496924f2c1ee6d07bea6e73964177a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add ts files in arrowpad exampleLucie Gérard2023-09-133-0/+9
| | | | | | | | | | | | To avoid git complaining about untracked files, default ts file created by cmake are added. They still have to be updated like explained in the examples documentation. Task-number: QTBUG-115686 Pick-to: 6.5 6.6 Change-Id: I8b57c4c7e6920e1dcaed8dba7dda4f7088fa604b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Doc: Add example category to qtassistantInkamari Harjula2023-09-072-0/+2
| | | | | | | | | Added category Desktop to remote control and simple text viewer examples. Task-number: QTBUG-116536 Pick-to: 6.5 6.6 Change-Id: I42c196bb6a9f8a402e87f6055bf05eb99603eca1 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Doc: Add example category to qhelpInkamari Harjula2023-09-061-0/+1
| | | | | | | | | Added example category User Interface Components to contextsensitivehelp file. Task-number: QTBUG-116534 Pick-to: 6.5 6.6 Change-Id: I112c2710df7c93b4282f7192ddb06e84e097d14a Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* RemoteControl: Revamp the exampleJarek Kobus2023-07-243-93/+63
| | | | | | | | | | | | | | Get rid of automatic ui connections. Replace some simple slots with lambdas. Simplify c'tor. Use QT_VERSION_MAJOR/MINOR/PATCH instead of QT_VERSION. Fix code formatting. Fix the starting link. Use new string literals. Pick-to: 6.6 6.5 Change-Id: I59422e2d8c62713c399e3f330afdcfa47b502d9e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* SimpleTextViewer: Use new string literalsJarek Kobus2023-07-242-8/+12
| | | | | | Pick-to: 6.6 6.5 Change-Id: I703b7a364cc5e30327850e0a68869e5e7485bada Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* SimpleTextViewer: Revamp the exampleJarek Kobus2023-07-247-56/+39
| | | | | | | | | | | | | Fix const correctness. Fix code formatting. Fix error message on crash. Use initializer lists in c'tors. Limit the start assistant timeout to 3 seconds, like it's done for termination. Pick-to: 6.6 6.5 Change-Id: Idfafa35834fba725b03d80e6252be8ac3eaf489f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Add explanations on where this example works bestLucie Gérard2023-07-031-0/+4
| | | | | | | | | This example is not expected to work on Android. Pick-to: 6.5 6.6 Task-number: QTBUG-106380 Change-Id: I09ab5340b0cca0554ef14acb1852befcaae7990d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Update arrowpad exampleLucie Gérard2023-06-273-4/+13
| | | | | | | | | Change short cut set to include translation like in example documentation. Add Mac case for language display. Task-number: QTBUG-108751 Change-Id: I7dbcf729170a44543098f99a43de33939dc4351c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Update trollprint exampleLucie Gérard2023-06-262-3/+5
| | | | | | | | | | Without the updated header, lupdate cannot be run on the ts file. After adding the comment in the code, to generate two translations, the portuguese text does not appear any more for Enable and Disable, unless the code is recompiled. Change-Id: I082691c71a7a7393951e6c41b9f676100d8ee18b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Examples: Remove unnecessary Q_INIT_RESOURCE callsKai Köhne2023-06-051-2/+0
| | | | | | | | | | | Explicit calls to Q_INIT_RESOURCE are only needed for resources embedded in static libraries. See also https://doc.qt.io/qt-6/resources.html#explicit-loading-and-unloading-of-embedded-resources Pick-to: 6.5 6.6 Change-Id: I68c383be82478db7967136ccefdc3e4ee688e96f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Clean up Designer's extension plugins examples' qmake filesJoerg Bornemann2023-05-313-30/+0
| | | | | | | | | The QTDIR_build scopes are not used anymore. Pick-to: 6.5 Change-Id: Ic722645641419b3beb22ac36a02a862f6e7b179e Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Revert "Check the return value from QTranslator::load()"Tor Arne Vestbø2023-05-021-2/+1
| | | | | | | | | | | | | | | | This reverts commit 0a91ac627e84634993fc579d428e4bbc3d0b283a. The example documentation does not match the flow introduced by this change. The example explicitly talks about "No error will occur if the file is not found.", and "If hellotr_la.qm was found and contains a translation for "Hello world!", the translation appears; if not, the source text appears." Q_UNUSED added to satisfy nodiscard attribute. Pick-to: 6.5 Change-Id: I8e4cb6ed3fb81f7739aacd734f3107a8ec6899a1 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* hellotr: Clarify that .ts file is generated in the source directoryTor Arne Vestbø2023-04-191-1/+1
| | | | | | Pick-to: 6.5 Change-Id: Id738952b6515449ec0c5f7d66e8c89352333d7ad Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Doc: Use the \examplecategory macro to tag examplesTopi Reinio2023-04-1111-11/+11
| | | | | | | | | | | | | | | | 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: I28dfd6d5540dfe540bab942f9e9a93e9c239e206 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Mark Linguist examples with Internationalization categoryKai Köhne2023-03-314-2/+12
| | | | | | | Pick-to: 6.5 Fixes: QTBUG-112373 Change-Id: Ia2764196c5dd3f9e001f0585279862efbafa91b1 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* examples: port linguist examples to new connection styleSamuel Gaist2023-02-252-4/+4
| | | | | | Task-number: QTBUG-111464 Change-Id: I1dbe83370d8d3dcbb54308c80f2fad6725f777fa Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* examples: port help examples to new connection styleSamuel Gaist2023-02-251-2/+2
| | | | | | Task-number: QTBUG-111464 Change-Id: I994a6173bcbabea13ed22280ae95a7235b193147 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* examples: port assistant examples to new connection styleSamuel Gaist2023-02-251-8/+8
| | | | | | Task-number: QTBUG-111464 Change-Id: If69dff20a09dc2fb5444462d6356b58b805ee3a9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Qt Designer: Remove worldtimeclock example imagesFriedemann Kleint2023-02-245-0/+0
| | | | | | | | | | | | Amends 1f859ca1ac6d337aedde2fe8eed74266416ae0d1. As a drive-by, remove the outdated arthurplugin-demo.png. Task-number: QTBUG-110447 Pick-to: 6.5 Change-Id: Iead32aaca944a886d86dd36465a2082309821be7 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>