Commit Graph

2031 Commits

Author SHA1 Message Date
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
Samuel Gaist
253a4a146b examples: port xml examples to new connection style
Task-number: QTBUG-106893
Change-Id: I1cab8949700d7449f0615731c85a77bb9136b0d3
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-21 22:33:02 +01:00
Samuel Gaist
e686a13b7b examples: port network examples to new connection style
Task-number: QTBUG-106893
Change-Id: Id0f558362108fedececb9eede36becc04ff4e307
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-21 21:52:17 +01:00
Samuel Gaist
cf6522e5d7 examples: port qpa examples to new connection style
Task-number: QTBUG-106893
Change-Id: Icf9a40403029c6973167f468f51b2dbdc365a848
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-21 21:52:17 +01:00
Samuel Gaist
d9dd875301 examples: port qmake examples to new connection style
Task-number: QTBUG-106893
Change-Id: Ie4a4874359ac7750de344f4e3702ea7be09e7b53
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-21 22:52:17 +02:00
Samuel Gaist
c47e2aebb6 examples: port embedded examples to new connection style
Task-number: QTBUG-106893
Change-Id: I6d00c53b7747b36c5f0094e566713f13fe74f3de
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-21 21:52:17 +01:00
Eirik Aavitsland
4a5abfcea4 wiggly example: add support for emojis etc. (utf16 surrogate pairs)
The venerable wiggly example was created before unicode support was
added to Qt. Hence, when extracting the individual characters from the
string for painting, the code was not prepared to handle that some
characters, like emojis, are composed of two QChar elements.

Fixes: QTBUG-28853
Change-Id: I9804415f92775e2b78fa9fcaf7a2d112153cdce0
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-12-12 12:33:20 +01:00
Aleksandr Reviakin
83be948833 Remove useless Q_OBJECT in Semaphores example
Fixes: QTBUG-108859
Change-Id: I1acf47b9dfd9c38546a2e965baa74067cedffc4a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-12-07 14:03:03 +01:00
Giuseppe D'Angelo
3a449bbb69 Wait conditions example: code tidies
In no particular order:

* Clean up #includes.

* Document what is protected by the mutex.

* Use explicit, nullptr.

* Use lock managers, not manual calls to lock/unlock.

* Unlock the mutex before notifying the condition variables.

* Condition variables are always meant to be used in a while loop, and
  never with a plain if, because of spurious wakeups.

* Don't lock a mutex just to protect a plain integer. We have atomics
  for that use case.

* Remove an unneeded signal, therefore also the need of using
  Q_OBJECT and the inclusion of the moc-generated file.

Pick-to: 5.15 6.2 6.4
Fixes: QTBUG-108860
Change-Id: I2afc77955b95de8aa5fb88048cd9feb217f83b4f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-06 06:30:55 +01: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
Joerg Bornemann
0c5f1beddc CMake: Clean up usage of the examples/widgets/painting/shared lib
Remove conversion artifacts.

Also, remove setting the include path. The library's interface takes
care of that.

Change-Id: Ib5043f15ede2171ab876ccbe603ed0b84de1bce4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-05 15:55:53 +01:00
Joerg Bornemann
c682d78ac2 CMake: Fix examples/widgets/painting/shared library
This library deliberately links PUBLICly against Qt6::Widgets and
Qt6::OpenGL. Same for the target_include_directories call.

This partially reverts a5de12f0d7.

This fixes the builds of examples using this library.

Change-Id: I2b5791044afc82e71df4a3bbfc26e5b1ab9afa76
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-05 15:55:53 +01:00
Laszlo Agocs
919664b29a Avoid continuous texture alloc in Composition Modes example
There seems to be some confusion from back when the example were
mass-ported to the QOpenGL stuff in Qt 5 times.

Pick-to: 6.4 6.2
Fixes: QTBUG-109119
Change-Id: Ic4bcd010df3fcf82e16385ce241b379f0c351788
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2022-12-02 20:53:01 +01:00
Tor Arne Vestbø
846cda7eb0 Remove Android High-DPI workarounds in examples
These should no longer be needed for Qt 6.

Change-Id: Ica7214cbf4fc3ddae960309fe89681ec690d28d0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-02 15:53:37 +01:00
Tor Arne Vestbø
465bde54a0 Remove showMaximized() workaround for Android in examples
Android implements QPlatformIntegration::ShowIsMaximized nowadays.

Change-Id: I451a9a8edc8ec407946d44f3e6921c78ac1d11aa
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-02 15:53:37 +01:00
Tor Arne Vestbø
5789ffd9cc QErrorMessage: Improve standard dialogs example
Change-Id: Ia5a2251662fe56809fc66cdadd117259d6bfd977
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-11-30 14:48:51 +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
d221ea609f Examples: Remove duplicated Qt6::PrintSupport link information
Some CMakeLists.txt files did link to Qt6::PrintSupport twice. Also
unify formatting and order of the linker step.

Change-Id: I4af935c5dc3de6c243aad8511b0803ceaa872589
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-11-30 14:48:50 +01:00
Andreas Eliasson
de7287be69 Doc: Fix typo and mismatch between code and description
Fixes: QTBUG-107675
Pick-to: 6.4 6.2
Change-Id: I38140617a2b0525db417137aa41a52a389b3bea3
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2022-11-30 14:48:50 +01:00
Kristoffer Skau
ee2dbcada8 Add support for stereoscopic content in QOpenGLWidget
Need to add the plumbing necessary to support two textures in
QOpenGLWidget and use these in the backing store. The changes
required on the RHI level is already done in an earlier patch.
Then paintGL() needs to be called twice, once for each buffer.
Also add overloads for the other functions of QOopenGLWidget
where it makes sense to query for left or right buffer.
Then finally create an example.

[ChangeLog][Widgets][QOpenGLWidget] Added support for
stereoscopic rendering.

Fixes: QTBUG-64587
Change-Id: I5a5c53506dcf8a56442097290dceb7eb730d50ce
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-11-28 19:12:27 +01:00
Joerg Bornemann
23be657dda Add missing qt_standard_project_setup to richtext/textedit example
This amends commit f562711c64.

Change-Id: Iedfb744aa827c7b246aa05eaadd6bc45639d7b61
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2022-11-28 14:46:03 +01:00
Tor Arne Vestbø
83b31a3d99 Modernize QMessageBox documentation and example
Change-Id: Iebcdf53646f1a42c327414edf21ac93a7d1c0a56
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2022-11-18 19:25:20 +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
Tor Arne Vestbø
0d517a1352 sharedmemory example: Handle QSharedMemory::AlreadyExists by attaching
Not all platforms clean up the shared memory entries on exit, so the
example needs to handle that case, by attaching instead, as documented.

Change-Id: Ifbcf92d0fad429caf30710bd8a344831cb0d859c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-11-15 12:27:43 +01:00
Tor Arne Vestbø
5a36ee7028 sharedmemory example: Show error string when failing to create shared memory
Change-Id: I27edc27aec742e1e34c060e48810c4cfba096ee8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-11-15 12:27:41 +01:00
Tor Arne Vestbø
c1088d493e QMessageBox: Don't add details button to native dialog helper
The "Show Details..." button is not plumbed in any way to the native
dialog, so when added to a native dialog it will just result in the
dialog being dismissed, instead of revealing any extra content in
the native dialog.

Both the iOS and Android native message dialog implementations add
the details text directly to the dialog, without any action to
explicitly reveal it.

Task-number: QTBUG-108153
Change-Id: I92e00c59b7836f633be44caebd534a47ac58be00
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-11 17:48:50 +01:00
Assam Boudjelthia
e4125863f0 Add permissions feature example and manual test to the build
And add license headers and some minor fixes for warnings in the
example and test.

Task-number: QTBUG-90498
Change-Id: I34592f7f2844c92c25a6a676c8ac1ffca9e03c6d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-11-10 17:54:02 +02:00
Tor Arne Vestbø
ef935f6e37 Plumb public permission APIs to Android backend
The lock and unlock of the Android deadlock mutex is now part
of the internal implementation instead of limited to the enum
based permission API. It is unclear why 8bca441b6f added
the guard only to this API and not to the string based API
as well.

The check for isBackgroundLocationApi29 has been removed,
as the logic seemingly resulted in accepting every single
permission type except location permissions if used via
the enum-based API.

Since Android's platform permission API doesn't have an
Undetermined status, we keep a hash of the status for each
permission type, and by default checkPermission() would
return Undetermined, until a requestPermission() call
is done which updates the internal hash, and after that
checkPermission() would return properly Granted/Denied.

Task-number: QTBUG-100413
Change-Id: Ia95c76af754481a281bc90198e349966c9c2da52
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-11-09 14:22:29 +02:00
Tor Arne Vestbø
b2b941823e Exercise QMessageBox::setInformativeText() in standard dialogs example
Change-Id: Id54a6d93e22fcb6622b434e3766baedb581d6b79
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-11-03 15:43:58 +01:00
Timur Pocheptsov
f0a7d74e1d Add permission API backend for macOS and iOS
When submitting applications to the iOS and macOS AppStore the
application goes through static analysis, which will trigger on
uses of various privacy protected APIs, unless the application
has a corresponding usage description for the permission in the
Info.plist file. This applies even if the application never
requests the given permission, but just links to a Qt library
that has the offending symbols or library dependencies.

To ensure that the application does not have to add usage
descriptions to their Info.plist for permissions they never
plan to use we split up the various permission implementations
into small static libraries that register with the Qt plugin
mechanism as permission backends. We can then inspect the
application's Info.plist at configure time and only add the
relevant static permission libraries.

Furthermore, since some permissions can be checked without any
usage description, we allow the implementation to be split up
into two separate translation units. By putting the request in
its own translation unit we can selectively include it during
linking by telling the linker to look for a special symbol.
This is useful for libraries such as Qt Multimedia who would
like to check the current permission status, but without
needing to request any permission of its own.

Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Change-Id: Ic2a43e1a0c45a91df6101020639f473ffd9454cc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-11-03 15:02:36 +01:00
Tor Arne Vestbø
33cf9d32da Long live QPermissions!
Many features of today's devices and operating systems can have
significant privacy, security, and performance implications if
misused. It's therefore increasingly common for platforms to
require explicit consent from the user before accessing these
features.

The Qt permission APIs allow the application to check or request
permission for such features in a cross platform manner.

The check is always synchronous, and can be used in both
library and application code, from any thread.

The request is asynchronous, and should be initiated from
application code on the main thread. The result of the request
can be delivered to lambdas, standalone functions, or
regular member functions such as slots, with an optional
context parameter to manage the lifetime of the request.

Individual permissions are distinct types, not enum values,
and can be added and extended at a later point.

Task-number: QTBUG-90498
Done-with: Timur Pocheptsov <timur.pocheptsov@qt.io>
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Done-with: Mårten Nordheim <marten.nordheim@qt.io>
Change-Id: I821380bbe56bbc0178cb43e6cabbc99fdbd1235e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-11-01 18:56:15 +01:00
Kai Köhne
b77da049bc Move i18n example to qttools
Move i18n example out of qtbase. In qttools, it can use lrelease,
avoiding the need to store .qm files in the repository.

Change-Id: I8ba36a1372c2a743b809e3f7ea95a67825558f41
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-11-01 15:52:12 +01:00
Johannes Kauffmann
5143670855 examples: fix configuring with -no-feature-widgets
It also fails for -no-feature-gui, but since the example depends on
QtWidgets, which implies depending on QtGui, we only check for
QtWidgets here.

Pick-to: 6.2 6.4
Change-Id: I777e540e6c2101ce8f08a5f80ba01b37ff858373
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-29 01:04:06 +02:00
Laszlo Papp
faeeb42b85 Add a shortcut editor example
Many applications offer shortcuts for quick interaction with the
application. It is also common in such applications to offer a shortcut
editor in the preferences or separately in a dialog.

However, even though this is a fairly common use case for applications
with more than a couple of shortcuts, there is no good and comprehensive
official Qt example how this could be achieved.

This change is an attempt to bridge the gap.

Change-Id: Ic01a404e6157bda1b0a75a0b792cbfe5d910d48f
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2022-10-25 14:38:46 +01:00
YAMAMOTO Atsushi
fe0e76a582 Fix typo in examples/i18n
The name of the variable that handles the qm file is qmlFile.

Change-Id: I873c73cd8f96ff821fe3d2e633e84fef8c687875
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-10-25 10:06:59 +00: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
Marc Mutz
dd562b3672 Replace qExchange with std::exchange
None of these users require C++20 constexpr or C++23 noexcept, the
only remaining difference between std::exchange and qExchange.

This leaves a single qExchange() user, in QScopedValueRollback, that
requires the constexpr version, only available from C++20, and thus
remains unported.

Task-number: QTBUG-99313
Change-Id: Iea46f6ed61d6bd8a5b2fd9d9ec4d70c980b443a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-07 18:11:36 +02:00
Eirik Aavitsland
72a3da3d4d Style sheets: add placeholder text color property for edit widgets
The placeholder text was given its own QPalette color role in Qt 5.12,
but there has been no way to specify it from a Qt style sheet.

Fixes: QTBUG-93009
Change-Id: If58ca844c19c65b7eee14c6d5730a4ba27640c33
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-29 08:20:56 +02:00
Samuel Gaist
6457f1ee71 examples: port dbus examples to new connection style
Task-number: QTBUG-106893
Change-Id: Ic857f694b836fba30e41ef0a40107917bd05b64c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-09-27 19:29:59 +00:00
Friedemann Kleint
33bee95910 Brush up the drop site example
- Use qsizetype
- Use new string literals instead of deprecated QLatin1String()
- Streamline some code
- Remove unused member variable
- Remove module include

Pick-to: 6.4
Change-Id: Ia96424a23f3ae10e57db942de49949ce3aef8876
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-09-21 20:52:14 +02:00
Jan Arve Sæther
30947c7fd4 Pass a parent pointer to the Animation instance to avoid memory leak
The leak is just on termination, but we should show good practices in
our examples

Pick-to: 6.4 6.3 6.2
Change-Id: I39abb7545d3c68a1a537b865ba3fcb5e60c22fbf
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2022-09-15 17:57:54 +02:00
Mikolaj Boc
fc78059934 Use popup() instead of exec() in examples
popup() is generally better but it has a certain advantage that it does
not require a run loop to work, therefore platforms (like WASM) can use
it without resorting to extra measures (like asyncify).

Task-id: QTBUG-106389
Backport-to: 6.4 6.4.0
Change-Id: I87bde677f84048af82cc9aadd982284bdba41e69
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-09-07 21:59:30 +02:00
Edward Welbourne
f94f165336 Document shell-friendly data tags as best practice
Also follow this best practice in testlib's own documentation and
examples.

Pick-to: 6.4
Change-Id: I8b57dfa8f88835adae8fceeb122a16635708e338
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2022-09-07 15:29:38 +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
Sona Kurazyan
e684c25b85 QDomDocument: deprecate old setContent() overloads in favor of new ones
And use the new overloads in examples and tests.

[ChangeLog][QtXml][QDomDocument] Deprecated the old setContent()
overloads in favor of the new ones that take ParseOptions and
ParseError.

Task-number: QTBUG-104507
Change-Id: I61b37eba2fe3002c03bddc90f6877676d539f7ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-17 17:02:27 +02:00
Elias Hautala
1a60194388 Sliders: Add function that changes widgets position on layout
Changes the layout to QGridLayout and adds function to change widgets
position on the layout depending on the windows aspect ratio. Before
this the widgets wouldn't fit on screen when using the example on
Android in portrait.

Fixes: QTCREATORBUG-27685
Pick-to: 6.2 6.3 6.4
Change-Id: I00009cb6c8c250a8333ac3dfa635f70da4576d5e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Jani Korteniemi <jani.korteniemi@qt.io>
2022-08-15 11:22:14 +03:00
Friedemann Kleint
8751ca3dae Polish the model/view tutorial examples
- Reorder the class declarations, moving private sections last
- Make constructors explicit
- Add space to the comments
- Introduce auto
- Replace slot MainWindow::showWindowTitle() by a direct
  connection to slot QWidget::setWindowTitle().

Pick-to: 6.4 6.3
Change-Id: Ic229162434dfef5f2767d0b4e186759ca0f821f3
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-08-09 00:19:09 +02:00
Elias Hautala
89ce9a1c5a Basiclayouts: Add scrolling to example
Adds scrolling to basic layouts example because the user interface in
the example doesn't fit properly on smaller screen sizes.

Fixes: QTCREATORBUG-27634
Pick-to: 6.2 6.3 6.4
Change-Id: I61e6eac2b28e5b3ff0f984894fe38167b3f46a9c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Markku Nokkala <markku.nokkala@qt.io>
2022-08-08 17:30:35 +03: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
Alexandru Croitor
818a15234c CMake: Make sure qtbase examples are installed into the correct path
The find_package calls need to happen after we set INSTALL_EXAMPLEDIR
to ensure that INSTALL_EXAMPLEDIR is overridden if necessary.

Pick-to: 6.2 6.3 6.4
Task-number: QTBUG-102879
Change-Id: I3c2e6c5a68a8c6ff9b98b79dbd6c83445d8da052
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-07-27 16:37:54 +02:00
Kai Köhne
65d9593413 Examples: Use signals, slots instead of Q_SIGNALS, Q_SLOTS
Pick-to: 6.4
Change-Id: I79a352d1bac11edf2d2b0443d2f1bb202fb4e254
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-21 11:24:36 +02:00
Nicholas Bennett
fc5482cac6 Support pinch zoom gesture in the Mandelbrot example
Used QGesture for this as per the gesture example.
Moved the help and info text to separate lines.
Enabled word wrap to prevent text going off screen.

As a drive-by, the code to center the window at a size that's a fraction
of the screen is replaced with a simple sizeHint() override. The user
should have control over placement, particularly now that it should be
placed manually onto a touchscreen if the user has one.

Done-with: Shawn Rutledge
Fixes: QTBUG-96702
Pick-to: 6.4
Change-Id: I8dba8b09bed474f585341e9a7a8c71fb60293eee
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-07-21 08:38:44 +03:00
Ivan Solovev
7d2361b9da Addressbook example: port to QLatin1StringView
This allows to fix the warning:
 qtbase/examples/widgets/itemviews/addressbook/addresswidget.cpp:115:
  warning: loop variable ‘str’ of type ‘const QString&’ binds to a
  temporary constructed from type ‘const char* const’
  [-Wrange-loop-construct]

Pick-to: 6.4
Change-Id: Ibbfa7f9e85fe9ef79291f9da3d161667286b282e
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-07-15 14:44:38 +02:00
Ivan Solovev
6db91c0df1 GroupBox example: port away from using deprecated QAction::setMenu()
We can achieve the same UI by using QMenu::addMenu() directly

Task-number: QTBUG-104857
Pick-to: 6.4 6.3 6.2
Change-Id: I627f21bc93646943cf6dfbd3b388352b84f73f0f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-14 16:28:49 +02:00
Joerg Bornemann
7ce82225f6 CMake: Let qt6_add_plugin accept sources
The commands qt6_add_executable and qt6_add_library both accept a list
of sources that get automatically added to the created target.
Extend qt6_add_plugin to also accept sources for consistency.

Fixes: QTBUG-104189
Change-Id: Iad5d8c5b31551663be155d068d55e770e1a91b27
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-29 18:32:05 +02:00
Kai Köhne
9d2cc4dd76 Fix typos in docs and comments
Found by codespell

Pick-to: 6.4
Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-06-15 21:31:02 +02:00