summaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* HTTP example: Reflow QMessageBox usage in if-statementMårten Nordheim2023-02-021-3/+4
| | | | | | | | | | It gets hard to read like that. And update mentions of 'SSL' to 'TLS' in the message while we're there. Task-number: QTBUG-108874 Pick-to: 6.5 Change-Id: Ia7b27bfb3d99391b14ed396ca9a6400621022bf6 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Fix analog clock example to adhere to guidelinesJan Arve Sæther2023-02-022-3/+6
| | | | | | | | Guidelines: https://wiki.qt.io/Qt6/Example-Guideline Pick-to: 6.5 Change-Id: I12c65ae11e7906fd2e9dfb449072199560488aed Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* permissions: Finalize permission example at end of CMakeLists.txtTor Arne Vestbø2023-02-011-2/+2
| | | | | | | | Otherwise the finalizers won't know which libraries we're linking to. Pick-to: 6.5 Change-Id: I886c46443b7289d6e2c7d824767ed5e34a0a1fbf Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Examples: Fix CMake Unity (Jumbo) buildsFriedemann Kleint2023-02-016-14/+18
| | | | | | | | | | Disambiguate variables and add some exclusions. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ie72b3caab9fd571c3fb6f7d8606584885bc09e66 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
* Examples: Add missing include guardsFriedemann Kleint2023-02-0112-0/+59
| | | | | | | | Pick-to: 6.5 6.4 6.2 Task-number: QTBUG-109394 Change-Id: I09a1b522d0faeb2346e1e075141f1e810c8155f7 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove wiggly exampleJan Arve Sæther2023-01-3110-357/+0
| | | | | | | | | It demonstrates timerEvent() and some QFontMetrics There are other examples that demonstrates this Pick-to: 6.5 Change-Id: I4ad6f30c8ef93c995f980545ed88ab13b9aa9c7d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix ContextInfo example crashing on AndroidJani Korteniemi2023-01-311-0/+2
| | | | | | | | | Disabled desktop OpenGL renderer on android Task-number: QTBUG-91627 Pick-to: 6.2 6.4 6.5 Change-Id: I61ec7cc768d46c368dc0187714bd0bd085257a67 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Merge "undo" and "undoframework" examplesVolker Hilsheimer2023-01-3137-1688/+82
| | | | | | | | | | | | | | | | | | The "undo" example didn't show anything that the "undoframework" example doesn't, and the latter is more comprehensive and properly documented. "undoframework" also uses QGraphicsView instead of inventing its own diagram widget. However, the "undo" example created a nicer UI with toolbuttons, icons, and the undo view in a dock widget, so reuse those elements in the "undoframework" example instead. Update the documentation quoting tags accordingly, and clean up a bit. Pick-to: 6.5 Change-Id: I3c91feecbd5fe3e5900838b0b51f9fe7bd190280 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Torrent example: Use QByteArray toPercentEncodingMårten Nordheim2023-01-301-6/+2
| | | | | | | | | | | | | | | | The hand-rolled loop produced incorrect output and was subsequently rejected by trackers. The torrent example doesn't support modern features though, so it's still a bit hit-or-miss whether a torrent will work. E.g. downloading an Arch iso does not work since it relies on DHT, PeX and HTTP seeds. Fixes: QTBUG-109798 Task-number: QTBUG-110622 Pick-to: 6.5 Change-Id: Ica40fb9205f09d135407a160a28a45d06a418176 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Torrent example: don't try to announce to an empty URLMårten Nordheim2023-01-301-0/+2
| | | | | | | | Task-number: QTBUG-109798 Task-number: QTBUG-110622 Pick-to: 6.5 Change-Id: I3603232eb094387388da6421bf5525a3ba54fe03 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Adhere to https://wiki.qt.io/Qt6/Example-GuidelineJan Arve Sæther2023-01-261-2/+2
| | | | | | | | * Remove "Example" suffix in title Pick-to: 6.5 Change-Id: I5da311850ab8f725da363969d7a8d8a1a85f8d70 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* HTTP Example: Add proxy handlingMårten Nordheim2023-01-242-0/+32
| | | | | | | | | | | If a proxy is configured on the system then we will request credentials if needed. Task-number: QTBUG-108874 Fixes: QTBUG-106245 Pick-to: 6.5 Change-Id: Icbea491492cde4634421b1a1e722a3768d56dec8 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* HTTP example: remove needlessly unset-ing window flagMårten Nordheim2023-01-241-2/+0
| | | | | | | | | | In Qt 6 it is unset by default. Task-number: QTBUG-108874 Pick-to: 6.5 Change-Id: I35af9d7c1517fd393710b7b1b978d3f39c61acf0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* HTTP example: Fix missing translation and improve othersMårten Nordheim2023-01-241-13/+12
| | | | | | | | | As a drive-by: print the path with native separators Task-number: QTBUG-108874 Pick-to: 6.5 Change-Id: I73164acb159d1a45960e16d5f57996e8c27257f7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* HTTP example: rename to HTTP ClientMårten Nordheim2023-01-242-2/+4
| | | | | | | | | | | It can do more than HTTP but let's keep the naming simple. Most people likely aren't looking to do file: or data: or qrc: in this example. Task-number: QTBUG-108874 Pick-to: 6.5 Change-Id: I8a822640f4a8015ebf6c56cb6a614d6426e8a912 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Fortune* Example: Rename and add category/tagsMårten Nordheim2023-01-244-4/+12
| | | | | | | Task-number: QTBUG-108875 Pick-to: 6.5 Change-Id: I8eeff88187be4f85514d9871eb5009c51ad6de64 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix CMakeLists.txt of Style Plugin Example (broken on macOS)Axel Spoerl2023-01-191-1/+1
| | | | | | | | | Add TARGET instruction in property setter, used in debug mode on macOS. Task-number: QTBUG-107842 Task-number: QTBUG-109227 Change-Id: I8704b7009c36ea8ddbf8773abfaf2b5f34f728ac Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix Style Plugin Example, and add some CMake DocsAmir Masoud Abdol2023-01-187-19/+77
| | | | | | | | | | | | | | | | | | | | A few things: - Improved the documentation by adding a CMake section, briefly describing the process of adding the plugin, and placing it where it should be. - Write a note about the case where the style may be overwritten at launch, and how to set the a new style using a CLI - Improved the CMake build such that it creates the App Bundle correctly, and also works without an App Bundle as well. - Changed the example, and plugin such that now instead of a QPushButton we have a QTextEdit, and change the text color. - Replaced the application screenshot Fixes: QTBUG-107842 Fixes: QTBUG-109227 Change-Id: I161a91b27df016ff6230fac3871b79d2dfbdf18a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fortune* Example: remove needless unset-ing of window flagMårten Nordheim2023-01-172-2/+0
| | | | | | | | | It's unset by default in Qt6. Task-number: QTBUG-108875 Pick-to: 6.5 Change-Id: I3f1c6e4e6de54e9ca0ed8892f9da1d346d16d4c7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fortune* Example: Bump QDataStream format versionMårten Nordheim2023-01-174-4/+4
| | | | | | | | | | | | | | One of the examples were using a different version than the others. Though QString's formatting probably didn't change since then so it was no problem. Anyway, pretend like we're releasing it now for the first time and set 6.5 on all of them Task-number: QTBUG-108875 Pick-to: 6.5 Change-Id: I28b496ab3d8ff54c503a032ba15882cdf3d5eccf Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fortune* Example: convert simple for-loop to ranged-forMårten Nordheim2023-01-174-22/+20
| | | | | | | | | Ends up shortening the loop, making it easier to read at a glance. Pick-to: 6.5 Task-number: QTBUG-108875 Change-Id: Ia12a994259b00e9b57f2de48124be9cb38553bf5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Threaded Fortune Example: update example to use qintptr for descriptorsMårten Nordheim2023-01-172-3/+3
| | | | | | | | Pick-to: 6.5 Task-number: QTBUG-108875 Change-Id: Ie635a3d2c4c61a59547e8fed0ec84da8538968a3 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Painting examples: Don't mix const_iterator and non-const iteratorsJan Arve Sæther2023-01-171-1/+1
| | | | | | | | Reported by Clazy Pick-to: 6.5 Change-Id: I80fce912b1e5390f0056b1fa9ae0d3cfcf39d045 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Compile easing curve example with -WeverythingJan Arve Sæther2023-01-171-8/+8
| | | | | | | | | | | As a consequence, also had to add some suppressions: -Wno-padded (this warning should almost never be responded to) -Wno-c++98-compat (we want to use c++17 features) -Wno-weak-vtables (IMO not worth fixing for an example) Pick-to: 6.5 Change-Id: I28ae4456c0221ad2370879a691f6343affff138b Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Remove mousebuttons examplesVolker Hilsheimer2023-01-179-374/+0
| | | | | | | | | The example didn't show anything useful, and seemed more like a manual test case. Pick-to: 6.5 Change-Id: Ia71f39b26943aab04b6895e63b6eed50dd084bfd Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Don't use file dialog in the address book exampleJan Arve Sæther2023-01-134-19/+17
| | | | | | | | | | | | | | | On small screen devices such as iPhone targets, the save file dialog is using a non-native dialog, and it doesn't fit the screen real estate to the extent that the [Ok] button is clipped away. In addition, the open file dialog and the save file dialog doesn't cooperate very well on platforms such as iOS without more plumbing. Since using the file dialog is out of the scope for this example we remove all usages of it. Pick-to: 6.5 Change-Id: Ie165355ed0b671d93e44d2d55791156367b0ea5c Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* permissions: Improve error when building example on non-supported platformTor Arne Vestbø2023-01-101-1/+4
| | | | | | | Pick-to: 6.5 Change-Id: I02f4fc087d49d21541b1e415db411c09db981278 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Link update for Data Input Output in the save game exampleJaishree Vyas2023-01-051-1/+1
| | | | | | Pick-to: 6.4 6.5 Change-Id: I2a886766d59b9e75f42e401fca9c258fcbe02809 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Fix unused variable compiler warning in slider exampleAxel Spoerl2023-01-051-0/+1
| | | | | | | | | | | The example overrides QWidget::resizeEvent() without using the QResizeEvent * argument. This results in a compiler warning. This patch marks the argument unused. Pick-to: 6.5 Change-Id: I647d0eda7d895e70ed6f232960aec992f5e37b6c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Examples: Do not wrap custom types in Qt namespaceKai Köhne2023-01-0210-41/+1
| | | | | | | | | | The Qt namespace should be used for types defined in the Qt library, not for user types. Pick-to: 6.5 Change-Id: I6df0ca054888f4a65b19a9cb44324321d1dcfad8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Doc: Fix broken linkAndreas Eliasson2023-01-021-5/+5
| | | | | | | | | | Also, adjust line length to be < 80 columns and make link parenthetical. Pick-to: 6.5 6.4 6.2 Fixes: QTBUG-107026 Change-Id: I5f7efa5d572103a6fb432d79a52a57363efd9dd7 Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
* Wait conditions example: fix an incorrect condition variable usageGiuseppe D'Angelo2022-12-282-15/+16
| | | | | | | | | | | | | | | | | | | | 3a449bbb69c9a3c3a5bc6a052f2de98ab79be7e9 amended the code to remove acquiring a lock when waking up a condition variable. It is fine to not have a lock associated when waking a condition variable; what I misunderstood was the scope of the lock, which (and this underlines the importance of commenting _what exactly_ a lock protects, for each and ever lock) protected both the buffer as well as the counter of the buffer. This made my reasoning flawed: it is necessary to keep the lock while notifying, otherwise the counterpart could verify the condition isn't satisfied and wait (e.g. see numUsedBytes==0), missing the wake from the other thread (which could arrive between the check and the wait). Amends the previous commit. Change-Id: If7db2d045331f1b33b976fb6bf6aa9117c41678f Pick-to: 5.15 6.2 6.4 6.5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* examples: port xml examples to new connection styleSamuel Gaist2022-12-211-9/+9
| | | | | | Task-number: QTBUG-106893 Change-Id: I1cab8949700d7449f0615731c85a77bb9136b0d3 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* examples: port network examples to new connection styleSamuel Gaist2022-12-216-6/+6
| | | | | | Task-number: QTBUG-106893 Change-Id: Id0f558362108fedececb9eede36becc04ff4e307 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* examples: port qpa examples to new connection styleSamuel Gaist2022-12-211-1/+1
| | | | | | Task-number: QTBUG-106893 Change-Id: Icf9a40403029c6973167f468f51b2dbdc365a848 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* examples: port qmake examples to new connection styleSamuel Gaist2022-12-211-1/+2
| | | | | | Task-number: QTBUG-106893 Change-Id: Ie4a4874359ac7750de344f4e3702ea7be09e7b53 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* examples: port embedded examples to new connection styleSamuel Gaist2022-12-213-13/+14
| | | | | | Task-number: QTBUG-106893 Change-Id: I6d00c53b7747b36c5f0094e566713f13fe74f3de Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* wiggly example: add support for emojis etc. (utf16 surrogate pairs)Eirik Aavitsland2022-12-123-11/+15
| | | | | | | | | | | The venerable wiggly example was created before unicode support was added to Qt. Hence, when extracting the individual characters from the string for painting, the code was not prepared to handle that some characters, like emojis, are composed of two QChar elements. Fixes: QTBUG-28853 Change-Id: I9804415f92775e2b78fa9fcaf7a2d112153cdce0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Remove useless Q_OBJECT in Semaphores exampleAleksandr Reviakin2022-12-071-3/+0
| | | | | | Fixes: QTBUG-108859 Change-Id: I1acf47b9dfd9c38546a2e965baa74067cedffc4a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Wait conditions example: code tidiesGiuseppe D'Angelo2022-12-062-29/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In no particular order: * Clean up #includes. * Document what is protected by the mutex. * Use explicit, nullptr. * Use lock managers, not manual calls to lock/unlock. * Unlock the mutex before notifying the condition variables. * Condition variables are always meant to be used in a while loop, and never with a plain if, because of spurious wakeups. * Don't lock a mutex just to protect a plain integer. We have atomics for that use case. * Remove an unneeded signal, therefore also the need of using Q_OBJECT and the inclusion of the moc-generated file. Pick-to: 5.15 6.2 6.4 Fixes: QTBUG-108860 Change-Id: I2afc77955b95de8aa5fb88048cd9feb217f83b4f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use const reference in loop in JSON Save Game exampleAleksandr Reviakin2022-12-051-1/+1
| | | | | | Fixes: QTBUG-108857 Change-Id: I503a3c9ebe145d0dae52b74435212807405f0247 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CMake: Clean up usage of the examples/widgets/painting/shared libJoerg Bornemann2022-12-055-95/+0
| | | | | | | | | | Remove conversion artifacts. Also, remove setting the include path. The library's interface takes care of that. Change-Id: Ib5043f15ede2171ab876ccbe603ed0b84de1bce4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix examples/widgets/painting/shared libraryJoerg Bornemann2022-12-051-3/+3
| | | | | | | | | | | | This library deliberately links PUBLICly against Qt6::Widgets and Qt6::OpenGL. Same for the target_include_directories call. This partially reverts a5de12f0d7dfef64453b7b29c33dc760b3cacec4. This fixes the builds of examples using this library. Change-Id: I2b5791044afc82e71df4a3bbfc26e5b1ab9afa76 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Avoid continuous texture alloc in Composition Modes exampleLaszlo Agocs2022-12-024-8/+22
| | | | | | | | | | There seems to be some confusion from back when the example were mass-ported to the QOpenGL stuff in Qt 5 times. Pick-to: 6.4 6.2 Fixes: QTBUG-109119 Change-Id: Ic4bcd010df3fcf82e16385ce241b379f0c351788 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Remove Android High-DPI workarounds in examplesTor Arne Vestbø2022-12-023-9/+1
| | | | | | | These should no longer be needed for Qt 6. Change-Id: Ica7214cbf4fc3ddae960309fe89681ec690d28d0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove showMaximized() workaround for Android in examplesTor Arne Vestbø2022-12-023-12/+0
| | | | | | | Android implements QPlatformIntegration::ShowIsMaximized nowadays. Change-Id: I451a9a8edc8ec407946d44f3e6921c78ac1d11aa Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QErrorMessage: Improve standard dialogs exampleTor Arne Vestbø2022-11-302-9/+7
| | | | | Change-Id: Ia5a2251662fe56809fc66cdadd117259d6bfd977 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Examples: Use PRIVATE CMake linkageKai Köhne2022-11-30238-273/+273
| | | | | | | We (almost) only build apps, for which PRIVATE linkage makes more sense. Change-Id: I09a509c3fb33a00cdfdede687b3f95d638f42091 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Remove duplicated Qt6::PrintSupport link informationKai Köhne2022-11-3011-57/+11
| | | | | | | | Some CMakeLists.txt files did link to Qt6::PrintSupport twice. Also unify formatting and order of the linker step. Change-Id: I4af935c5dc3de6c243aad8511b0803ceaa872589 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Doc: Fix typo and mismatch between code and descriptionAndreas Eliasson2022-11-302-2/+2
| | | | | | | Fixes: QTBUG-107675 Pick-to: 6.4 6.2 Change-Id: I38140617a2b0525db417137aa41a52a389b3bea3 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>