summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* shortcuteditor example: Don't reference null-actionTor Arne Vestbø2023-05-171-5/+5
| | | | | | | | | The parent nodes of the leaf ShortcutEditorModelItem nodes do not have an action item. Pick-to: 6.5 Change-Id: If9f8554101974a96f95db048b1bd691f3e89a23a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* RSS listing example: prefer setDevice() over addData(readAll())Edward Welbourne2023-05-161-13/+9
| | | | | | | | | | | | | | | The network reply is a QIODevice, so the QXmlStreamReader can be set to read from it directly, which it might potentially do incrementally, rather than by reading all the data in one go. In the process, change the set-up of the reply to first check that it got a valid URL, then check it got a reply, before doing things with that reply. Pick-to: 6.5 Task-number: QTBUG-111228 Change-Id: I3642e24e0d10721e4a0325b35a94dcb5dfbcd4e6 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove the "classwizard" exampleVolker Hilsheimer2023-05-1620-794/+13
| | | | | | | | | | | | | | It adds nothing new to what the trivial and license wizard examples show, other than a bunch of somewhat messy and outdated code to generate C++ code files based on the input. The example is referenced in a few parts of the documentation, but there are equivalent snippets in the trivial and license wizard examples, so point at those instead, and add some relevant API usage where needed. Pick-to: 6.5 Change-Id: If1ff57e775bad28920d9e019aeccae69d1f4d127 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Convert "extension" dialog example into snippetsVolker Hilsheimer2023-05-168-303/+0
| | | | | | | Pick-to: 6.5 Task-number: QTBUG-108751 Change-Id: I8ca4e058b832674dc0c8b84024cb70a667ee8db4 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Revamp the shapedclock exampleVolker Hilsheimer2023-05-163-66/+22
| | | | | | | | | | | | | | | | Rename it to "Translucent Background", as that's what the example shows how to do. And modern applications shouldn't use a (binary) mask to create shaped windows. Instead, set the TranslucentBackground attribute, don't paint pixels that should be fully transparent and use anti-aliased or semi-opaque painting for pixels that should be translucent. Adjust the example and documentation accordingly. Move the statment that widget masks create coarse visual clipping to the QWidget::setMask documentation. Pick-to: 6.5 Change-Id: Id49d854093f2cb471afb178d32723081c7543543 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc cleanup: remove old gettingStarted tutorial, move doc fileVolker Hilsheimer2023-05-1522-517/+1
| | | | | | | | | | | The Qt getting started tutorial is based on the "notepad" example files in this directory, the gettingStarted/gsQt files are completely unused and not referenced in documentation. Pick-to: 6.5 Change-Id: If8caebd2c8359c81f94f72ef40a1cf92a021a83f Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Update screenshot exampleVolker Hilsheimer2023-05-151-1/+1
| | | | | | | | Refresh screenshot of the example, and remove "Example" word from title. Pick-to: 6.5 Change-Id: I88c00db5b25536c45622bc580a9da5aaf01610bc Reviewed-by: Liang Qi <liang.qi@qt.io>
* Shrink the CBOR dumper example's imageEdward Welbourne2023-05-151-0/+0
| | | | | | | Apply optipng -o7 -zm9 -strip all to the image to make it more compact. Change-Id: Iebfc1f767759b5beac47bd7efa61d1c655163f03 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Move the addressbook tutorial into manual testsVolker Hilsheimer2023-05-1547-3747/+1
| | | | | | | | | | | | | | The tutorial is building an elaborate UI around a QMap. It doesn't use structured data, and it doesn't use model/view (which the dedicated addressbook example in itemviews does). It's not a good way of building an application, and the individual APIs for creating layouts, dialogs, or import/export are explained well enough in other examples. Pick-to: 6.5 Change-Id: Iffe47a0f6e04a933edb917c877ae845f50b74b4a Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* rsslisting example: fix bug in construction of title stringEdward Welbourne2023-05-151-4/+3
| | | | | | | | | | | | | | | | | | The correct time to clear titleString and linkString is at the start of the item element, to avoid not only the left-overs from a previous item but also any stray titles and links that don't belong to any item. The channel element, that contains the items, may also have title and link elements. This, indeed, lead to the first entry in the displayed table having a "Qt Blog" prefix on its blog-post's title. Fortunately the link was already being set, usually to empty, due to the lack of rss:about attributes on item elements. Pick-to: 6.5 Task-number: QTBUG-111228 Change-Id: I16647e2498b58caaafa6e88ef73f0d934a1f8396 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* rsslisting example: shuffle parts of constructor for clarityEdward Welbourne2023-05-151-8/+4
| | | | | | | | | | Group related things together, improve the logical flow of the code. Pick-to: 6.5 Task-number: QTBUG-111228 Change-Id: If3eb577b74128b305ca5fb3074168280ec2d4db8 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* rsslisting example: move default URL to main()Edward Welbourne2023-05-153-4/+5
| | | | | | | | | | | | | It felt more natural that the RSSListing class would be agnostic about the default URL, so let it be a constructor parameter. In the process, update the URL to what the old one now redirects to (thanks to Ivan Solovev for spotting that) and make the constructor explcit (thaks to Ievgenii Meshcheriakov for suggesting this). Task-number: QTBUG-111228 Pick-to: 6.5 Change-Id: I9f4c0d126e0872bb4ec6e6bb41add7e9d2a9537f Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
* rsslisting example: Tidy up #include usageEdward Welbourne2023-05-153-7/+4
| | | | | | | | | | | | | | | | Replace one #include with a forward-declaration - in rsslisting.h QUrl is only passed by reference to a function. Shuffle order of existing forward declarations to be alphabetic, in the process. Shuffle #include order in sources so that this example's own headers appear before the Qt ones. Pick-to: 6.5 Task-number: QTBUG-111228 Change-Id: I69a9e091c77f9d3190c0217c8bd9262e056f66fc Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* rsslisting example (coding style): split a long line, purge stray bracesEdward Welbourne2023-05-151-5/+4
| | | | | | | Pick-to: 6.5 Task-number: QTBUG-111228 Change-Id: Ic919d4dee74823f11c55d286beba447d45111754 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* rsslisting example (coding style): fix horizontal spacingEdward Welbourne2023-05-152-3/+3
| | | | | | | | | | Remove space after *, insert space after comma. Pick-to: 6.5 Task-number: QTBUG-111228 Change-Id: I7525715dede20b45241efaf3f9540c896b1455c7 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* rsslisting example: remove unused include and surplus blank linesEdward Welbourne2023-05-152-7/+0
| | | | | | | | Pick-to: 6.5 Task-number: QTBUG-111228 Change-Id: Ibfa82aef67eaf6ba758dade30a4c9542f2836123 Reviewed-by: Mate Barany <mate.barany@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
* savegame example: clarify that CBOR can be readEdward Welbourne2023-05-151-5/+6
| | | | | | | | | | | | | The documentation talked about using CBOR to keep folk from reading, where (of course) it merely makes it more obscure (and compact). Make clear that this just makes it less easy and mention the tool that makes it easy again. Task-number: QTBUG-111228 Pick-to: 6.5 Change-Id: I472acda4b7533db41ab0e78b694e0256b34d2b40 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add metadata to serialization examplesEdward Welbourne2023-05-153-0/+4
| | | | | | | | | | | | | | There's no separate category for {de,}serialization, so I've put them in Input/Output; and at least some of them are relevant to transmission over the network, so include that as a tag, so that someone writing a network application that wants to use what they illustrate gets a chance of being lead to it. Pick-to: 6.5 Task-number: QTBUG-111228 Change-Id: Ie9f6dbaf85aed852e9f64eba05ec8c5fe0a7382d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Docs: Update OpenGl example docsNicholas Bennett2023-05-092-14/+135
| | | | | | | | | | | | | Updated hellogle3 and cube docs. Made brief statements more brief, rearranged to reference examples were suitable, added snippets. Fixes: QTBUG-108416 Pick-to: 6.5 Change-Id: Ia86f9dc8eaa53d9f9654afe099caf3ee8c7fccee Reviewed-by: Mats Honkamaa <mats.honkamaa@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rsslisting example: don't leak the RSSListing objectEdward Welbourne2023-05-091-2/+2
| | | | | | | | | | | It was new'd and unparented, so its destructor was never getting called. A stack instance will do just fine. Pick-to: 6.5 Task-number: QTBUG-111228 Change-Id: If362b0e1e5b50d711a8fe8e01a8830034edf5363 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
* Update cbordump image to a higher-resolution oneEdward Welbourne2023-05-091-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Incidentally using reversed video, too, as that's what came naturally to the terminal I was using. File is smaller, but text in the new image is considerably more readable and the image is bigger. The examples guideline calls for an image giving some idea what the example is about, with a 4:3 or 5:4 aspect ratio. An image shorter than its width wasn't practical, and getting a useful amount of information in a height less than 3/2 of the width would have required widening into blank space purely to satisfy the aspect ratio. The prior image's ratio was about 12:7, the new one's is roughly 2:3. The old image showed the start of cbordump -a output, which is rather less illuminating than the default output of formatted data; it's also rather verbose, so was cut off part way through. It does, however, illustrate how the annotated form might be useful for debug purposes. The image also had a lot of blank space to the right of the text of interest, wasting roughly half of its width; it could easily have been cropped to 1:1 without loss of information. As example data-set, it used ../savegame/save.dat, but without any hint to how to generate that. I decided to include a hint to how to generate a CBOR data file to dump, then show the standard output and only the beginnings of the annotated output, as the latter (even on its own) would make the aspect ratio considerably taller. In the context of the standard display, the preamble of the annotated one gives a reasonable feel for what's going on, without belabouring the point. Pick-to: 6.5 Task-number: QTBUG-111228 Change-Id: Ic54893c483607e95627a50db76a0d9918744c07e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Add XML, Json, CBOR examples to IO categoryKai Köhne2023-05-095-1/+5
| | | | | | | | Pick-to: 6.5 6.5.1 Task-number: QTBUG-112372 Change-Id: I867bd33ff08629e03b35eccd4b7418573abe7c68 Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* savegame ex.: revamp the way print() worksMarc Mutz2023-05-098-20/+29
| | | | | | | | | | | | | | | Basically, instead of re-creating QTextStreams all the time, create it once, in main(), and then pass it to print() alongside the int indentation. Also fix a hard-coded indentation value that should have been relative to the caller's indentation level. Pick-to: 6.5 6.2 Task-number: QTBUG-108857 Change-Id: I811447295c9c3fdef23f61aff31ebe82941eb3b4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Revamp DOM Bookmarks exampleØystein Heskestad2023-05-045-4/+106
| | | | | | | | Fixes: QTBUG-111974 Pick-to: 6.5 Change-Id: Ia62eaf36f616278e49112884db8aec37e2b1dcc5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* Flip string comparisons in savegame exampleEdward Welbourne2023-05-041-2/+2
| | | | | | | | | | | | | | This follows up to commit 9834e80833783357743b2a5abe3071760638effb, fixing an accidental flip to the meaning of keywords on the command-line. If the first word is "load" we should load a prior game, not start a new one; if the second is "binary" we should use CBOR, the binary format, not JSON. Pick-to: 6.5 Task-number: QTBUG-111228 Change-Id: If29070777daf68f2f959bc1ec4ffd67ba90b28ba Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* savegame ex.: revamp the way we (de)serialize JSONMarc Mutz2023-05-037-113/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JSON, unlike, say, QDataStream, allows building up objects independent of some central object, and combining them into a QJsonDocument later. This suggests returning QJsonObjects from a toJson() const method instead of having the caller supply a QJsonObject. Doing it this way enables transparent move semantics to kick in, too. For deserialization, use a fromJson() named constructor for value-like classes (where identity doesn't matter, only equality). Keep using read(), too, and add a note to explain when to use which form. Also, avoid the triple lookup from if (json.contains("key") && json["key"].isSoughtType()) mFoo = json["key"].toSoughtType(); by using C++17 if-with-initializer and showing the trick with Undefined never being of isSoughtType(): if (const QJsonValue v = json["key"]; v.isSoughtType()) mFoo = v.toSoughtType(); Adjust the discussion to match the new code, up the copyright years and rename some qdoc snippet markers from nondescript [0]/[1] to [toJson]/[fromJson]. Task-number: QTBUG-108857 Pick-to: 6.5 6.4 6.2 Change-Id: Icaa14acc7464fef00a59534679d710252e921383 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Replace runic XSLT with a python script and tidy cbordump codeEdward Welbourne2023-05-023-201/+276
| | | | | | | | | | | | | | | Filters records on having value < 256, or an RFC, previously hacked into the XSLT to produce the last update, with a bit of hand-editing. Using a python script makes it easier to control the formatting and other details; for example, severl entries previously had descriptions that mentioned their RFC, with specific section, to which the XSLT was adding a redundant mention of the RFC. It is also possible to exploit C++ string juxtaposition to get tidily-presented string literals, without having to resort to raw strings. Task-number: QTBUG-111228 Change-Id: Ibd1c93dc1c88689e78b2b13a6bcb59a003f4df0f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Examples: Use versioned CMake targets for Qt modulesKai Köhne2023-05-021-5/+5
| | | | | | | | | | | Use e.g. Qt6::Core instead of Qt::Core. This is better matching the find_package(Qt6 ...) call, and also avoids issues that the versionless targets have. Pick-to: 6.5 Task-number: QTBUG-113277 Change-Id: Ib4373036092163518a611bd5c688591d18096d7e Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Doc: Add 'Mobile' category to Qt Android Notifier exampleTopi Reinio2023-05-021-0/+1
| | | | | | | | | | The example demonstrates accessing native Android APIs in Qt applications, tag it with 'Mobile' category. Pick-to: 6.5 Task-number: QTBUG-112378 Change-Id: I5f936409aafb22175eab59fdb210ecd03fecb1f3 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Rework imagescaling example to avoid potential crashesIvan Solovev2023-04-263-75/+127
| | | | | | | | | | | | | | | | | | | | | | | | | Creating a continuation with QtFuture::Launch::Async policy does not work well with the example, because it still needs to update the UI once the async continuation is finished. If the user decides to close the application while the async continuation is executed, the next continuation will be accessing data from the destroyed Images object. Fix it by using QtConcurrent::run() to do the "heavy" work in a separate thread, and use a QFutureWatcher to handle the results of the async execution. Update the example documentation accordingly. After this patch the example still shows the usage of continuations and onCanceled()/onFailed() handlers. However, it now does not illustrate the usage of different launch policies and continuation contexts. It might not be a big issue, because the QFuture documentation describes these topics rather extensively. Fixes: QTBUG-103514 Pick-to: 6.5 Change-Id: I8142535064ff7a4e8007a5c0a8fe7709d6d942ec Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Android-example: add missing properties in AndroidManifest.xmlBartlomiej Moskal2023-04-261-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | After changing android target SDK version to 31, some missing values has to be defined in AndroidManifest.xml. AndroidManifest.xml template was updated in qtbase in: 56dee3de5e4ac1c4d37a2c5e27361e7ddbdea1a7 commit. In case when example uses its own AndroidManifest.xml file, it need to be updated separately. * android:exported="true": because the manifest sets an intent-filter, and it then has to explicitly to avoid the warning [1]. * android:allowBackup="true": this has to be explicitly set, we set it to the default value here [2]. * android:fullBackupOnly="false": SDK 23+ use this to deteremine to user auto backup or not, we set it to the default value here [3]. [1] https://developer.android.com/guide/topics/manifest/activity- element#exported [2] https://developer.android.com/guide/topics/manifest/application- element#allowbackup [3] https://developer.android.com/guide/topics/manifest/application- element#fullBackupOnly Fixes: QTBUG-112816 Pick-to: 6.5 6.2 5.15 Change-Id: Ia48007a84009901be508d6cc087790d574227ad7 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Tune textures example to work with wasm and update docsLaszlo Agocs2023-04-251-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | Old examples inherited from Qt 4 tend to set some state, such as enabling the depth test or culling, in initializeGL(). Newer examples tend not to do this; they rather set the necessary state in paintGL(). This mattered little (or not at all) in the past, but with WebAssembly and WebGL there are limitations in the GL context management in the wasm platform plugin. Under certain conditions, esp. when QOffscreenSurface is involved, it looks like the same native context gets reused, which means there is a chance of unexpected changes to the current state between calls to initializeGL() and paintGL(). (and also between paintGL() calls) See QWasmOpenGLContext for details. Update the textures example the same way we did for the cube one. Add a note to the QOpenGLWidget docs about this problem. Task-number: QTBUG-111304 Pick-to: 6.5 6.4 Change-Id: I29d2b2cdeb07bcecc5dc915d79c12b4323ca9ab3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Inho Lee <inho.lee@qt.io>
* cube example: always set required state in paintGLLaszlo Agocs2023-04-201-8/+8
| | | | | | | | | | ...instead of expecting whatever was set in initializeGL will persist. Task-number: QTBUG-111304 Pick-to: 6.5 6.4 Change-Id: Ifcf75a3df9bed6a45d2e9264a5e3f32504b42313 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Update table of CBOR tag descriptions in cbordump exampleEdward Welbourne2023-04-192-46/+185
| | | | | | | | | | | | | | | | | | | | A comment said how to do this, so I gave it a try. Added a note to the instructions to save the next person to look at this from, as I initially did, thinking the comment in the generated code had the URL wrong. It turns out that some of the newer additions to the IANA registry have semantics elements that spread across several lines. I don't know the XSLT magic to replace each newline in a value, along with its preceding and following spacs, by a single space, so adapted the XSLT to produce C++ raw strings to wrap these multi-line entries. That'll produce somewhat ugly output, so left a TODO for the better solution. Task-number: QTBUG-111228 Pick-to: 6.5 Change-Id: I7d5e968284e0f1da2ec990af9512c9b7cb886792 Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove excess namespaces from XSLTEdward Welbourne2023-04-191-1/+2
| | | | | | | | In the process, break up a long line. Change-Id: Iec50e3bf292da9a3d4aef22bf5c59f2008b35c1f Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* cube example: Switch to a power-of-two textureLaszlo Agocs2023-04-191-0/+0
| | | | | | | | | | | | | | Just to make sure it runs with strict WebGL 1 implementations. This cannot generally be a solution, naturally, so requiring WebGL 2 is more likely the way to go, but in the case of this example it seems the only thing we need is to resize the image file, so we might just as well do that. Pick-to: 6.5 6.4 Task-number: QTBUG-111304 Change-Id: I1b4a72ac1a7b94575bf1abd61c5aa722959c92e4 Reviewed-by: Inho Lee <inho.lee@qt.io>
* cube example: make sure the program is boundLaszlo Agocs2023-04-181-0/+1
| | | | | | | | | | | | | | ...in paintGL. There is nothing saying the current program (or other state) cannot change between paintGL calls (or initializeGL and paintGL calls). Correctly call program.bind(). This eliminates the WebGL warning with WebAssembly. Pick-to: 6.5 6.4 Task-number: QTBUG-111304 Change-Id: I19792f5f193dcdb305473a939780df33deb1f8e1 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Torrent example: update usage of integer typesMårten Nordheim2023-04-116-63/+64
| | | | | | | | | | | | Some of the 'int's are purposefully 32-bit because that's what the protocol is, but others aren't. So, be more explicit. Task-number: QTBUG-110622 Pick-to: 6.5 Change-Id: I338abca1f13b0c95f49a6f52933712f43f147590 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Doc: Use the \examplecategory macro to tag examplesTopi Reinio2023-04-118-8/+8
| | | | | | | | | | | | | | | | 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: I46762dabc5f718fecc09a3533235eaa911dda5a0 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Docs: don't link to removed exampleVolker Hilsheimer2023-04-111-3/+2
| | | | | | | Pick-to: 6.5 Change-Id: I5fcec02cd18971150eec4f119d902c695bf2ebb9 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
* savegame ex.: give some TLC to main()Marc Mutz2023-04-111-8/+11
| | | | | | | | | | | | | | - include what you use - make 'args' const, so we don't detach in op[] - make boolean variables const - use QString::compare(lhs, rhs, Qt::CaseInsensitive) instead of lhs.toLower() == rhs - use new _L1 UDL - fix indentation of a return statement Pick-to: 6.5 Change-Id: If9da4fbe975d9a97939ea01558b2a8cef7ad3a24 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove unused variable/codeAmir Masoud Abdol2023-04-072-7/+0
| | | | | | | Pick-to: 6.5 Change-Id: I8d28db64c1ae2c57c95b2f9f22303d74172226e9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Fix CMakeLists.txt of echo plugin exampleAxel Spoerl2023-04-061-1/+5
| | | | | | | | | | | | This patch adds a missing dependency to the echo plugin for shared builds. Since it fixes the last remaining example, it closes the Jira ticket. Fixes: QTBUG-112300 Pick-to: 6.5 Change-Id: Ib1da2d7d5f5d54d7224f1c65a995f3752037e5be Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Move streambookmarks example into corelibe/serializationØystein Heskestad2023-03-3118-25/+27
| | | | | | | | | | | | The stream-based XML serialization API resides in corelib/serialization. Move the steambookmarks example there. The Qt XML documentation is updated to no longer refer to this example code directly and refer to the direct location in the example documentation instead. Task-number: QTBUG-110647 Pick-to: 6.5 Change-Id: Id36fb04a6acb7b8d1eb008f61568fe0abc221e3d Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* complexpingpong example: Modernize the codeIevgenii Meshcheriakov2023-03-284-39/+41
| | | | | | | | | | | Use C++ IO streams and qWarning() instead of (f)printf() for console IO. Make user-visible strings translatable. Use invokeMethod() instead of QTimer. Fixes: QTBUG-111366 Pick-to: 6.5 Change-Id: I6990b964c2097267e04cd361b9cd8fc0a22a0135 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix pointer mismatch after QList::move() in tooltip exampleAxel Spoerl2023-03-283-24/+36
| | | | | | | | | | | | | | | | | | | | | | | | The tooltip example moves shape items within a QWidget. Shape items are stored in a QList of objects. When an item is moved, its pointer is taken from the QList and stored in a member variable. To have the moved item on the bottom of the list, QList::move() is called. This operation re-arranges the list objects, and the member variable starts pointing at a wrong object. This patch changes the list from a list of objects, to a list of pointers. Shape items are therefore allocated on the heap. A destructor is added to free the heap with qDeleteAll. The example's documentation is adapted accordingly and a snippet for the destructor is added. As a drive-by, int is replaced by qsizetype where it was used as an index of a QList. Fixes: QTBUG-104781 Pick-to: 6.5 6.2 Change-Id: I9be26fa7954be5f85729d24f166d66980af71801 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* CMake: build the shared plugin when building the plugandpaint targetJoerg Bornemann2023-03-281-1/+5
| | | | | | | | | | | | People expect that building the "main target" of an example builds all necessary subtargets as well. Add a dependency from plugandpaint to pnp_extrafilters. Pick-to: 6.5 Task-number: QTBUG-112300 Change-Id: I036beb961fe474ff060f93c98f5e2bda58e66f71 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* dbus examples: Remove "Example" from example namesIevgenii Meshcheriakov2023-03-244-5/+5
| | | | | | | | Task-number: QTBUG-111366 Pick-to: 6.5 Change-Id: Ia34c60ed4c0ffe5b01cc507dd5e45521c096b0bf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* remotecontrolledcar example: Modernize the codeIevgenii Meshcheriakov2023-03-236-57/+27
| | | | | | | | | | Also remove unused crashed() signal. Task-number: QTBUG-111366 Pick-to: 6.5 Change-Id: Ia23552a6396c324c7591643afaa634879a2c185e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* mainwindow example: Fix implicit conversion from qsizetype warningsTor Arne Vestbø2023-03-232-3/+3
| | | | | | Pick-to: 6.5 Change-Id: Ifaeeb620420f43529bb9e3d533b4e1a2e20c68ca Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>