summaryrefslogtreecommitdiffstats
path: root/examples/corelib
Commit message (Collapse)AuthorAgeFilesLines
...
* Revamp MIME Type Browser Ex: Fix too long linesRym Bouabid2023-09-221-6/+8
| | | | | | | | | Fix code lines that do not respect the 100 characters limit rule. Task-number: QTBUG-117146 Pick-to: 6.6 6.5 Change-Id: I9833e9a25a09833b3e0384c95af8a422d5aa4582 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Make examples/bindableproperties a proper projectKai Köhne2023-09-224-81/+54
| | | | | | | | | | | | Both executables (subscription, bindablesubscription) are documented as one project. Make sure that e.g. Qt Creator can also load this project. Fixes: QTBUG-117109 Pick-to: 6.5 6.6 6.6.0 Change-Id: I3912f2f76379940b02f3a57a7a55440a30366755 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Docs: Update Links to Android Notifier ExampleNicholas Bennett2023-09-211-0/+1
| | | | | | | | | | Added to the list of important links on the Android Platform home page. Task-number: QTBUG-116780 Pick-to: 6.2 6.5 6.6 6.6.0 Change-Id: Id65a73d56bff0b288ebb1da098f6dbd8cbbe606e Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Revamp Local Fortune Client Example: Create QString instead of char *Rym Bouabid2023-09-201-1/+3
| | | | | | | | | | | Create QString at compile time using the literal operator""s instead of using pointer to characters. This way, no conversion or allocation will occur at runtime. Task-number: QTBUG-117036 Pick-to: 6.6 6.5 Change-Id: I9942ef8efa38de9ac5975799249a65fcb4c966c9 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Revamp Local Fortune Client Example: Fix include orderRym Bouabid2023-09-203-12/+12
| | | | | | | | | | | | | | Fix include order to respect the Coding Conventions. Include individual headers instead of "generic" headers. Remove QT_{BEGIN,END}_NAMESPACE because these are private Qt macros that should not be used in the examples. Task-number: QTBUG-117036 Pick-to: 6.6 6.5 Change-Id: I33f9c54098824bfcfacac7c2f624554e105a291a Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Check input and output converters do support the relevant directionsEdward Welbourne2023-09-151-4/+7
| | | | | | | | | | | | It was previously possible to select an input-only converter for output or an output-only converter for input. Also add a comment to explain why failure to probe for the auto output converter isn't an error, where failure to probe for the auto input converter is. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I17dfbbee7d8b5a9629e66d0e1a6a4014b01a7262 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
* Replace the image to illustrate the Serialization ConverterEdward Welbourne2023-09-151-0/+0
| | | | | | | | | | | | | | The old image wasted a log of space, was poorly legible and showed little more than the cbordump example's illustration shows. Make explicit that we get an initial CBOR file from savegame, show how it can be converted to and from XML (idempotently) and still find space to show the same thing as before. All more legibly and in a smaller file. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Ifc599d0dd646f136ccd2860ca927186d478b0fb9 Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
* Revamp Wait Conditions Example: Revisit the documentationRym Bouabid2023-09-131-5/+4
| | | | | | | | | | | | | | Change the title. Remove the first \brief as there are two briefs in the document so that the new title makes sense with the second brief in "All Qt Examples" doc page. Task-number: QTBUG-108860 Pick-to: 6.6 6.5 Change-Id: I1dec2ad107e3f9ff9b4203960ba54ae6d0d8c7b6 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
* Revamp Shared Memory Example: Revisit the documentationRym Bouabid2023-09-131-3/+3
| | | | | | | | | | Remove "Example" from the title. Extend the \brief. Task-number: QTBUG-108858 Pick-to: 6.6 6.5 Change-Id: Ie8bd0c808503861027f80493c430e8ac1baada5f Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Revamp Shared Memory Example: Change the used QSharedMemory constructorRym Bouabid2023-09-131-1/+5
| | | | | | | | | | Use QSharedMemory(const QNativeIpcKey &key) constructor to port away from the deprecated QSharedMemory(const QString &) constructor. Task-number: QTBUG-108858 Pick-to: 6.6 Change-Id: I05615100f77f571fe32a3cf627c3df46baaa7f7a Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Revamp Shared Memory Example: Fix formatting of the dialog.h headerRym Bouabid2023-09-131-5/+5
| | | | | | | | | "dialog.h" has inconsitent indentation. Task-number: QTBUG-108858 Pick-to: 6.6 6.5 Change-Id: Id029d5ec63f3831e5ffcfe2b61d7e86896d4afb5 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Revamp Semaphores example: Revisit the documentationRym Bouabid2023-09-131-5/+4
| | | | | | | | | | | | | Change the title. Remove the first \brief as there are two briefs in the document so that the new title makes sense with the second brief in "All Qt Examples" doc page. Task-number: QTBUG-108859 Pick-to: 6.6 6.5 Change-Id: I8b0370c9a85179e172918231ae48a3c52845bf21 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Revamp Shared Memory Example: Fix include orderRym Bouabid2023-09-133-2/+5
| | | | | | | | | Fix include order to respect the Coding Conventions. Task-number: QTBUG-108858 Pick-to: 6.6 6.5 Change-Id: Ifecf7c60ca7135104631587b25e907cb1d39e25b Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Revamp Semaphores example: Replace const by constexpr when applicableRym Bouabid2023-09-131-2/+2
| | | | | | | | | | Replace const by constexpr when the value of the variable can be calculated at compile-time. Fixes: QTBUG-108859 Pick-to: 6.6 6.5 Change-Id: I4abf5162d521fc5dca0286a6254f86c57a473367 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Revamp Mandelbrot example: Declare slots as methods insteadRym Bouabid2023-09-131-4/+3
| | | | | | | | | | | | | | | | Declare zoom as a method because it's never used as a slot. Declare updatePixmap as a method because it's used as a slot as pointer-to-member-function, so it doesn't need help from moc. Q_OBJECT is not needed anymore as the MandelbrotWidget class doesn't contain signals ans slots anymore. It's replaced by Q_DECLARE_TR_FUNCTIONS because we are using tr() function. Fixes: QTBUG-108861 Pick-to: 6.6 6.5 6.6.0 Change-Id: I9a1d66711cdc9f0ca5a1bc6645f7e0ed3395645c Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Revamp Mandelbrot example: Revisit the documentatonRym Bouabid2023-09-131-2/+2
| | | | | | | | | | | | | | | Remove "Example" from the title. Edit the link (title) to the documentation of Mandelbrot in QThread documentation. Delete the foreach related sentence as we are trying to port away from this Qt pseudo-keyword. Task-number: QTBUG-108861 Pick-to: 6.6 6.5 6.6.0 Change-Id: I6d04f24ac9c1fa1efe30a947c2da2ec7475edc80 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Revamp Mandelbrot example: Add const/constexpr when applicableRym Bouabid2023-09-132-25/+24
| | | | | | | | | | | | Add const in front of local variables when applicable. Replace const by constexpr when the value of the variable can be calculated at compile-time. Task-number: QTBUG-108861 Pick-to: 6.6 6.5 6.6.0 Change-Id: I2cd1bc97aaa07d6d564731d9ccddba9a74e96fef Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Update mobile example categories for Qt 6.6Rami Potinkara2023-09-121-1/+0
| | | | | | | | | | | | | | | | Add mobile example category tags for the chosen examples. Add for the ones that work best for both, Android and iOS. Remove from the ones that do not work for both (at least yet). Added - hellogles3 Removed - qtandroidnotifier (not iOS) Fixes: QTBUG-116780 Pick-to: 6.6 Change-Id: Icb4c7ba1f22d4e67089a565071d83cdf8ec95896 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Make \brief of Saving a Game to File actually briefEdward Welbourne2023-09-111-2/+1
| | | | | | | | | | | | Specifically, prune it to fit on a single line. Much of what it was saying was implicit in its context already. It also neglected to mention CBOR's part in the story. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I161a345cbbea8b706490fcbbadecd01b8946af31 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Revamp Mandelbrot example: Fix too long linesRym Bouabid2023-09-111-2/+4
| | | | | | | | | | Fix code lines that do not respect the 100 characters limit rule. Task-number: QTBUG-108861 Pick-to: 6.6 6.5 Change-Id: Idbc148b77b52a359d972233c977bbf2ccf9fcd24 Reviewed-by: Dennis Oberst <dennis.oberst@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Revamp Mandelbrot example: Use a Literal operator to create QStringRym Bouabid2023-09-111-2/+4
| | | | | | | | | | | Create QString at compile time using the literal operator""s instead of using pointers to characters. This way, no conversion or allocation will occur at runtime. Task-number: QTBUG-108861 Pick-to: 6.6 6.5 Change-Id: I4fb51d74abbbfa08fb9fddfa90d8afcebd82a7e2 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Revamp Mandelbrot example: Fix IncludesRym Bouabid2023-09-114-7/+7
| | | | | | | | | | | | | | | | | | Reorder the includes following the coding conventions. Remove unneeded includes. Add needed includes to avoid Transitive includes. QGestureEvent is passed by a pointer in the gestureEvent method in mandelbrotwidget.h. So, we do not really need to include the header. Instead, forward-declare QGestureEvent class in a namespace. Task-number: QTBUG-108861 Pick-to: 6.6 6.5 Change-Id: I48cfd663bf98350281ef7f31e6c0ef3e301a08ca Reviewed-by: Dennis Oberst <dennis.oberst@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Turn Directions enum into an enum class in serialization converterEdward Welbourne2023-09-089-13/+15
| | | | | | | | Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Ie1f8ea5e2575427528c19875db7a8e4e27200aec Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Turn Converter::Direction into a QFlags enumEdward Welbourne2023-09-0816-22/+24
| | | | | | | | | This lets us testFlag() instead of using raw bit-field operations. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I2c26e9a24728e81baa42cf14c75271a015460913 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Serialization converter example: const-ify the Converter typeEdward Welbourne2023-09-0816-129/+143
| | | | | | | | | | | | Its methods act on their parameters without changing the converter, so can all be const. Its instances thus have no non-const members to exercise, so can always be const. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Ifcdb2f2159c2cfcd7998dd118aa327a32d299ccf Reviewed-by: Dennis Oberst <dennis.oberst@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Separate streaming dumper and converter in the convert exampleEdward Welbourne2023-09-087-102/+124
| | | | | | | | | | | | The two were in the same files but mostly unrelated to one another - aside from the converter defaulting to the dumper for output. Furthermore, the dumper actually uses QDebug and QTextStream, not QDataStream; rename it to reflect this reality. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Id65c120c319b555039f7fd186ed262f35ff5260a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* corelib/serialization examples: clang-tidy and coding style clean-upEdward Welbourne2023-09-0820-118/+75
| | | | | | | | | | | | I overrode clang-tidy where it uglified or obfuscated and did some clean-up provoked or made possible by its changes. Konrad pointed out, in review, a constructor that could be = default; it could, in fact, vanish entirely as a result. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I9b7744a3abaa29e6f9e0689d0f6985bfd88cd0fd Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* corelib/serialization examples: use string literals moreEdward Welbourne2023-09-089-107/+121
| | | | | | | | | | | | A couple more compilation units could use Qt::StringLiterals. Prefer QL1SV for the code constants, to keep code small. Convert fpToString() to take QL1SV instead of const char *, with suffix empty by default. Also rearranged some spacing, some if it suggested by clang-tidy. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I03d810d52afcd4a760d18f2553914b75af716b74 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* examples/: compile with QT_NO_CONTEXTLESS_CONNECTAhmad Samir2023-09-082-10/+10
| | | | | | | | | | | | | | | | | Examples are usually a good way to get to know a new codebase, do not teach developers who are new to Qt about the 3-arg connect() to begin with. Drive-by changes: - `this` can't be implicitly captured with [=] in a lambda, instead capture by reference - Update docs related to the sqlbrowser example; the overloaded signal it mentions has been removed in Qt6 - In the sqlbrowser example, rename addConnection() (no-arg) overload to openNewConnectionDialog, suggested in code review Change-Id: I30c9f35bda4ac2f460d767ab7f84422ae3ed09f7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Minor tidies in example's XML converterEdward Welbourne2023-09-051-2/+2
| | | | | | | | | | Make a local variable more local, set a variable only once its new value is known to be valid. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Ib6aa16e8c834f89c6ccc0715f20b0e5f0a7f3b6d Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* Exploit C++17 init-statements in if to simplify a loopEdward Welbourne2023-09-051-12/+5
| | | | | | | | | | | The serialization converter example's text converter's loadFile() can be made tidier by making the conditions within its loop into a chain. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Ic82355eab7380a0c671b3805ca140958bb1c5af5 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
* Update datastream converter to use Qt_6_0 instead of Qt_5_0Edward Welbourne2023-09-051-2/+2
| | | | | | | | | It was added in 5.12 and we've had a few upates since then. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Iacb5368d4baa7d25f981bb0b8bd8d68b5461e17d Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Core serialization examples: spacing-only clang-format changesEdward Welbourne2023-09-057-25/+25
| | | | | | | | | Marc disagreed with clang-format on some, which are thus excluded. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I1402274635dba866a8160a68211874cb11dcfa61 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Exclude some examples from Android buildElias Hautala2023-08-287-5/+29
| | | | | | | | | | | | Excludes dnslookup, waitconditions, semaphores, cbordump, savegame, convert, pingpong and complexpingpong examples from Android build because of missing Qui and Quick dependenies. Task-number: QTBUG-111933 Pick-to: 6.5 6.6 Change-Id: Ied01f62ee61a9220dcb44c13fda46f6a5e158293 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* examples/: fix compiler warnings -Wdeprecated-enum-float-conversionAhmad Samir2023-08-183-3/+4
| | | | | | | This is with GCC. Change-Id: I52dcb6881f36c740129b699db7db9241a4e75da1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* examples/: implicit capture of `this` via [=] is deprecated in C++20Ahmad Samir2023-08-181-2/+2
| | | | | Change-Id: I43b04517e9e3a30468c8ce702c9a49968c0ddc4d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* XBEL stream reader: rework documentationEdward Welbourne2023-08-031-82/+128
| | | | | | | | | | | | | Document previously-undocumented methods. Document in terms of what each thing achieves, not how it does it. The U+00B7 is not the period, it is the centred dot. Fix various anachronisms; the existing docs were out of date with the actual code. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I17da880e0afd7260aa6f3b7bdddb430c437f4562 Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Update Android notifier example to match example guidelineJani Korteniemi2023-08-022-2/+3
| | | | | | | | | Replaced add_subdirectory() with qt_internal_add_example(). Added tags. Task-number: QTBUG-114638 Change-Id: I397c2974a51f0bea391099d1d1abfea39bd29cbe Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* XBEL stream example: use constructor initializationEdward Welbourne2023-07-172-2/+2
| | | | | | | | | | The treeWidget member of MainWindow could be initialized before the body of the constructor, enabling it to be a *const variable. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: If4a3b04729bc7fa5859ca88183eec376f6992455 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* XBEL streaming example: renumber xbelreader.cpp's snippet fragmentsEdward Welbourne2023-07-102-6/+12
| | | | | | | | | | I'll be adding docs for parts currently lacking them; fix up the numbering first, to disentangle from "real" changes to docs. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Ia10f212626bf5ca9fab2b6ba6cf02dbd560a2f02 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
* XBEL streaming: shuffle mainwindow parts into more pedagogic orderEdward Welbourne2023-07-102-29/+36
| | | | | | | | | | | | | Renumber the code fragments to match their order, while adding a number for the previously undocumented custom method. Add a brief description of it. Move the createMenus() part up to after it, combine the createActions() with its (as createActions() is long gone, fused into it and sharing its snippet number). Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: If0fbcadfa058fc12cbd74ba1897646113bd016b0 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
* XBEL stream example: move createMenus() earlierEdward Welbourne2023-07-101-21/+21
| | | | | | | | | | | This will make the description of the type flow more naturally. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I751bdaf420be7afc9cb4925af4f2a94367840605 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Mate Barany <mate.barany@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* XBEL streaming: replace images with up-to-date versionEdward Welbourne2023-07-107-3/+3
| | | | | | | | | | | The old screenshot showed an old XBEL file's content, with trolltech URLs. Update to match the new XBEL file's content. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Idacc31b7786b1e6ed1425857470b1d37227096cd Reviewed-by: Kimmo Leppälä <kimmo.leppala@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Update XBEL examples' sample data fileEdward Welbourne2023-07-101-23/+23
| | | | | | | | | | Most links are now https, several have relocated, one entirely rebranded. Same example in both QXmlStream and DOM forms. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Ifbc58dadc834cf51113adb1c82de971a8768ee58 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Update Qt Documentation link title in XBEL examplesEdward Welbourne2023-07-101-1/+1
| | | | | | | | | | doc.qt.io was described as Qt 5 documentation; no need to version-limit it. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I1c5abe3d805c2b845a74b9fe454c494fa1eff4c7 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Update example category namesKai Köhne2023-07-104-4/+4
| | | | | | Pick-to: 6.5 6.6 Change-Id: If4a50c403ed0fb299ac0d9a66f1f606151c55930 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Contiguous cache example: minor cleanupAmanda Hamblin-Trué2023-06-302-13/+8
| | | | | | | | Modernised contiguous cache example. Change-Id: I88d67b03ed95a61484873149da16f0d814b26cd8 Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Revamp bindable subscription exampleAmanda Hamblin-Trué2023-06-281-0/+2
| | | | | | | | | Silence a bogus warning. Pick-to: 6.6 6.5 Task-number: QTBUG-114689 Change-Id: I7267b752e780b0c48cc57a513d12ad504e4c7a30 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QBindable example: Replace SpinBox connection with QBindableAmanda Hamblin-Trué2023-06-281-3/+6
| | | | | | | | | | Made this change because there was no example of the interaction between QBindable and non-bindable properties. Pick-to: 6.6 6.5 Task-number: QTBUG-114689 Change-Id: Ief7662f8af5e6fab32491418fa35f0daa937819d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Move permissions example to manual testTor Arne Vestbø2023-06-265-249/+0
| | | | | | Pick-to: 6.5 6.6 Change-Id: If7482ff20079d91ddba26a1abcb06b3054cc72ad Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>