summaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* savegame ex.: fix include orderMarc Mutz2023-02-082-3/+4
| | | | | | | | | | | | 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. Task-number: QTBUG-108857 Pick-to: 6.5 6.4 6.2 5.15 Change-Id: I42727ff8bdef5336368cde349cbcb8d10bb6289f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* savegame ex.: fix extra ';' after Q_GADGETMarc Mutz2023-02-081-1/+1
| | | | | | | | | | | Fixes compiler warnings. Amends 1ff52e478bab33f3aaba5ec185295411a0e6867d. Task-number: QTBUG-108857 Pick-to: 6.5 6.4 6.2 5.15 Change-Id: Id8b81c67e55baf490aabd0483b5800b3e61965ee Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* permissions: Replace deprecated location permission usage keyTor Arne Vestbø2023-02-081-5/+5
| | | | | | | | | And add the macOS specific key. Pick-to: 6.5 Change-Id: I1e0446a1927ef530322388417b9300ae287752c3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Add android manifest and java files to exampleDavid Schulz2023-02-072-0/+3
| | | | | | | | | | These files should not change the outcome of the build process, but are merely added to better support the CMake and Android integration in Qt Creator. Also those files were previously listed in the OTHER_FILES section of the qmake project files. Change-Id: Id3d403130ee8800ed6b0877f9f1c3dd1f28b46b7 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Remove "Analog Clock Window Example"Jan Arve Sæther2023-02-079-292/+3
| | | | | | | | | | | | This is almost exactly the same as the "Analog Clock" (widget) example. "Analog Clock Window Example" demonstrates: * How to render to a QWindow (covered by RasterWindow example) * QPainter and transformations (covered by Analog Clock example) * How to use QTimer (covered by Analog Clock example) Pick-to: 6.5 Change-Id: I7f20a29798830ed6345eca250e4139cb314cab84 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* permissions: Set explicit bundle identifier for permissions exampleTor Arne Vestbø2023-02-071-0/+1
| | | | | | | | | | It's needed for location permissions to work. Pick-to: 6.5 Change-Id: Iffb5d92f863ab79434b4071d5896b349010f87fb Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* 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>