summaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* dbus examples: Update screenshotsIevgenii Meshcheriakov6 days6-2/+2
| | | | | | | | | Use WEBP format to reduce the file size. Task-number: QTBUG-111366 Pick-to: 6.5 Change-Id: I14ff15010e7ac7e1b375eeafaa1c153b0fdd95e6 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Imagescaling example: fix memory leaksIvan Solovev7 days1-1/+2
| | | | | | | | | | | | | * The DownloadDialog was never destroyed properly. Pass 'this' to its constructor to fix it. * When re-creating an image grid layout, properly clean up old image labels in Images::initLayout() Task-number: QTBUG-103514 Pick-to: 6.5 6.5.0 Change-Id: Ief52774002632d4ad3a6cca85bb0c0aa1a1d4bc0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Doc: Remove broken link to Anchor Layout ExampleAndreas Eliasson7 days1-2/+0
| | | | | | | | | This example was moved to manual tests in 6.5, which broke the link. Now that it's in manual tests, I guess we can stop promoting it. Pick-to: 6.5 6.5.0 Change-Id: I1aa4a7de5123e96bf9ff56eeae49104acdce9645 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Update the bindable properties exampleJames DeLisle11 days9-47/+43
| | | | | | | | | | | | - Fix the number of months in each duration - Move the user Country enum to use QLocale::Territory - Properly calculate the cost per month to match the UI label - Use QLocale to format the price display text - Fix some misspellings and grammar in the doc Pick-to: 6.2 6.5 Change-Id: I78a64f344073070cd94d5cb4a8a4c7c13afa337f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Example: remove runfunction exampleDennis Oberst11 days6-81/+0
| | | | | | | | | | | | | | This example shows how to use QtConcurrent::run by calling a global function and printing the thread ID. As the documentation already explains the functionality very well, I don't think this example is necessary. https://doc.qt.io/qt-6/qtconcurrentrun.html Task-number: QTBUG-111165 Pick-to: 6.5 6.5.0 Change-Id: I42a718cdaabdaeeab39b933d12c67d11978c95da Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Example: remove map exampleDennis Oberst11 days6-100/+1
| | | | | | | | | | | | | This example only demonstrates the use of blockingMapped. Considering that the QtConcurrent::mapped~ functions are already included in the wordcount example, and have very similar APIs to the QtConcurrent::filter~ functions, which are included in the progressdialog example, this no longer serves a useful purpose. Task-number: QTBUG-111165 Pick-to: 6.5 6.5.0 Change-Id: Ibc526e1a9fb17070e376e45151e9c2bdbc69bd32 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Example: update imagescaling exampleDennis Oberst11 days5-14/+17
| | | | | | | | | | | Updated the example to align with the Qt6 Example-Guideline. https://wiki.qt.io/Qt6/Example-Guideline Task-number: QTBUG-111165 Pick-to: 6.5 6.5.0 Change-Id: Ibd9e7ce0d4dee90f6a693b81516d2f5b86345b1d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* dbus examples: Remove listnames exampleIevgenii Meshcheriakov2023-03-036-114/+1
| | | | | | | Task-number: QTBUG-111366 Pick-to: 6.5 Change-Id: I5c483cbfec4072dae610c6d98b97d10057ba9ddc Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* HTTP example: update screenshotMårten Nordheim2023-03-023-1/+1
| | | | | | | | Fixes: QTBUG-108874 Pick-to: 6.5 Change-Id: Ib87895c6512abb967734ce4c1ed0be76c698feb4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Move anchor layout example to manual testsJan Arve Sæther2023-03-027-193/+0
| | | | | | Pick-to: 6.5 6.5.0 Change-Id: I9c9a9dbcdaf705a31208b80b71e978938a492142 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Move xmlstreamlint example into tests/manualØystein Heskestad2023-03-026-185/+0
| | | | | | | | | | This example is useful but not a typical starting point for an application. Task-number: QTBUG-110647 Pick-to: 6.5 Change-Id: Ic4af8ed648c587b91110a7403fa80c619549289d Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Remove htmlinfo exampleØystein Heskestad2023-03-0211-3494/+1
| | | | | | | | | | This example is removed because what it does is already covered by the other XML examples. Task-number: QTBUG-110647 Pick-to: 6.5 Change-Id: If33e3fc55dcd9c7c10cfdfa86405f8bcf5cb6187 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Remove the 'sdi' exampleVolker Hilsheimer2023-03-0216-644/+3
| | | | | | | | | | | It is essentially the same as the other mainwindow examples, showing how to create a text editor. The only special code here is the tiling of the different main windows, which - without any documentation or explanation - is neither very helpful, nor relevant in 2023. Pick-to: 6.5 Change-Id: I48b92b1cf057f586e0d2842d1c0a3312154e9a13 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* DNS Lookup: Use ideomatic cstdio includeMårten Nordheim2023-03-021-19/+21
| | | | | | | | | Task-number: QTBUG-108873 Pick-to: 6.5 Change-Id: I646f0c985adc45a17103b5f98394f3def4b6ada2 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* DNS Lookup: Change local function to return struct instead of enumMårten Nordheim2023-03-021-36/+38
| | | | | | | | | | This let's us get rid of an out-parameter. Task-number: QTBUG-108873 Pick-to: 6.5 Change-Id: Ifc08d3905932f28ecdfdf3a7de1499700cc7e606 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* DNS Lookup: Use standard functions to print version/helpMårten Nordheim2023-03-021-4/+3
| | | | | | | | | | showHelp was already in use, but not showVersion. Return 0 in both cases, even if it's unreachable. Task-number: QTBUG-108873 Pick-to: 6.5 Change-Id: Iba820e89d7de066130163e7829f75bbfcfa3f7dd Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* DNS Lookup: reflow some code to avoid exceeding column limitMårten Nordheim2023-03-021-15/+31
| | | | | | | Task-number: QTBUG-108873 Pick-to: 6.5 Change-Id: Ic17ded256152f7d89bd200ea0e163f2b8f1ea70a Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* DNS Lookup: Use std::optional instead of casting enum to intMårten Nordheim2023-03-021-5/+5
| | | | | | | Task-number: QTBUG-108873 Pick-to: 6.5 Change-Id: I0bd5dc004154c1c4026be2feb6187c53e5e77801 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* DNS Lookup: Avoid unneeded allocations in parsing functionMårten Nordheim2023-03-021-11/+11
| | | | | | | | | | | By using .compare(~~~, Qt::CaseInsensitive) instead of .toLower() Task-number: QTBUG-108873 Pick-to: 6.5 Change-Id: I60e1fdc0a54450e7385e90f84fd509e62b82d2c9 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Delete the Network Download (Manager)? examplesMårten Nordheim2023-03-0214-622/+0
| | | | | | | | | | | | | | | | | | | | Their use of QtNetwork is already covered by the HTTP example. While showcasing that QNAM easily deals with multiple simultaneous requests, waiting until finished() is emitted to write anything is not exactly idiomatic. And managing your own queue to only have one request running at a time is a weird example for an asynchronous framework. In this regard, having an example for a complete download manager (with a GUI) would be interesting, but may ultimately be very time-consuming to make for limited gain. Task-number: QTBUG-110643 Pick-to: 6.5 Change-Id: I6b2c1546b85fa89ab7ce1ff5565b0293b5710b74 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* Move Weather Anchor Layout example to manual testsJan Arve Sæther2023-03-0214-327/+1
| | | | | | Pick-to: 6.5 Change-Id: I8782a83b5c12b4f57bf9ef9063818cb124bddd56 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Doc: move snippet for implicit translation contextVolker Hilsheimer2023-03-012-2/+2
| | | | | | | | | The 'sdi' example is a candidate for removal, so point at the spreadsheet example instead, which is not. Pick-to: 6.5 Change-Id: I4405f2421db8be79898a38ca4f3fa1ea5fe0280b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Doc: fix links to renamed network examplesVolker Hilsheimer2023-03-015-8/+7
| | | | | | Pick-to: 6.5 Change-Id: I8790bb660070a092e268294b5640c6d5af41deb0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* pingpong example: Remove pong.hIevgenii Meshcheriakov2023-02-284-19/+12
| | | | | | | | | Move the class definition inside pong.cpp. Task-number: QTBUG-111366 Pick-to: 6.5 Change-Id: Id4b376451cb2bdbd04ccce4b2dcf0760dbfbfb2a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* pingpong example: Modernize the codeIevgenii Meshcheriakov2023-02-283-24/+22
| | | | | | | | | | | | | | | | | Use qWarning()/std::cout instead of C IO functions. Use default parameters for QDBusInterface's constructor. Remove useless Q_SCRIPTABLE. Use type-safe invokeMethod(). Extract a local variable for the used D-Bus connection. Task-number: QTBUG-111366 Pick-to: 6.5 Change-Id: Idc38a7c1dd97d71308d9491193039744c759d6f2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Remove duplicate wordsAndreas Eliasson2023-02-285-5/+5
| | | | | | Change-Id: Ia7a38a1035bd34d00f20351a0adc3927e473b2e7 Pick-to: 6.5 6.4 6.2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Fortune* Example: update screenshotsMårten Nordheim2023-02-284-0/+0
| | | | | | | Fixes: QTBUG-108875 Pick-to: 6.5 Change-Id: Ib57482959973815681b0b178acea3634a4f63220 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Remove threadeqopenglwidget exampleLaszlo Agocs2023-02-2811-616/+0
| | | | | | | | | | | | | | | It is neither documented nor very useful, and it has platform-specific issues as reported over the years. Remove it now as part of the example revamp initiative. Task-number: QTBUG-50278 Task-number: QTBUG-110093 Task-number: QTBUG-76054 Task-number: QTBUG-43209 Pick-to: 6.5 Change-Id: I6dadaf4162b4c19411c544b9f204c19e37aa740d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* chat example: Update code styleIevgenii Meshcheriakov2023-02-272-66/+27
| | | | | | | | | | | Use lambdas instead of slots where practical. Consistently use signals to transmit D-Bus messages. Extract a local variable for the used D-Bus connection. Task-number: QTBUG-111366 Pick-to: 6.5 Change-Id: Icc6667e1392ada1b7d3b33c4e4b32917dd648390 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* chat example: Remove empty destructorIevgenii Meshcheriakov2023-02-272-5/+0
| | | | | | | Task-number: QTBUG-111366 Pick-to: 6.5 Change-Id: I880c16638c992a4ee8528b1c545e6f563a7efa8b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* chat example: Remove commented-out codeIevgenii Meshcheriakov2023-02-271-2/+0
| | | | | | | Task-number: QTBUG-111366 Pick-to: 6.5 Change-Id: Ib8e89427357f604ab30cb0de50eb373cffb945fa Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* chat example: Use QInputDialog to get a user nicknameIevgenii Meshcheriakov2023-02-275-178/+20
| | | | | | | | | | This gets rid of a custom form. Also quit the application if user closes the input dialog without entering a nickname. Task-number: QTBUG-111366 Pick-to: 6.5 Change-Id: I56ed99d69d031e7ef06711fc7ec112311c974ca6 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* examples: port widget examples to new connection styleSamuel Gaist2023-02-257-34/+41
| | | | | | Task-number: QTBUG-106893 Change-Id: Ib10fd516fdbeda0087b1c8550ce340acd3973e6b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix qtbase build when all deprecated code are disabledYuhang Zhao2023-02-225-8/+8
| | | | | | | | | Adjust the callers to use the non-deprecated APIs. Pick-to: 6.5 Change-Id: I8e96f25684a2d613bc400a8626dc9e3af2bb8dcf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Torrent example: Fix use-after-free crashMårten Nordheim2023-02-211-0/+4
| | | | | | | | | | | | The crash would sometimes happen shortly after removing a torrent since the RateController would still try to use it even though it had been deallocated. Pick-to: 6.5 Task-number: QTBUG-110622 Change-Id: Icad1531ea58560a3a3157a3ed8c0e6b283573196 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* Torrent example: Fix some stack overflow issuesMårten Nordheim2023-02-211-2/+2
| | | | | | | | | | | | | | Because of the .size() used as part of the expression it ends up copying sizeof(qsizetype) bytes to the array, instead of the (rationally) expected 4 bytes. Amends 69c31f6f68a1399c1fc1e545e318eaa40966fe85 Pick-to: 6.5 Task-number: QTBUG-110622 Change-Id: I732e3f4bb5934ff3860087baa91f9bebbf044a7f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* Torrent: simplify QBitArray usageMårten Nordheim2023-02-211-7/+1
| | | | | | | | | | There is specific API for counting number of 0-bits Pick-to: 6.5 Task-number: QTBUG-110622 Change-Id: Ifa33862ff7b98a59f362bc52c492e8a037799835 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* examples: Connect Quit action to QCoreApplication::quit, not QWidget::closeTor Arne Vestbø2023-02-2010-10/+11
| | | | | | Pick-to: 6.5 Change-Id: I44ca7b61a4a261a7d3aad0dfeb870eb927ee768d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* mainwindow example: Don't assume toolbar parent is main windowTor Arne Vestbø2023-02-202-12/+6
| | | | | | | | | Adding the toolbar to the main window leaves it up to the main window how to handle ownership and placement of the toolbar. Pick-to: 6.5 Change-Id: Id429cbad9d5973931a86fcb899684e3651694fbb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Torrent example: delete unimplemented functionsMårten Nordheim2023-02-141-3/+0
| | | | | | | | | | That's not fit for an example... Task-number: QTBUG-110622 Pick-to: 6.5 Change-Id: Ib196d61867f95f3ff2e45841509d49df9360ad25 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Torrent example: Convert some timeouts from int to chronoMårten Nordheim2023-02-144-9/+11
| | | | | | | | | | | | Using seconds because then they all have the same type, even if all-but-one could use minutes. Delete one unused interval value. Task-number: QTBUG-110622 Pick-to: 6.5 Change-Id: I66b456de8a4b867859e9e2b13ce72e8ec691c79a Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Torrent example: Remove manual little-big endian conversionMårten Nordheim2023-02-141-43/+24
| | | | | | | | | | | | ... and use QtEndian instead. The conversion would be done even on a big-endian system, so the example would not work correctly on such machines. Task-number: QTBUG-110622 Pick-to: 6.5 Change-Id: I6a660ff68fa5a8d9b4c1faf9e264d937c605c47e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Delete googlesuggestMårten Nordheim2023-02-1411-500/+0
| | | | | | | | | | | As a networking example it doesn't contribute much. But it has some interesting uses of widget/events Pick-to: 6.5 Change-Id: I194d32e6a304ae41819c20751e9f1ee1d9b5abdb Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Examples: move widgets/codeeditor into manual testsVolker Hilsheimer2023-02-099-446/+0
| | | | | | | | | | | | | It's not a very well written example, using (largely unneed) hacks to implement what it does. It's also misleading - the syntaxhighlighter example is a better showcase for building a useful code editor. Move it to manual tests. Fixes: QTBUG-111025 Pick-to: 6.5 Change-Id: I405d41688235bf3e9a08373e716769f26d02fec6 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Move findfiles example into manual testsVolker Hilsheimer2023-02-098-646/+0
| | | | | | | | | | | | | | | | | | | | The example follows bad and outdated practices: - running time consuming and I/O heavy workload in the GUI thread - calling processEvents to keep the UI responsive - showing results only at the end of a search rather than continuously Perhaps this example can be rewritten at some point to apply modern practices (at least use a thread and emit signals), but it seems to have low overall educational value. Moving it to be a manual test for now. Fixes: QTBUG-111002 Pick-to: 6.5 Change-Id: Id630fd4599096448ea4f96bcbf977b11a039796f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Turn elidedlabel example into a code snippetVolker Hilsheimer2023-02-0910-474/+0
| | | | | | | | | | | | The example is 90% boiler plate for subclassing QFrame and providing a bit of GUI to change the size of the label using sliders. The interesting bit is a block of 25 lines of code, so turn those into a snippet and add that to the QTextLayout overview documentation. Fixes: QTBUG-111011 Pick-to: 6.5 Change-Id: I6e97b2ea47b553c8d998ad185cfac006721ef7ee Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* savegame ex.: fix include order [2/2]: game.hMarc Mutz2023-02-081-3/+3
| | | | | | | | | | | | | | Includes should be ordered from most specific to most general. This means that project-specific includes always come before Qt includes. This example didn't follow that guideline. Fix. Amends 88e8094f18e6581f2b652eb3d82f514ecf687046. Task-number: QTBUG-108857 Pick-to: 6.5 6.4 6.2 5.15 Change-Id: Iafdae9dd8e70ff99882c4344a023a21d15fa3c54 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* savegame ex.: make Level ctor explicitMarc Mutz2023-02-081-1/+1
| | | | | | | | | | A QString is not a full representation of a Level, so the Level(QString) ctor should be explicit. Pick-to: 6.5 6.4 6.2 5.15 Task-number: QTBUG-108857 Change-Id: I24b705139e61c4aaf59cb0aad3b536013e0d07df Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* savegame ex.: use ranged instead of indexed loopsMarc Mutz2023-02-082-4/+4
| | | | | | | | | Modernizes the code, and fixes qsizetype/int mismatch. Task-number: QTBUG-108857 Pick-to: 6.5 6.4 6.2 Change-Id: Id4262ee0bcb673d62135a81c30976903eef3e5e2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* savegame ex.: use NSDMI, =default the default ctorMarc Mutz2023-02-082-6/+4
| | | | | | | | | Modernizes the code. Task-number: QTBUG-108857 Pick-to: 6.5 6.4 6.2 5.15 Change-Id: I6ddf1de3699506ffc0fc4b1034ab48defafcf174 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>