summaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
...
* rhiwindow example: Make -g option (OpenGL) work on macOSLaszlo Agocs2023-06-211-1/+11
| | | | | | | | | | Of course we managed to rely on a GLSL feature that is only in GLSL 130 and newer, not 120 which is what the default 2.1 OpenGL contexts support on macOS. Change-Id: Ib75e750ea15d59e51b2207669068fba7719a48b1 Pick-to: 6.6 Reviewed-by: Laszlo Agocs <[email protected]>
* Replace QDialog::exec() with open() in text edit exampleMikolaj Boc2023-06-202-91/+149
| | | | | | | | | | | | | | | | | | | | | | | | On WASM, the shortcut triggering the dialog in textedit example seemingly lets the event invoke the default action. What really happens is that the dialog's exec() does not return and WASM does not have a chance to set preventDefault() on the keyboard event it receives. This masks other problems with keyboards shortcuts. Uses of exec() on message boxes were replaced, too. Closing operation is now performed in two steps, first the event is ignored and maybeSave is called to query for potential changes of the text document. If there are no changes or the file is discarded, the close continues with a second event, now accepted. PrintDialog::exec(), QPrintPreviewDialog::exec(), QFileDialog::exec() were also eliminated in favor of open(). Finally, indirect calls to exec() via QColorDialog::getColor were removed. Task-number: QTBUG-76587 Change-Id: Ia90fad46ec3f94244723512be3ec93b64df9d9ef Reviewed-by: Mikołaj Boc <[email protected]>
* Add missing QApplication include in streambookmarks exampleTor Arne Vestbø2023-06-171-1/+1
| | | | | | | | Amends 3ccf2f8308ba33cab575c22ad2e246b987a3dc0c. Pick-to: 6.5 6.6 Change-Id: Ib51777ef9af44aff7fbb813b58eb0fbb74761373 Reviewed-by: Volker Hilsheimer <[email protected]>
* Examples: "About &Qt" should show info about Qt, not quitEdward Welbourne2023-06-163-3/+3
| | | | | | | | | | | A few examples seem to have copied and pasted a help action "About &Qt" that triggered QCoreApplication::quit. This does not look like best practice. Use QApplication::aboutQt instead. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I1887a3c999d752a24c7c4d3cabc4a5d63b29b966 Reviewed-by: Friedemann Kleint <[email protected]>
* Core examples: consistent #include orderEdward Welbourne2023-06-163-6/+6
| | | | | | | Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I014a895a8abeccc9d17b68fb67c00cea22957fed Reviewed-by: Friedemann Kleint <[email protected]>
* QMessageBox: Remove include of qdebug.hFriedemann Kleint2023-06-161-0/+1
| | | | | | | | | | | | | | | | | Move the implementation qRequireVersion() to prevent having to include qdebug.h which pulls in many other headers. Amends b5d874e36fd39fa6e57ff27db27ae0b029949749. Fix missing include introduced by 3a553507a134bee1562d34ebbf786a053d36fc05. Pick-to: 6.6 Task-number: QTBUG-114214 Task-number: QTBUG-97601 Change-Id: Iba68ffca95061666d9458ffa5700d07c7669da5b Reviewed-by: Axel Spoerl <[email protected]> Reviewed-by: Qt CI Bot <[email protected]>
* Doc: RSS listing example: Fix file quotingTopi Reinio2023-06-151-7/+7
| | | | | | | | | | | | The example was moved to qtnetwork but its documentation still referred to old paths under /examples/corelib. Add documentation dependency to qtwidgets as RSS listing example's docs link to a number of widget classes. Pick-to: 6.6 6.5 Change-Id: Ief1c9dc2ca38ba3da1fe3039500292147ec4cc7d Reviewed-by: Andreas Eliasson <[email protected]>
* Move RSS listing example to networkingEdward Welbourne2023-06-1411-15/+9
| | | | | | | | | | | It's really showing how to request a resource and act on its becoming available. The use of XML to do so is incidental; the use of networking is central. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Ibcf438c7ef3b2464ddfa8b96a79fb15523e4a468 Reviewed-by: Mårten Nordheim <[email protected]>
* Do XBEL example's last !QT_NO_... -> QT_CONFIG()Edward Welbourne2023-06-141-1/+1
| | | | | | | | | Amends commit 723e331f0a811294e43207db162698c3ff8fde51 Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Ib9a094ab432a80b8b2dbbbecb497dca13d23a553 Reviewed-by: Friedemann Kleint <[email protected]>
* Brush up the DOM bookmarks exampleFriedemann Kleint2023-06-134-54/+71
| | | | | | | | | | | | | | | | | | | - Use modern string literals (use QStringLiteral instead of QLatin1StringView for strings that go into the DOM API). - Use mime types in the file dialog handling - Streamline code - Remove mentions of SAX - Use per class includes - Do not use QObject::tr() - Use the configure system instead of QT_NO... defines - Fix some doc text typos Complements 3dd3268ded4dd74c64d7ec726fd534375ab9f018. Pick-to: 6.6 6.5 Task-number: QTBUG-111974 Change-Id: If0dc7b61e729d0a71f37743efc9b82e285d3f451 Reviewed-by: Edward Welbourne <[email protected]>
* XBEL stream reader: Brush upFriedemann Kleint2023-06-134-23/+37
| | | | | | | | | | | - Use mime types in the file dialog handling - Use per class includes - Use the configure system instead of QT_NO... defines Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Iea915604e89d3005270f0eb83eca882855589a44 Reviewed-by: Edward Welbourne <[email protected]>
* Move scroller/graphicsview example into tests/manualVolker Hilsheimer2023-06-127-304/+0
| | | | | | | | | | | The example seems incomplete, is undocumented (and unused in shippets, in spite of tags being present), and generally full of comments that give the impression that this is for manual testing rather than showing best practices. Pick-to: 6.5 6.6 Change-Id: Ie615420e493cc6bb461c5d9ff8d4ae82bb3591db Reviewed-by: Richard Moe Gustavsen <[email protected]>
* Move storageview example into tests/manualVolker Hilsheimer2023-06-127-294/+1
| | | | | | | | | The code is mostly an implementation of a model based on QStorageInfo, shown in an otherwise uninteresting tree view. Pick-to: 6.5 6.6 Change-Id: Id6ce70d71ddc9bcd6e82a9ee12f5e1af159eac7a Reviewed-by: Richard Moe Gustavsen <[email protected]>
* Remove flattreeview exampleVolker Hilsheimer2023-06-125-82/+0
| | | | | | | | The relevant bits are a two-line snippet. Pick-to: 6.6 6.5 Change-Id: Id1731e5bc6585b1d1fd684817b39d19ad0a8a9cc Reviewed-by: Richard Moe Gustavsen <[email protected]>
* XBEL examples: construct the text of the separators cleanlyEdward Welbourne2023-06-122-2/+6
| | | | | | | | | | | Create the fixed string once and reuse it. Also give a name to the escape code that's its repeated character. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I3d6416070f1d5490ec137e251daff0e1637fb788 Reviewed-by: Konrad Kujawa <[email protected]> Reviewed-by: Marc Mutz <[email protected]>
* XBEL stream reader: shuffle order of functionsEdward Welbourne2023-06-121-18/+18
| | | | | | | | | | | Put readBookmark() first of the constituent parts, as it's the most intelligible (albeit currently undocumented) and gives some clue to the purpose of readTitle(), which is next. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I91d3d6bf8adc3f3001c90274bb62a9da6bf05362 Reviewed-by: Ievgenii Meshcheriakov <[email protected]>
* Dialogs example: add checkbox for ColorDialogOption::NoEyeDropperButtonOliver Eftevaag2023-06-121-0/+1
| | | | | | | | | If we wish to introduce a new color dialog option, then we might as well use it in our example. Change-Id: I7771d9d50e2ab0489fbeece8dea38a0b72b9b21e Reviewed-by: Oliver Eftevaag <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* Doc: Fix documentation issuesTopi Reinio2023-06-093-1/+5
| | | | | | | | | | | | | | | | The Qt Widgets Application example was moved to manual tests, and no longer contains the snippet identifiers. Fix \snippet and \quotefile commands to quote similar code snippets from other examples or snippet files. Fix also the following documentation warnings: * No such parameter 'parsingMode' in QUrl::fromEncoded() * Missing image: rsslisting.cpp Pick-to: 6.6 6.5 Change-Id: Ibc989e83abc49837db08628facaf8e5f72b2f123 Reviewed-by: Tor Arne Vestbø <[email protected]>
* There is no frank.xbel so don't tell qmake to find itEdward Welbourne2023-06-092-2/+2
| | | | | | | | | | | | Both the DOM and XML stream versions of the XBEL bookmarks example had a frank.xbel in their EXAMPLE_FILES, but there is no such file. So asking qmake to include it is spurious. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Iec08042d181fc09c2c428685ce841a13161ab273 Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Alexandru Croitor <[email protected]>
* XBEL example - modernize strings: use "..."_L1 for literalsEdward Welbourne2023-06-093-35/+30
| | | | | | | | | | | | | The XML stream reader and writer accept QAnyStringView arguments these days, so passing a QLatin1StringView is entirely sufficient. This makes static functions to provide access to unique QString instances redundant. Linkers are allowed to uniquify the literals the "..."_L1 reference. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I7f37e97631e11683b9ddd3842fc6233547bed5ff Reviewed-by: Marc Mutz <[email protected]>
* XBEL example: minor simplificationsEdward Welbourne2023-06-092-13/+3
| | | | | | | | | | | | | Pass one function's return as a parameter to another directly. Use a ternary expression rather than conditional initialization. Use initializer-list construction instead of appending to an empty QStringList; and inline the result where it's used. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I781aedba8dcc4251193b55d82fe684c9b5da241a Reviewed-by: Juha Vuolle <[email protected]>
* XBEL example: Fix null dereference bugEdward Welbourne2023-06-091-1/+1
| | | | | | | | | | As readXBEL() does call readSeparator(nullptr), the latter should cope with being passed nullptr as item. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I786e4438b566438448b5d54ff6442c27f1255aa8 Reviewed-by: Ievgenii Meshcheriakov <[email protected]>
* XBEL example: use nullptr rather than 0 for null pointersEdward Welbourne2023-06-091-3/+3
| | | | | | | Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I7cb95ab6f84854d36a949d1ce667cb80a9c626be Reviewed-by: Friedemann Kleint <[email protected]>
* Examples: Remove unnecessary Q_INIT_RESOURCE callsKai Köhne2023-06-0843-85/+0
| | | | | | | | | | | Explicit calls to Q_INIT_RESOURCE are only needed for resources embedded in static libraries. See also https://doc.qt.io/qt-6/resources.html#explicit-loading-and-unloading-of-embedded-resources Pick-to: 6.5 6.6 Change-Id: I06a24d1c04369eedc78ca60a6ca02ce33907d9e7 Reviewed-by: Joerg Bornemann <[email protected]>
* Fix deprecation warnings agains u"..."_qs in dnslookup.cppEdward Welbourne2023-06-071-5/+5
| | | | | | Pick-to: 6.5 6.6 Change-Id: I29a177c7d46304c5b494218f5862195eb92c7684 Reviewed-by: Mårten Nordheim <[email protected]>
* Move widgets blurpicker example to manual testTor Arne Vestbø2023-06-0521-346/+0
| | | | | Change-Id: I7e19b84ac4b6a8e380fc9a7dcc37cc08ced89b4b Reviewed-by: Richard Moe Gustavsen <[email protected]>
* Move widgets Application example to manual testsAxel Spoerl2023-06-0416-907/+3
| | | | | | | | | | | | | With 6e77da640aa84c1efe330d4a5224c9c7425ece57, the documentviewer demo's TxtViewer plugin has been fully documented in order to replace the Application example. This patch moves the application example to manual tests. Pick-to: 6.5 Change-Id: I67d975e478c7bc840613c8af1301a4eafe8f1a42 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* Polish forward decl in vulkan and opengl examplesLaszlo Agocs2023-06-015-29/+17
| | | | | | | Pick-to: 6.5 Change-Id: I9f05aedc7649ab7e248b7332c04a6664e85182d8 Reviewed-by: Laszlo Agocs <[email protected]> Reviewed-by: Andy Nichols <[email protected]>
* Network chat: Update example meta infoMårten Nordheim2023-05-311-1/+3
| | | | | | | Task-number: QTBUG-108873 Change-Id: I46a412beb406cf66daf552adbef165dc246dadc2 Reviewed-by: Timur Pocheptsov <[email protected]> Reviewed-by: Konrad Kujawa <[email protected]>
* Network chat: style fixesMårten Nordheim2023-05-312-4/+2
| | | | | | | | | | | The if statements were originally broken to fit 80-column width but didn't have the braces we typically require. It anyway fits inside our new 100-column width, so just do that. Task-number: QTBUG-108873 Change-Id: Ib632f35607e6b716141c4c5d8211de7a0745c6ab Reviewed-by: Konrad Kujawa <[email protected]> Reviewed-by: Timur Pocheptsov <[email protected]>
* Network chat: simplify lookup functionMårten Nordheim2023-05-311-5/+1
| | | | | | | Task-number: QTBUG-108873 Change-Id: I3ca0c976236003c708130ed120dba14cfbbf8185 Reviewed-by: Konrad Kujawa <[email protected]> Reviewed-by: Timur Pocheptsov <[email protected]>
* Network chat: when removing an entry in multihash, specify which oneMårten Nordheim2023-05-311-1/+1
| | | | | | | | | | | | | | | | Using only the key means all clients with that IP address are removed. But there could be multiple clients running on the same multi-user system. So, use the value as well to remove just the specific one. This also fixes a bug where, when a client disconnects, all of the connections are removed from the client's map, but only _one_ is removed from the GUI. Task-number: QTBUG-108873 Change-Id: I87da862e8f337fd9c246ff5a2d243e514076fa5f Reviewed-by: Timur Pocheptsov <[email protected]> Reviewed-by: Konrad Kujawa <[email protected]>
* Network chat: avoid double lookups into hashMårten Nordheim2023-05-311-8/+11
| | | | | | | Task-number: QTBUG-108873 Change-Id: Iafa5a7a1ec99d2414f175f2d30fe03a90c6716f3 Reviewed-by: Konrad Kujawa <[email protected]> Reviewed-by: Timur Pocheptsov <[email protected]>
* Network chat: Use QStringBuilderMårten Nordheim2023-05-312-0/+5
| | | | | | | | | It is a best practice after all Task-number: QTBUG-108873 Change-Id: I11c23c080f6fe7f124e461affa88279d5def93f9 Reviewed-by: Konrad Kujawa <[email protected]> Reviewed-by: Timur Pocheptsov <[email protected]>
* Network chat: make ctors explicitMårten Nordheim2023-05-314-5/+5
| | | | | | | Task-number: QTBUG-108873 Change-Id: I08cd676aeb732d32b4d1e7d13a0aa1b37a46283f Reviewed-by: Konrad Kujawa <[email protected]> Reviewed-by: Timur Pocheptsov <[email protected]>
* Network chat: default-initialize or direct-initialize membersMårten Nordheim2023-05-315-19/+10
| | | | | | | | | Where possible Task-number: QTBUG-108873 Change-Id: I8125ffd63cd0ad1970575fb1a6b85021c03c38d5 Reviewed-by: Timur Pocheptsov <[email protected]> Reviewed-by: Konrad Kujawa <[email protected]>
* Network chat: update includesMårten Nordheim2023-05-317-14/+14
| | | | | | | | | Prefer own headers, avoid full-module includes Task-number: QTBUG-108873 Change-Id: I4282d4aab5fd66c64fc27cd130b223d33069d80f Reviewed-by: Konrad Kujawa <[email protected]> Reviewed-by: Timur Pocheptsov <[email protected]>
* Doc: Fix documentation warnings for Qt GuiTopi Reinio2023-05-301-2/+2
| | | | | | | | | | | | | | | | | | | * Fix file quoting in RHI Window example * Add missing \inmodule commands for QRhi Classes * Add missing dependency to qtshadertools * Remove documentation for non-existent overload of QRhiGraphicsPipeline::setTargetBlends() Other fixed warnings: src/gui/rhi/qrhi.cpp: * warning: clang couldn't find function when parsing \fn void setUsage(UsageFlags u) * warning: clang couldn't find function when parsing \fn virtual bool QRhiSwapChain::isFormatSuported(Format f) Change-Id: I73ff7896c3d5c8bb491368e941b32c8026a47191 Reviewed-by: Paul Wicking <[email protected]>
* Diagram Scene: Fix documentation word repetitonAndre Hartmann2023-05-291-1/+1
| | | | | | | Pick-to: 6.5 Fixes: QTCREATORBUG-29214 Change-Id: I356a6ffbd48bf918208180b8b403b5c74ad368d5 Reviewed-by: Paul Wicking <[email protected]>
* Examples: Do not add the same category twiceEike Ziller2023-05-261-1/+0
| | | | | | | | | Amends 1371cd107a2dab2a29e3e10e9bb823a9ff04a3a9 Task-number: QTCREATORBUG-29197 Change-Id: I0dd4a08a597c237fd09f788cafb79af755953d0d Reviewed-by: Edward Welbourne <[email protected]> Reviewed-by: Jani Heikkinen <[email protected]>
* Document the RSS Listing exampleEdward Welbourne2023-05-255-98/+170
| | | | | | | | | | | | | | Add an image and a QDoc file, remove the (in some cases misleading) doc comments from the CPP sources, group the slots all together in the source so as to document them together, group the two private methods together. Dust the header lightly with comments to classify the class members and enclose relevant parts in QDoc snippet markers. Task-number: QTBUG-111228 Pick-to: 6.5 Change-Id: I0090fb45ce8d5a8f168fde9b3247d541b709c1b2 Reviewed-by: Andreas Eliasson <[email protected]> Reviewed-by: Ivan Solovev <[email protected]>
* rsslisting example: use initializer list to construct string listEdward Welbourne2023-05-251-3/+1
| | | | | | | | | | It's cleaner than declaring, using << to populate, then using once. Just construct it and use it where it's needed. Task-number: QTBUG-111228 Pick-to: 6.5 Change-Id: Id10483b26937a97899d656c4b26f27b37b8d39b6 Reviewed-by: Juha Vuolle <[email protected]>
* rsslisting example: rename a slot to reflect what it doesEdward Welbourne2023-05-252-3/+3
| | | | | | | | | | | | | Many slots can be connected to one signal so, unlike a virtual method that must be named for the situation in which it is called, a slot can (so should) be named for what it does, rather than naming it to match the signal it's connected to. Task-number: QTBUG-111228 Pick-to: 6.5 Change-Id: If2fa40cac0e51a243054526d7d2997fdd54aea3e Reviewed-by: Mårten Nordheim <[email protected]> Reviewed-by: Ievgenii Meshcheriakov <[email protected]>
* RSSListing: remove metaDataChanged slot to handle redirectsEdward Welbourne2023-05-252-10/+0
| | | | | | | | | | | QNetworkAccessManager takes care of doing that by default anyway, these days. Task-number: QTBUG-111228 Pick-to: 6.5 Change-Id: I890d258599e22efb6fc6ce0140304a97edcbb3f8 Reviewed-by: Mårten Nordheim <[email protected]> Reviewed-by: Øystein Heskestad <[email protected]>
* Turn itemActivated() slot of RSS listing example into a lambdaEdward Welbourne2023-05-252-10/+2
| | | | | | | | | | | | It needs nothing but the parameter it is passed and has no material interaction with the rest of the RSSListing class, so there's no point devoting a slot to it, much less a public one. Task-number: QTBUG-111228 Pick-to: 6.5 Change-Id: I46d572982197550801c6fa4425453fc670c6f2f1 Reviewed-by: Marc Mutz <[email protected]> Reviewed-by: Mårten Nordheim <[email protected]>
* Update Cached Table example meta-dataVolker Hilsheimer2023-05-241-1/+2
| | | | | | | | | | | | | | Drop "Example" from the example's title, add SQL instead, and add it to the Input/Output category of examples. It's a documented example, does something meaningful, and looks reasonable. Having one SQL example categorised so that it's easy to see that Qt includes that functionality seems like a good idea. The other examples are mostly small API examples that are still good to have as fully-functional apps rather than just snippets. Pick-to: 6.5 Change-Id: Ib960f38db39c791f7ff5a2b9bf3157ee32b362ec Reviewed-by: Andreas Eliasson <[email protected]>
* Move qopenglwidget example to manual testsLaszlo Agocs2023-05-2413-1108/+0
| | | | | | Pick-to: 6.5 Change-Id: I76e6377008484a7b17c65e3c03139a0fb2fc5c34 Reviewed-by: Laszlo Agocs <[email protected]>
* Doc: fix links to examplesVolker Hilsheimer2023-05-241-2/+2
| | | | | | | | | Remove the xml prefix, only reference the example by title. The streambookmarks example is gone, so remove that link. Change-Id: Ie3a77be24f60fca9e8f9ef0323f0ea5ffc904075 Reviewed-by: Safiyyah Moosa <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>
* rhi: Make it a QPA-style private but semi-public APILaszlo Agocs2023-05-2119-1/+1188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qrhi.h, qshader.h, qshaderdescription.h (and qshaderbaker.h from shadertools; done separately) become "RHI APIs", following the concept of QPA APIs. Mirror completely what is done for QPA headers, but using the "rhi" prefix for the headers. This involves updating syncqt to handle the new category of headers. (a note on the regex: matching everything starting with "qrhi" is not acceptable due to incorrectly matching existing and future headers, hence specifying the four header names explicitly) There is going to be one difference to QPA: the documentation for everything RHI is going to be public and part of the regular docs, not hidden with \internal. In addition to the header renaming and adding the comments and documentation notes and warnings, there is one significant change here: there is no longer a need to do API-specific includes, such as qrhid3d11[_p].h, qrhivulkan[_p].h, etc. These are simply merged into a single header that is then included from qrhi.h. This means that users within Qt, and any future applications can just do #include <rhi/qrhi.h> (or rhi/qshader.h if the QRhi stuff is not relevant), no other headers are needed. There are no changes to functionality in this patch. Only the documentation is expanded, quite a lot, to eliminate all qdoc warnings and make the generated API docs complete. An example, with a quite extensive doc page is added as well. Task-number: QTBUG-113331 Change-Id: I91c749826348f14320cb335b1c83e9d1ea2b1d8b Reviewed-by: Volker Hilsheimer <[email protected]> Reviewed-by: Qt CI Bot <[email protected]>
* 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 <[email protected]>