Commit Graph

2088 Commits

Author SHA1 Message Date
Topi Reinio
ebc371de0d Doc: RSS listing example: Fix file quoting
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 <andreas.eliasson@qt.io>
2023-06-15 11:34:17 +00:00
Edward Welbourne
e54a7c5667 Move RSS listing example to networking
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 <marten.nordheim@qt.io>
2023-06-14 11:57:31 +02:00
Edward Welbourne
4b6986db32 Do XBEL example's last !QT_NO_... -> QT_CONFIG()
Amends commit 723e331f0a

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ib9a094ab432a80b8b2dbbbecb497dca13d23a553
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-06-14 11:57:13 +02:00
Friedemann Kleint
3a553507a1 Brush up the DOM bookmarks example
- 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 3dd3268ded.

Pick-to: 6.6 6.5
Task-number: QTBUG-111974
Change-Id: If0dc7b61e729d0a71f37743efc9b82e285d3f451
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-06-13 01:51:10 +02:00
Friedemann Kleint
723e331f0a XBEL stream reader: Brush up
- 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 <edward.welbourne@qt.io>
2023-06-13 01:51:10 +02:00
Volker Hilsheimer
b908c5cf28 Move scroller/graphicsview example into tests/manual
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 <richard.gustavsen@qt.io>
2023-06-12 21:22:36 +02:00
Volker Hilsheimer
a89f575be3 Move storageview example into tests/manual
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 <richard.gustavsen@qt.io>
2023-06-12 21:22:36 +02:00
Volker Hilsheimer
ce13dc8c2f Remove flattreeview example
The relevant bits are a two-line snippet.

Pick-to: 6.6 6.5
Change-Id: Id1731e5bc6585b1d1fd684817b39d19ad0a8a9cc
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-12 21:22:36 +02:00
Edward Welbourne
97f68cd306 XBEL examples: construct the text of the separators cleanly
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 <konrad.kujawa@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-06-12 15:46:14 +02:00
Edward Welbourne
b610c7aa89 XBEL stream reader: shuffle order of functions
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 <ievgenii.meshcheriakov@qt.io>
2023-06-12 15:46:14 +02:00
Oliver Eftevaag
fc9aae544b Dialogs example: add checkbox for ColorDialogOption::NoEyeDropperButton
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 <oliver.eftevaag@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-12 15:11:26 +02:00
Topi Reinio
17ddf2a6a5 Doc: Fix documentation issues
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ø <tor.arne.vestbo@qt.io>
2023-06-09 18:24:15 +00:00
Edward Welbourne
8e1b60b331 There is no frank.xbel so don't tell qmake to find it
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 <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-09 14:05:06 +02:00
Edward Welbourne
202b1dca5d XBEL example - modernize strings: use "..."_L1 for literals
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 <marc.mutz@qt.io>
2023-06-09 14:05:06 +02:00
Edward Welbourne
5fd4a65d95 XBEL example: minor simplifications
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 <juha.vuolle@qt.io>
2023-06-09 14:05:06 +02:00
Edward Welbourne
705e4e63c6 XBEL example: Fix null dereference bug
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 <ievgenii.meshcheriakov@qt.io>
2023-06-09 14:05:06 +02:00
Edward Welbourne
4d8dddd699 XBEL example: use nullptr rather than 0 for null pointers
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I7cb95ab6f84854d36a949d1ce667cb80a9c626be
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-06-09 14:05:06 +02:00
Kai Köhne
eed17b3634 Examples: Remove unnecessary Q_INIT_RESOURCE calls
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 <joerg.bornemann@qt.io>
2023-06-08 16:15:02 +00:00
Edward Welbourne
3ab7b7e230 Fix deprecation warnings agains u"..."_qs in dnslookup.cpp
Pick-to: 6.5 6.6
Change-Id: I29a177c7d46304c5b494218f5862195eb92c7684
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-06-07 10:26:04 +02:00
Tor Arne Vestbø
a3dde7c93e Move widgets blurpicker example to manual test
Change-Id: I7e19b84ac4b6a8e380fc9a7dcc37cc08ced89b4b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-05 19:13:33 +02:00
Axel Spoerl
eda71105ff Move widgets Application example to manual tests
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 <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-04 01:18:19 +02:00
Laszlo Agocs
da4de6b6e3 Polish forward decl in vulkan and opengl examples
Pick-to: 6.5
Change-Id: I9f05aedc7649ab7e248b7332c04a6664e85182d8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-06-01 09:09:49 +02:00
Mårten Nordheim
0925a98ec3 Network chat: Update example meta info
Task-number: QTBUG-108873
Change-Id: I46a412beb406cf66daf552adbef165dc246dadc2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-05-31 12:56:01 +02:00
Mårten Nordheim
f3d2e2f555 Network chat: style fixes
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 <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-31 12:56:00 +02:00
Mårten Nordheim
e33bbdb0ea Network chat: simplify lookup function
Task-number: QTBUG-108873
Change-Id: I3ca0c976236003c708130ed120dba14cfbbf8185
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-31 12:55:59 +02:00
Mårten Nordheim
804b26b77d Network chat: when removing an entry in multihash, specify which one
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 <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-05-31 12:55:58 +02:00
Mårten Nordheim
6eac22e2ca Network chat: avoid double lookups into hash
Task-number: QTBUG-108873
Change-Id: Iafa5a7a1ec99d2414f175f2d30fe03a90c6716f3
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-31 12:55:57 +02:00
Mårten Nordheim
9db22a63a9 Network chat: Use QStringBuilder
It is a best practice after all

Task-number: QTBUG-108873
Change-Id: I11c23c080f6fe7f124e461affa88279d5def93f9
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-31 12:55:56 +02:00
Mårten Nordheim
61afc6d109 Network chat: make ctors explicit
Task-number: QTBUG-108873
Change-Id: I08cd676aeb732d32b4d1e7d13a0aa1b37a46283f
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-31 12:55:55 +02:00
Mårten Nordheim
3ece5e30b7 Network chat: default-initialize or direct-initialize members
Where possible

Task-number: QTBUG-108873
Change-Id: I8125ffd63cd0ad1970575fb1a6b85021c03c38d5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-05-31 12:55:54 +02:00
Mårten Nordheim
c437c33f29 Network chat: update includes
Prefer own headers, avoid full-module includes

Task-number: QTBUG-108873
Change-Id: I4282d4aab5fd66c64fc27cd130b223d33069d80f
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-31 12:55:54 +02:00
Topi Reinio
1cd35cff4d Doc: Fix documentation warnings for Qt Gui
* 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 <paul.wicking@qt.io>
2023-05-30 08:29:26 +00:00
Andre Hartmann
2a90efcfc2 Diagram Scene: Fix documentation word repetiton
Pick-to: 6.5
Fixes: QTCREATORBUG-29214
Change-Id: I356a6ffbd48bf918208180b8b403b5c74ad368d5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-05-29 19:51:21 +02:00
Eike Ziller
47db21965d Examples: Do not add the same category twice
Amends 1371cd107a

Task-number: QTCREATORBUG-29197
Change-Id: I0dd4a08a597c237fd09f788cafb79af755953d0d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2023-05-26 17:44:54 +02:00
Edward Welbourne
f2ab85429d Document the RSS Listing example
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 <andreas.eliasson@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-05-25 17:40:38 +02:00
Edward Welbourne
2e09d03cd1 rsslisting example: use initializer list to construct string list
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 <juha.vuolle@qt.io>
2023-05-25 17:40:37 +02:00
Edward Welbourne
3c78f1e96e rsslisting example: rename a slot to reflect what it does
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 <marten.nordheim@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-05-25 17:40:36 +02:00
Edward Welbourne
fe2af0f8a3 RSSListing: remove metaDataChanged slot to handle redirects
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 <marten.nordheim@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
2023-05-25 17:40:35 +02:00
Edward Welbourne
e7b1bc6590 Turn itemActivated() slot of RSS listing example into a lambda
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 <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-25 17:40:35 +02:00
Volker Hilsheimer
8fa28b0cff Update Cached Table example meta-data
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 <andreas.eliasson@qt.io>
2023-05-24 17:29:20 +02:00
Laszlo Agocs
413e74e9a5 Move qopenglwidget example to manual tests
Pick-to: 6.5
Change-Id: I76e6377008484a7b17c65e3c03139a0fb2fc5c34
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-05-24 12:58:27 +02:00
Volker Hilsheimer
db2f4d5e46 Doc: fix links to examples
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 <safiyyah.moosa@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-05-24 07:04:31 +02:00
Laszlo Agocs
1dd8b5ceec rhi: Make it a QPA-style private but semi-public API
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 <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-21 15:42:58 +02:00
Tor Arne Vestbø
fda4da6df9 shortcuteditor example: Don't reference null-action
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>
2023-05-17 00:25:40 +02:00
Edward Welbourne
d75e772e22 RSS listing example: prefer setDevice() over addData(readAll())
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>
2023-05-16 20:09:38 +02:00
Volker Hilsheimer
b7c15f7f24 Remove the "classwizard" example
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>
2023-05-16 18:33:18 +02:00
Volker Hilsheimer
11da92ba94 Convert "extension" dialog example into snippets
Pick-to: 6.5
Task-number: QTBUG-108751
Change-Id: I8ca4e058b832674dc0c8b84024cb70a667ee8db4
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-05-16 18:33:18 +02:00
Volker Hilsheimer
8e94af2ed0 Revamp the shapedclock example
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>
2023-05-16 13:37:38 +02:00
Volker Hilsheimer
c6540cb6e4 Doc cleanup: remove old gettingStarted tutorial, move doc file
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>
2023-05-15 23:54:01 +02:00
Volker Hilsheimer
328680b34b Update screenshot example
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>
2023-05-15 18:20:21 +02:00
Edward Welbourne
30b9c3a135 Shrink the CBOR dumper example's image
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>
2023-05-15 15:51:01 +02:00
Volker Hilsheimer
f4b338833e Move the addressbook tutorial into manual tests
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>
2023-05-15 14:52:17 +02:00
Edward Welbourne
637e1542cf rsslisting example: fix bug in construction of title string
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>
2023-05-15 14:02:46 +02:00
Edward Welbourne
fb2d4074c1 rsslisting example: shuffle parts of constructor for clarity
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>
2023-05-15 14:02:46 +02:00
Edward Welbourne
233ca06500 rsslisting example: move default URL to main()
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>
2023-05-15 14:02:45 +02:00
Edward Welbourne
3cdc65c2ec rsslisting example: Tidy up #include usage
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>
2023-05-15 14:02:45 +02:00
Edward Welbourne
00ccc56434 rsslisting example (coding style): split a long line, purge stray braces
Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: Ic919d4dee74823f11c55d286beba447d45111754
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-05-15 14:02:45 +02:00
Edward Welbourne
f8ad9cd23c rsslisting example (coding style): fix horizontal spacing
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>
2023-05-15 14:02:44 +02:00
Edward Welbourne
d52cc4725f rsslisting example: remove unused include and surplus blank lines
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>
2023-05-15 14:02:44 +02:00
Edward Welbourne
56df9e5603 savegame example: clarify that CBOR can be read
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>
2023-05-15 14:02:42 +02:00
Edward Welbourne
1371cd107a Add metadata to serialization examples
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>
2023-05-15 14:02:42 +02:00
Nicholas Bennett
dbfc472225 Docs: Update OpenGl example docs
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>
2023-05-09 22:02:25 +00:00
Edward Welbourne
b1d59d6dd9 rsslisting example: don't leak the RSSListing object
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>
2023-05-09 23:39:41 +02:00
Edward Welbourne
179b61c85f Update cbordump image to a higher-resolution one
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>
2023-05-09 23:39:41 +02:00
Kai Köhne
0de3a17394 Doc: Add XML, Json, CBOR examples to IO category
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>
2023-05-09 20:30:28 +00:00
Marc Mutz
6f1e53943d savegame ex.: revamp the way print() works
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>
2023-05-09 08:21:10 +02:00
Øystein Heskestad
3dd3268ded Revamp DOM Bookmarks example
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>
2023-05-04 17:30:04 +00:00
Edward Welbourne
5a3784bba3 Flip string comparisons in savegame example
This follows up to commit 9834e80833,
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>
2023-05-04 15:05:16 +02:00
Marc Mutz
5a3ac484db savegame ex.: revamp the way we (de)serialize JSON
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>
2023-05-03 21:36:14 +02:00
Edward Welbourne
55fe3ee5e7 Replace runic XSLT with a python script and tidy cbordump code
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>
2023-05-02 17:03:26 +02:00
Kai Köhne
9f9ff18ba9 Examples: Use versioned CMake targets for Qt modules
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>
2023-05-02 16:20:08 +02:00
Topi Reinio
38bb088a26 Doc: Add 'Mobile' category to Qt Android Notifier example
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>
2023-05-02 12:54:19 +00:00
Ivan Solovev
5ddb5d1fee Rework imagescaling example to avoid potential crashes
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>
2023-04-26 19:27:30 +02:00
Bartlomiej Moskal
c27d5eca6a Android-example: add missing properties in AndroidManifest.xml
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:
56dee3de5e 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>
2023-04-26 13:47:43 +00:00
Laszlo Agocs
5ebb9a8bf3 Tune textures example to work with wasm and update docs
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>
2023-04-25 18:10:44 +02:00
Laszlo Agocs
25fcded977 cube example: always set required state in paintGL
...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>
2023-04-20 14:01:22 +02:00
Edward Welbourne
bcab157f75 Update table of CBOR tag descriptions in cbordump example
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>
2023-04-19 17:40:36 +02:00
Edward Welbourne
762bf783dd Remove excess namespaces from XSLT
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>
2023-04-19 17:40:36 +02:00
Laszlo Agocs
051ba40997 cube example: Switch to a power-of-two texture
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>
2023-04-19 08:51:18 +02:00
Laszlo Agocs
99c8eca3f4 cube example: make sure the program is bound
...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>
2023-04-18 13:23:48 +02:00
Mårten Nordheim
1a55c8d887 Torrent example: update usage of integer types
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>
2023-04-11 18:25:42 +01:00
Topi Reinio
45ca5c8585 Doc: Use the \examplecategory macro to tag examples
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>
2023-04-11 17:25:42 +00:00
Volker Hilsheimer
70f9158e0f Docs: don't link to removed example
Pick-to: 6.5
Change-Id: I5fcec02cd18971150eec4f119d902c695bf2ebb9
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
2023-04-11 14:37:36 +02:00
Marc Mutz
9834e80833 savegame ex.: give some TLC to main()
- 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>
2023-04-11 12:37:36 +00:00
Amir Masoud Abdol
9db9a836fb Remove unused variable/code
Pick-to: 6.5
Change-Id: I8d28db64c1ae2c57c95b2f9f22303d74172226e9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-04-07 11:12:34 +02:00
Axel Spoerl
947f4df49c Fix CMakeLists.txt of echo plugin example
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>
2023-04-06 19:36:48 +02:00
Øystein Heskestad
29317b426b Move streambookmarks example into corelibe/serialization
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>
2023-03-31 13:26:42 +02:00
Ievgenii Meshcheriakov
7b9e7f8002 complexpingpong example: Modernize the code
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>
2023-03-28 19:42:01 +02:00
Axel Spoerl
585bfe600a Fix pointer mismatch after QList::move() in tooltip example
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>
2023-03-28 08:59:53 +00:00
Joerg Bornemann
454b1de22c CMake: build the shared plugin when building the plugandpaint target
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>
2023-03-28 10:45:55 +02:00
Ievgenii Meshcheriakov
8faf2511da dbus examples: Remove "Example" from example names
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>
2023-03-24 19:29:11 +01:00
Ievgenii Meshcheriakov
f7167ae82f remotecontrolledcar example: Modernize the code
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>
2023-03-23 20:14:46 +01:00
Tor Arne Vestbø
080b11b039 mainwindow example: Fix implicit conversion from qsizetype warnings
Pick-to: 6.5
Change-Id: Ifaeeb620420f43529bb9e3d533b4e1a2e20c68ca
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-23 16:39:19 +01:00
Mårten Nordheim
826b606a5d Remove loopback network example
It doesn't showcase anything interesting that other examples
don't already show off.

Pick-to: 6.5
Change-Id: Ie95c3ddb3ff52b3beab54bd6fa75fb75ae5c7ba5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-03-23 16:02:28 +01:00
Mårten Nordheim
58dfb10781 Clean up multicast examples
They're small, not much to polish.

Pick-to: 6.5
Change-Id: Iada573504de557ab18381370bb9760b1f60cc2e4
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-03-23 16:02:28 +01:00
Laszlo Agocs
7c23aa6bc5 Move hellogles3 docs to where the rest of these files live
And expand the note in the openglwindow example to point to
hellogles3 as well.

Pick-to: 6.5
Change-Id: I2c0ee9b83fa59752d937c57eaf0194f0d0a8a7d9
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-03-23 15:13:03 +01:00
Laszlo Agocs
d0dc0477b9 Remove erroneous widget dependency for hellogles3
Pick-to: 6.5
Change-Id: I42b476be28acd5b5c68f115bd98cf5c43cd8d97b
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-03-23 15:13:03 +01:00
Laszlo Agocs
9daf2744b2 Change paintedwindow example to be a manual test
Pick-to: 6.5
Change-Id: I25a0f491f824c43fc75ba6358518133ede09adcd
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-03-23 15:13:02 +01:00
Laszlo Agocs
3b015718b0 Move hellowindow and qopenglwindow to be a manual tests
Pick-to: 6.5
Change-Id: I8d1517ee57df9b2dee0486f47562b0754e9dcbad
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-03-23 15:13:02 +01:00
Laszlo Agocs
5a36f4cd9c Change computegles31 example to a manual test
Pick-to: 6.5
Change-Id: I652daf3ccbb921c5eb73b48586ee9616c7704b97
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-03-22 23:18:04 +01:00
Laszlo Agocs
0e8d347c6a Remove hellovulkanwindow example
The idea being that hellovulkantriangle demonstrates the same things.
As a getting started tutorial hellovulkanwindow is the ideal example,
but then again QVulkanWindow is not something we want to promote much
in Qt 6.

Some of the docs are moved to hellovulkantriangle.

Pick-to: 6.5
Change-Id: Icbfff70b4a4c7e4c0863a937f3c16038c0b03fbe
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-03-22 23:17:55 +01:00
Laszlo Agocs
b5b954fac1 Move hellovulkantexture example to manual test
Because it is the least documented one, and compared to the other
Vulkan examples it does not add anything new, it just dives deeper
into Vulkan.

Pick-to: 6.5
Change-Id: Iecf3e04625fba256ea8134da57f54498ee2010db
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-03-22 23:17:48 +01:00
Øystein Heskestad
10b4c06b49 Move rsslisting example into corelibe/serialization
The implementation of the stream-based XML parser resides in
coreslib/serialization. Moving the rsslisting example there.

Task-number: QTBUG-110647
Pick-to: 6.5
Change-Id: I862909e767301250750b6ee0d8ac7e20d6bad2b1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-03-21 14:49:09 +01:00
Øystein Heskestad
3c521e1fb4 Remove libQt6Xml dependency in rsslisting example
This example does not use libQt6Xml, remove dependency.

Task-number: QTBUG-110647
Pick-to: 6.5 6.2
Change-Id: Ida8c4df0e274cbc2e0a5f7151f18693d7e1c2401
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-03-21 14:49:09 +01:00
Øystein Heskestad
7185c8e0a4 Remove libQt6Xml dependency in streambookmarks example
This example does not use libQt6Xml, remove dependency.

Task-number: QTBUG-110647
Pick-to: 6.5 6.2
Change-Id: I40e5976121ddc97a78b540d17784b3357b87adf7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-03-21 14:49:08 +01:00
Joerg Bornemann
29bc561de5 Doc: Fix wording in the Simple Style Plugin documentation
When talking about QMake project files we now refer to ".pro files"
instead of "profiles".

Pick-to: 6.5
Change-Id: Ia8d20a6a03b9076e97f45da272bb3f883febc796
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-21 14:49:08 +01:00
Dennis Oberst
8352756d27 Example: rename progressdialog to primecounter and modernize it
The previous example finished way too quickly and provided no real
value in regards to API understanding. Previously, QtConcurrent::map
was used, which was also used in other examples. We are now using
QtConcurrent::filterReduce to demonstrate other functionality.

Task-number: QTBUG-111165
Pick-to: 6.5 6.5.0
Change-Id: Ibd6eb119d0711cddfe8b211d460e9d67d6ce95c3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-03-21 11:19:42 +01:00
Dennis Oberst
d795dfaee7 Example: update wordcount example
Added a QFileDialog to let the user select a path. Before, the path
was statically assigned with "../../" , which is not optimal.
I also modified the findFiles function to check for text files in
general and not only *.cpp and *.h files. Lastly the result of the
word counting is now displayed on the console, as I think this is an
informative output from this example.

Task-number: QTBUG-111165
Pick-to: 6.5 6.5.0
Change-Id: Ie27c6acb4f79a78e3bef141edb92de08901fde71
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-20 20:58:08 +01:00
Edward Welbourne
5c2245cd66 Rework documentation of cbordump example
Focus the phrasing on what it teaches - how to use the stream reader -
more than the example application of that, displaying it.
Update docs:
* Changed name to conform to modern guidelines.
* Consistently mark \c cbodrump as code.
* Fix mentions of CborDumper and CborTagDescription to match code.
* Say how the tagDescriptions table is used.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: Ic12e77cf34caadc9f60527e886f94c76cb8cfeaf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-20 19:18:53 +01:00
Edward Welbourne
074d3d54d8 Use local names to make some numeric_limits references more readable
Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I220f5c2f13c8f01278be806c8e8d6a3a1be8e986
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-20 19:18:53 +01:00
Ievgenii Meshcheriakov
2834d4263a remotecontrolledcar example: Move car.xml to common directory
It is shared between car and controller executables.

Task-number: QTBUG-111366
Pick-to: 6.5
Change-Id: I5f98a09664671c55bfad68ebf88c9f0c734511fa
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-20 17:15:00 +01:00
Ievgenii Meshcheriakov
5cd7900d4f remotecontrolledcar example: Move executables into single example project
This allows building of all the example executables at once.

Task-number: QTBUG-111366
Pick-to: 6.5
Change-Id: I1fa372ec9725bfeb1f123305aa7324b7820eb593
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-20 17:14:59 +01:00
Ievgenii Meshcheriakov
20668baa59 dbus examples: Update screenshots
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>
2023-03-14 19:46:08 +01:00
Ivan Solovev
0ac234f9e2 Imagescaling example: fix memory leaks
* 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>
2023-03-13 19:24:14 +01:00
Andreas Eliasson
9f93f96394 Doc: Remove broken link to Anchor Layout Example
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>
2023-03-13 08:12:01 +00:00
James DeLisle
ed6a3ce0af Update the bindable properties example
- 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>
2023-03-09 12:27:00 -05:00
Dennis Oberst
de5e0422ca Example: remove runfunction example
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>
2023-03-09 17:26:59 +00:00
Dennis Oberst
fbb470b40b Example: remove map example
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>
2023-03-09 17:26:59 +00:00
Dennis Oberst
b5e9d41895 Example: update imagescaling example
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>
2023-03-09 17:26:59 +00:00
Ievgenii Meshcheriakov
eea83bac26 dbus examples: Remove listnames example
Task-number: QTBUG-111366
Pick-to: 6.5
Change-Id: I5c483cbfec4072dae610c6d98b97d10057ba9ddc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-03 12:46:29 +01:00
Mårten Nordheim
bdcb0a32fa HTTP example: update screenshot
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>
2023-03-02 18:39:09 +01:00
Jan Arve Sæther
5773c3ac28 Move anchor layout example to manual tests
Pick-to: 6.5 6.5.0
Change-Id: I9c9a9dbcdaf705a31208b80b71e978938a492142
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-03-02 17:24:53 +00:00
Øystein Heskestad
e13b57d06a Move xmlstreamlint example into tests/manual
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>
2023-03-02 12:20:18 +01:00
Øystein Heskestad
56b3123689 Remove htmlinfo example
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>
2023-03-02 12:20:17 +01:00
Volker Hilsheimer
3c104c2799 Remove the 'sdi' example
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>
2023-03-02 12:08:11 +01:00
Mårten Nordheim
277d809ba4 DNS Lookup: Use ideomatic cstdio include
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>
2023-03-02 12:08:10 +01:00
Mårten Nordheim
af95f97466 DNS Lookup: Change local function to return struct instead of enum
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>
2023-03-02 12:08:10 +01:00
Mårten Nordheim
83dac21813 DNS Lookup: Use standard functions to print version/help
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>
2023-03-02 12:08:10 +01:00
Mårten Nordheim
a6dc860915 DNS Lookup: reflow some code to avoid exceeding column limit
Task-number: QTBUG-108873
Pick-to: 6.5
Change-Id: Ic17ded256152f7d89bd200ea0e163f2b8f1ea70a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-03-02 12:08:10 +01:00
Mårten Nordheim
b300c6b777 DNS Lookup: Use std::optional instead of casting enum to int
Task-number: QTBUG-108873
Pick-to: 6.5
Change-Id: I0bd5dc004154c1c4026be2feb6187c53e5e77801
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-03-02 12:08:10 +01:00
Mårten Nordheim
5e16397a2c DNS Lookup: Avoid unneeded allocations in parsing function
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>
2023-03-02 12:08:09 +01:00
Mårten Nordheim
eb61d49ab3 Delete the Network Download (Manager)? examples
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>
2023-03-02 12:08:09 +01:00
Jan Arve Sæther
a84b2e5973 Move Weather Anchor Layout example to manual tests
Pick-to: 6.5
Change-Id: I8782a83b5c12b4f57bf9ef9063818cb124bddd56
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-03-02 05:55:57 +01:00
Volker Hilsheimer
721b4a4b5a Doc: move snippet for implicit translation context
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>
2023-03-01 22:22:26 +01:00
Volker Hilsheimer
a02fb41c8e Doc: fix links to renamed network examples
Pick-to: 6.5
Change-Id: I8790bb660070a092e268294b5640c6d5af41deb0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-01 19:14:39 +01:00
Ievgenii Meshcheriakov
f952e74cfe pingpong example: Remove pong.h
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>
2023-02-28 18:15:24 +01:00
Ievgenii Meshcheriakov
07b8a5a409 pingpong example: Modernize the code
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>
2023-02-28 18:15:24 +01:00
Andreas Eliasson
8ecd81ae86 Doc: Remove duplicate words
Change-Id: Ia7a38a1035bd34d00f20351a0adc3927e473b2e7
Pick-to: 6.5 6.4 6.2
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-02-28 16:53:10 +00:00
Mårten Nordheim
97dcf1ba18 Fortune* Example: update screenshots
Fixes: QTBUG-108875
Pick-to: 6.5
Change-Id: Ib57482959973815681b0b178acea3634a4f63220
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-02-28 16:33:05 +01:00
Laszlo Agocs
6462a454e3 Remove threadeqopenglwidget example
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>
2023-02-28 14:28:51 +01:00
Ievgenii Meshcheriakov
742e79312f chat example: Update code style
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>
2023-02-27 15:55:07 +01:00
Ievgenii Meshcheriakov
57d25b3a53 chat example: Remove empty destructor
Task-number: QTBUG-111366
Pick-to: 6.5
Change-Id: I880c16638c992a4ee8528b1c545e6f563a7efa8b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-02-27 15:55:07 +01:00
Ievgenii Meshcheriakov
fd03a04457 chat example: Remove commented-out code
Task-number: QTBUG-111366
Pick-to: 6.5
Change-Id: Ib8e89427357f604ab30cb0de50eb373cffb945fa
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-02-27 15:55:07 +01:00
Ievgenii Meshcheriakov
8b48657590 chat example: Use QInputDialog to get a user nickname
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>
2023-02-27 15:55:07 +01:00
Samuel Gaist
283cdb0e70 examples: port widget examples to new connection style
Task-number: QTBUG-106893
Change-Id: Ib10fd516fdbeda0087b1c8550ce340acd3973e6b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-02-25 22:11:57 +01:00
Yuhang Zhao
f7fd5eaf95 Fix qtbase build when all deprecated code are disabled
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>
2023-02-22 22:27:35 +08:00
Mårten Nordheim
32098963f2 Torrent example: Fix use-after-free crash
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>
2023-02-21 13:04:44 +01:00
Mårten Nordheim
f3de92cdad Torrent example: Fix some stack overflow issues
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 69c31f6f68

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>
2023-02-21 13:04:44 +01:00
Mårten Nordheim
d3c1445419 Torrent: simplify QBitArray usage
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>
2023-02-21 13:04:44 +01:00
Tor Arne Vestbø
850ef55fc5 examples: Connect Quit action to QCoreApplication::quit, not QWidget::close
Pick-to: 6.5
Change-Id: I44ca7b61a4a261a7d3aad0dfeb870eb927ee768d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-20 15:18:18 +01:00
Tor Arne Vestbø
f99df42646 mainwindow example: Don't assume toolbar parent is main window
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>
2023-02-20 10:33:10 +01:00
Mårten Nordheim
22fc1d08bb Torrent example: delete unimplemented functions
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>
2023-02-14 18:49:46 +01:00
Mårten Nordheim
3fc26dbb2c Torrent example: Convert some timeouts from int to chrono
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>
2023-02-14 18:49:45 +01:00
Mårten Nordheim
69c31f6f68 Torrent example: Remove manual little-big endian conversion
... 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>
2023-02-14 18:49:45 +01:00
Mårten Nordheim
2145341071 Delete googlesuggest
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>
2023-02-14 17:48:09 +01:00
Volker Hilsheimer
48a1a5564f Examples: move widgets/codeeditor into manual tests
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>
2023-02-09 00:23:34 +01:00
Volker Hilsheimer
3fe0bf6e1b Move findfiles example into manual tests
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>
2023-02-09 00:23:34 +01:00
Volker Hilsheimer
55f2b448b0 Turn elidedlabel example into a code snippet
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>
2023-02-09 00:23:33 +01:00
Marc Mutz
ac6e8b3b21 savegame ex.: fix include order [2/2]: game.h
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 88e8094f18.

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>
2023-02-08 18:24:17 +01:00
Marc Mutz
fa55d46e1f savegame ex.: make Level ctor explicit
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>
2023-02-08 18:24:16 +01:00
Marc Mutz
4493334393 savegame ex.: use ranged instead of indexed loops
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>
2023-02-08 08:37:21 +01:00
Marc Mutz
35b94f8b43 savegame ex.: use NSDMI, =default the default ctor
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>
2023-02-08 08:37:21 +01:00
Marc Mutz
88e8094f18 savegame ex.: fix include order
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>
2023-02-08 08:37:21 +01:00
Marc Mutz
06a9b85f8f savegame ex.: fix extra ';' after Q_GADGET
Fixes compiler warnings.

Amends 1ff52e478b.

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>
2023-02-08 08:37:21 +01:00
Tor Arne Vestbø
a3697f2b84 permissions: Replace deprecated location permission usage key
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>
2023-02-08 00:13:55 +01:00
David Schulz
834e97ce46 Add android manifest and java files to example
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>
2023-02-07 18:34:42 +01:00
Jan Arve Sæther
f7db1cfa92 Remove "Analog Clock Window Example"
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>
2023-02-07 17:34:42 +00:00
Tor Arne Vestbø
0c2ee11f41 permissions: Set explicit bundle identifier for permissions example
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>
2023-02-07 13:33:02 +01:00
Mårten Nordheim
7df8ef0a10 HTTP example: Reflow QMessageBox usage in if-statement
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>
2023-02-02 18:03:36 +00:00
Jan Arve Sæther
fd65f70974 Fix analog clock example to adhere to guidelines
Guidelines: https://wiki.qt.io/Qt6/Example-Guideline

Pick-to: 6.5
Change-Id: I12c65ae11e7906fd2e9dfb449072199560488aed
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-02-02 17:51:34 +01:00
Tor Arne Vestbø
1f1380b79c permissions: Finalize permission example at end of CMakeLists.txt
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>
2023-02-01 20:25:08 +01:00
Friedemann Kleint
93af309a70 Examples: Fix CMake Unity (Jumbo) builds
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>
2023-02-01 19:12:36 +01:00
Friedemann Kleint
ddb94dd792 Examples: Add missing include guards
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>
2023-02-01 18:12:36 +00:00
Jan Arve Sæther
e08575a18a Remove wiggly example
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>
2023-01-31 22:28:30 +01:00
Jani Korteniemi
4b4873359d Fix ContextInfo example crashing on Android
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>
2023-01-31 20:52:40 +02:00
Volker Hilsheimer
cb0bf5ad68 Merge "undo" and "undoframework" examples
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>
2023-01-31 00:20:31 +01:00
Mårten Nordheim
39daa368d4 Torrent example: Use QByteArray toPercentEncoding
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>
2023-01-30 20:10:25 +01:00
Mårten Nordheim
6c90c04fb9 Torrent example: don't try to announce to an empty URL
Task-number: QTBUG-109798
Task-number: QTBUG-110622
Pick-to: 6.5
Change-Id: I3603232eb094387388da6421bf5525a3ba54fe03
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-01-30 20:10:25 +01:00
Jan Arve Sæther
2db23e151f Adhere to https://wiki.qt.io/Qt6/Example-Guideline
* Remove "Example" suffix in title

Pick-to: 6.5
Change-Id: I5da311850ab8f725da363969d7a8d8a1a85f8d70
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2023-01-26 16:07:47 +01:00
Mårten Nordheim
5006fddd33 HTTP Example: Add proxy handling
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>
2023-01-24 20:11:53 +01:00
Mårten Nordheim
d18b5195c1 HTTP example: remove needlessly unset-ing window flag
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>
2023-01-24 20:11:53 +01:00
Mårten Nordheim
c89c37b52f HTTP example: Fix missing translation and improve others
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>
2023-01-24 20:11:53 +01:00
Mårten Nordheim
7c90881a8e HTTP example: rename to HTTP Client
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>
2023-01-24 20:11:53 +01:00
Mårten Nordheim
5bc644c951 Fortune* Example: Rename and add category/tags
Task-number: QTBUG-108875
Pick-to: 6.5
Change-Id: I8eeff88187be4f85514d9871eb5009c51ad6de64
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-01-24 20:11:53 +01:00
Axel Spoerl
2ae75c2e6a Fix CMakeLists.txt of Style Plugin Example (broken on macOS)
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>
2023-01-19 10:50:04 +00:00
Amir Masoud Abdol
7fe2537ce2 Fix Style Plugin Example, and add some CMake Docs
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>
2023-01-18 14:47:12 +01:00
Mårten Nordheim
2fe69dbeb8 Fortune* Example: remove needless unset-ing of window flag
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>
2023-01-17 16:15:11 +01:00
Mårten Nordheim
71cd3bc074 Fortune* Example: Bump QDataStream format version
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>
2023-01-17 16:15:11 +01:00
Mårten Nordheim
605eec7b55 Fortune* Example: convert simple for-loop to ranged-for
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>
2023-01-17 16:15:11 +01:00
Mårten Nordheim
45717db7a5 Threaded Fortune Example: update example to use qintptr for descriptors
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>
2023-01-17 16:15:11 +01:00
Jan Arve Sæther
0280b7eb96 Painting examples: Don't mix const_iterator and non-const iterators
Reported by Clazy

Pick-to: 6.5
Change-Id: I80fce912b1e5390f0056b1fa9ae0d3cfcf39d045
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-01-17 16:06:08 +01:00
Jan Arve Sæther
1e790fb4db Compile easing curve example with -Weverything
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>
2023-01-17 13:45:55 +00:00
Volker Hilsheimer
2951f72584 Remove mousebuttons examples
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>
2023-01-17 06:42:04 +01:00
Jan Arve Sæther
4dbb07f614 Don't use file dialog in the address book example
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>
2023-01-13 19:21:44 +00:00
Tor Arne Vestbø
c0967bd288 permissions: Improve error when building example on non-supported platform
Pick-to: 6.5
Change-Id: I02f4fc087d49d21541b1e415db411c09db981278
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-01-10 13:16:03 +01:00
Jaishree Vyas
aae855bd6f Link update for Data Input Output in the save game example
Pick-to: 6.4 6.5
Change-Id: I2a886766d59b9e75f42e401fca9c258fcbe02809
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-01-05 15:22:00 +01:00
Axel Spoerl
f05aee7628 Fix unused variable compiler warning in slider example
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>
2023-01-05 05:21:43 +00:00
Kai Köhne
25c67c608a Examples: Do not wrap custom types in Qt namespace
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>
2023-01-02 23:16:30 +01:00
Andreas Eliasson
b556d6227f Doc: Fix broken link
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>
2023-01-02 13:50:52 +00:00
Giuseppe D'Angelo
fddeec60cb Wait conditions example: fix an incorrect condition variable usage
3a449bbb69 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>
2022-12-28 15:10:40 +01:00