91 Commits

Author SHA1 Message Date
Friedemann Kleint
cecb65383c 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

Task-number: QTBUG-111228
Change-Id: Iea915604e89d3005270f0eb83eca882855589a44
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 723e331f0a811294e43207db162698c3ff8fde51)
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-06-13 18:24:01 +02:00
Topi Reinio
3722c293c1 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

Change-Id: Ibc989e83abc49837db08628facaf8e5f72b2f123
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 17ddf2a6a52bab5d406bea560591961a7527929b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-09 20:41:57 +00:00
Edward Welbourne
9eb6d09a32 XBEL example: use nullptr rather than 0 for null pointers
Task-number: QTBUG-111228
Change-Id: I7cb95ab6f84854d36a949d1ce667cb80a9c626be
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 4d8dddd6998aeab1a3531d179f53c2723ac72769)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-09 12:06:15 +00:00
Edward Welbourne
cb895b7933 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
Change-Id: I0090fb45ce8d5a8f168fde9b3247d541b709c1b2
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit f2ab85429dd82562cb19704ed215c25fc0c98e98)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-06-01 17:06:40 +02:00
Edward Welbourne
80c2b227f0 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
Change-Id: If2fa40cac0e51a243054526d7d2997fdd54aea3e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 3c78f1e96e17f5becb6830ea473c1ed16ac261ea)
2023-06-01 17:06:33 +02:00
Edward Welbourne
0fb6f9569d 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
Change-Id: Id10483b26937a97899d656c4b26f27b37b8d39b6
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 2e09d03cd117af39e81e08eb06513d6fbe921ab9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-05-25 15:41:08 +00:00
Edward Welbourne
fa7be98d73 RSSListing: remove metaDataChanged slot to handle redirects
QNetworkAccessManager takes care of doing that by default anyway,
these days.

Task-number: QTBUG-111228
Change-Id: I890d258599e22efb6fc6ce0140304a97edcbb3f8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
(cherry picked from commit fe2af0f8a3e1e686d78164d97c72b3eda5511459)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-05-25 15:41:00 +00:00
Edward Welbourne
22466d6685 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
Change-Id: I46d572982197550801c6fa4425453fc670c6f2f1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e7b1bc659087ce28fbc40b3ebe79cc10462994fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-05-25 15:40:52 +00:00
Edward Welbourne
1d5c003e0e rsslisting example: shuffle parts of constructor for clarity
Group related things together, improve the logical flow of the code.

Task-number: QTBUG-111228
Change-Id: If3eb577b74128b305ca5fb3074168280ec2d4db8
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit fb2d4074c18b0a47ee5b65e3145124f92d9fe1df)
2023-05-25 10:34:04 +02:00
Edward Welbourne
655e6d10da 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
Change-Id: I9f4c0d126e0872bb4ec6e6bb41add7e9d2a9537f
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 233ca06500245a3d61432a7edce1668aa4ce35c9)
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-05-25 10:33:57 +02:00
Edward Welbourne
06988ea388 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.

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>
(cherry picked from commit 3cdc65c2ecc97b9149782bc2b7639d26f5074056)
2023-05-25 10:33:51 +02:00
Edward Welbourne
e79e2912bb rsslisting example (coding style): split a long line, purge stray braces
Task-number: QTBUG-111228
Change-Id: Ic919d4dee74823f11c55d286beba447d45111754
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 00ccc564348f83b07337b7575dfb0a9d0ec8ff2d)
2023-05-25 10:33:47 +02:00
Edward Welbourne
df942089da rsslisting example (coding style): fix horizontal spacing
Remove space after *, insert space after comma.

Task-number: QTBUG-111228
Change-Id: I7525715dede20b45241efaf3f9540c896b1455c7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
(cherry picked from commit f8ad9cd23c1ee33497c0e4300ebf62f1830751d2)
2023-05-25 10:33:40 +02:00
Edward Welbourne
af35ef9453 rsslisting example: remove unused include and surplus blank lines
Task-number: QTBUG-111228
Change-Id: Ibfa82aef67eaf6ba758dade30a4c9542f2836123
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit d52cc4725faacc68a9fde69dfc899c4b432fe036)
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-05-25 10:33:33 +02:00
Edward Welbourne
457dc2c47b 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.

Task-number: QTBUG-111228
Change-Id: I16647e2498b58caaafa6e88ef73f0d934a1f8396
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 637e1542cfd75969edabba547af693f29411e6aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-05-22 15:09:06 +00:00
Edward Welbourne
9f3cde89c9 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
Change-Id: I472acda4b7533db41ab0e78b694e0256b34d2b40
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 56df9e5603b33d0fe6264c185030785b5587f8b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-05-22 12:32:34 +00:00
Edward Welbourne
306cb0140d 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.

Task-number: QTBUG-111228
Change-Id: I3642e24e0d10721e4a0325b35a94dcb5dfbcd4e6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d75e772e2252a37c55ada3d84a301d3d296c1d02)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-05-16 18:09:50 +00:00
Edward Welbourne
f2e2c08bef 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.

Task-number: QTBUG-111228
Change-Id: If362b0e1e5b50d711a8fe8e01a8830034edf5363
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
(cherry picked from commit b1d59d6dd97e99086d15b29765282866500942f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-05-09 21:40:00 +00:00
Edward Welbourne
da0abaf44e 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.

Task-number: QTBUG-111228
Change-Id: Ic54893c483607e95627a50db76a0d9918744c07e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 179b61c85f789c378182f9a5930e324ad1bbf2a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-05-09 21:39:52 +00:00
Kai Köhne
afd687d41a Doc: Add XML, Json, CBOR examples to IO category
Task-number: QTBUG-112372
Change-Id: I867bd33ff08629e03b35eccd4b7418573abe7c68
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 0de3a17394e947bb04de0a004bb18f7533acfbb6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-05-09 20:30:42 +00:00
Marc Mutz
dbaaf597ff 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.

Task-number: QTBUG-108857
Change-Id: I811447295c9c3fdef23f61aff31ebe82941eb3b4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6f1e53943d463978d2a3ae226fdeea78b06df34c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-05-09 18:29:05 +00:00
Edward Welbourne
18c87e0953 Flip string comparisons in savegame example
This follows up to commit 9834e80833783357743b2a5abe3071760638effb,
fixing an accidental flip to the meaning of keywords on the
command-line. If the first word is "load" we should load a prior game,
not start a new one; if the second is "binary" we should use CBOR, the
binary format, not JSON.

Task-number: QTBUG-111228
Change-Id: If29070777daf68f2f959bc1ec4ffd67ba90b28ba
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 5a3784bba363978c798cacfb7c826f7d03a35115)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-05-04 14:19:19 +00:00
Marc Mutz
7eafdf4c81 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
Change-Id: Icaa14acc7464fef00a59534679d710252e921383
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 5a3ac484dbcc64c8ee7a57854fcdde6b4b067aaa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-05-03 19:36:27 +00:00
Edward Welbourne
3ea71086f2 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
Change-Id: I7d5e968284e0f1da2ec990af9512c9b7cb886792
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit bcab157f75add9b2ac3c69e9c2c0399c71a7df5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-19 17:12:09 +00:00
Marc Mutz
6c07770372 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

Change-Id: If9da4fbe975d9a97939ea01558b2a8cef7ad3a24
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9834e80833783357743b2a5abe3071760638effb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-11 13:07:37 +00:00
Øystein Heskestad
eaff3f2486 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
Change-Id: Id36fb04a6acb7b8d1eb008f61568fe0abc221e3d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 29317b426b9ec84f4ba66e6c032f71c2a2bae091)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-31 11:26:52 +00:00
Øystein Heskestad
258f448b13 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
Change-Id: I862909e767301250750b6ee0d8ac7e20d6bad2b1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 10b4c06b4928d12addc7e55e4a6e5ed537a63942)
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-03-31 08:44:16 +02:00
Edward Welbourne
72d703a521 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.

Task-number: QTBUG-111228
Change-Id: Ic12e77cf34caadc9f60527e886f94c76cb8cfeaf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5c2245cd66894cc27d6d4afcf13499db6434ee2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-28 11:25:30 +00:00
Edward Welbourne
a9fc9ac512 Use local names to make some numeric_limits references more readable
Task-number: QTBUG-111228
Change-Id: I220f5c2f13c8f01278be806c8e8d6a3a1be8e986
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 074d3d54d8f67599402f3d175ce0368ef4f13269)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-21 05:36:10 +00:00
Marc Mutz
0a6db5eb7b 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 88e8094f18e6581f2b652eb3d82f514ecf687046.

Task-number: QTBUG-108857
Change-Id: Iafdae9dd8e70ff99882c4344a023a21d15fa3c54
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ac6e8b3b21c2ae25e7a4fe483b604ea6ddecd3ff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 17:24:35 +00:00
Marc Mutz
53dd3ff490 savegame ex.: make Level ctor explicit
A QString is not a full representation of a Level, so the
Level(QString) ctor should be explicit.

Task-number: QTBUG-108857
Change-Id: I24b705139e61c4aaf59cb0aad3b536013e0d07df
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fa55d46e1f09ddf45dbe5700d4637b003363c559)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 17:24:28 +00:00
Marc Mutz
e1257fdd5b 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
Change-Id: I42727ff8bdef5336368cde349cbcb8d10bb6289f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 88e8094f18e6581f2b652eb3d82f514ecf687046)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 07:37:57 +00:00
Marc Mutz
4eafbe2a5e savegame ex.: use NSDMI, =default the default ctor
Modernizes the code.

Task-number: QTBUG-108857
Change-Id: I6ddf1de3699506ffc0fc4b1034ab48defafcf174
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 35b94f8b4349581c548b7aac2e858750072efa19)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 07:37:57 +00:00
Marc Mutz
c0f5c0a926 savegame ex.: use ranged instead of indexed loops
Modernizes the code, and fixes qsizetype/int mismatch.

Task-number: QTBUG-108857
Change-Id: Id4262ee0bcb673d62135a81c30976903eef3e5e2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 44933343937d7a6d9f6afe1f8e0b0f93a387b100)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 07:37:57 +00:00
Marc Mutz
7bb8bf9f57 savegame ex.: fix extra ';' after Q_GADGET
Fixes compiler warnings.

Amends 1ff52e478bab33f3aaba5ec185295411a0e6867d.

Task-number: QTBUG-108857
Change-Id: Id8b81c67e55baf490aabd0483b5800b3e61965ee
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 06a9b85f8fec8d039aa0e63cea0e16037611bf79)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 07:37:57 +00:00
Friedemann Kleint
b9ed727556 Examples: Fix CMake Unity (Jumbo) builds
Disambiguate variables and add some exclusions.

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>
(cherry picked from commit 93af309a707ea2ab133e281d837ac37b1351fb47)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 05:01:42 +00:00
Jaishree Vyas
b60af51ada Link update for Data Input Output in the save game example
Change-Id: I2a886766d59b9e75f42e401fca9c258fcbe02809
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit aae855bd6f87533590b5f91ab7104276d58763ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-08 18:50:25 +00:00
Aleksandr Reviakin
3b0ef74694 Use const reference in loop in JSON Save Game example
Fixes: QTBUG-108857
Change-Id: I503a3c9ebe145d0dae52b74435212807405f0247
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-05 19:02:59 +01:00
Kai Köhne
a5de12f0d7 Examples: Use PRIVATE CMake linkage
We (almost) only build apps, for which PRIVATE linkage makes more sense.

Change-Id: I09a509c3fb33a00cdfdede687b3f95d638f42091
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-11-30 14:48:50 +01:00
Kai Köhne
f562711c64 Examples: Use qt_standard_project_setup()
Change-Id: I0ceab08108b7e58e4e2ed25db9e3c289f5c0ddac
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-11-17 19:59:11 +01:00
Kai Köhne
bec264c15f Examples: Use Qt6:: to qualify Qt CMake packages
This is what we promote also in the documentation.

Change-Id: If91aebafe861b0c934acbb2c69afd182abc3345d
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-11-17 19:59:11 +01:00
Marc Mutz
aa37e67ef7 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace, with manual
unstaging of the actual definition and documentation in dist/,
src/corelib/doc/ and src/corelib/global/.

Task-number: QTBUG-99313
Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-10-11 23:17:18 +02:00
Øystein Heskestad
855a9ca217 Add CBOR documentation
Add documentation of usage of CBOR in convert and cbordump examples,
add a CBOR overview, and add links to them other places in the
documentation.

Task-number: QTBUG-85912
Change-Id: I518792db63647bf9ddd4507d8d4b7ef056192f82
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-09-01 19:03:00 +02:00
Lucie Gérard
32df595275 Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-23 23:58:42 +02:00
Lucie Gérard
fb1b20eab3 Add license headers to cmake files
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.

Existing copyright statements remain intact

Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-03 17:14:55 +02:00
Lucie Gérard
05fc3aef53 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-16 16:37:38 +02:00
Fabian Kosmale
91a50d8330 Examples: Do not depend on transitive includes
Change-Id: I7bba855a14289edbedbaa07a1234213f59085c1d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-03-17 17:14:38 +01:00
Kai Köhne
57402ffb9b Examples: Remove unneeded CMake options
CMAKE_INCLUDE_CURRENT_DIR is not necessary anymore for moc since
CMake 3.8: https://cmake.org/cmake/help/latest/release/3.8.html#other-changes

CMAKE_AUTORCC should not be used anymore. Instead, we now use
qt_add_resources() or similar

Enable CMAKE_AUTOUIC only if .ui files are present.

Pick-to: 6.3
Task-number: QTBUG-87643
Change-Id: I835e2994cd5dba9918136999499b9077961b616c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-01-24 14:00:00 +01:00
Kai Köhne
131681652e Examples: Clean up WIN32_EXECUTABLE, MACOSX_BUNDLE properties
Both are FALSE by default, so no point in explicitly setting
them to FALSE.

In addition, dbus/listnames is a command line tool. No reason
to set WIN32_EXECUTABLE, MACOSX_BUNDLE here.

Pick-to: 6.3
Change-Id: I99aaf27a0267c5575bd2ee5b6183991fce721f44
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-17 10:38:49 +01:00
Kai Köhne
80a76df178 Examples: Fix whitespace issues in CMakeLists.txt
Pick-to: 6.3
Change-Id: I8e6dd1f250f8be6016ee4164cb2ab7034cbb1203
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-13 14:16:26 +00:00