2148 Commits

Author SHA1 Message Date
Laszlo Agocs
273c96a941 Update QRhiWidget API based on review comments
Spell out some API names in enum.

Some functions are now protected.

Remove property for autoRenderTarget.

textureFormat -> colorBufferFormat.

Used "fixed" instead of "explicit" and follow
the above naming, so that explicitSize becomes
fixedColorBufferSize.

Change-Id: I2fd6ad46033313a3febbb8846146021d5dd11010
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit acebb97b58807d1d5910c79209664b21e741a9c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-01-18 14:32:58 +00:00
Lorn Potter
c413bd9366 wasm: fix drag examples for webassembly
Change-Id: I47903743685fadfe33820e7785b72d62109e77d0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 39f81d14c1c0a09ff5165fa11b8369f8ae010ef4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-01-16 22:02:03 +00:00
Jaishree Vyas
e2ad97eef9 Doc: Create separate Graphics and Multimedia example categories
Fixes: QTBUG-117884
Pick-to: 6.6
Change-Id: I33c7b1cbfaeae866dffb0e89a5d09d775736d886
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 98ee4d9e37a1038d46f0c0494332c0ed46dbb323)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-01-16 18:10:59 +00:00
Kai Köhne
bfc841f149 Fix warning on SQL Browser startup
Browser::addConnection is not a slot/invokable, and requires arguments.

What was probably meant to happen is that the connection dialog
opens.

Pick-to: 6.6 6.5
Change-Id: I4e6bffb3e0277ca3deb7111cf4bb47ff188f6f16
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 3552afe38a6ba3feebe4fd9ecd561a8c0c2b9717)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-01-13 17:53:51 +00:00
Assam Boudjelthia
251267d439 Android: remove redundant comments from notifier example manifest
Task-number: QTBUG-115020
Change-Id: I29cd7a45f85bc85f6f12b135287b9eb868a7bc44
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit 8cc84a1386b77701ebc9c9d4efbc1b033d0e326b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-21 22:06:20 +00:00
Volker Hilsheimer
eb9252526e Remove the style plugin example
The snippets in the QStylePlugin class documentation show the
relevant bits well enough.

Pick-to: 6.6
Fixes: QTBUG-119974
Change-Id: Iba4a37664d64d86a2946f41d131a201ccdcd723b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 5a0135fafb16203a812163f7ed55c1b981477cb5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-21 17:46:40 +00:00
Doris Verria
e4c533c336 Update ImageGestures example
- Update screenshot
- Provide some information text on the screen when no images are found
- Add all supported image formats to the file filters
- Minor fixes according to our coding conventions: eg. don't shadow
  variables

Fixes: QTBUG-119979
Change-Id: If41adf34f38bfa101f2c5433082828c1a10668b1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 30e6d822327d8105d209af10d077512f21ecc12c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-21 14:12:58 +00:00
Axel Spoerl
83df3a8138 Remove echo plugin
Remove echo plugin code and documentation.

Fixes: QTBUG-119981
Change-Id: I4083ac6cdb768facaed041241af2c5ee6e28df50
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 01bf423d67d5e6f8de5ec51a6b85178492681ca9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-21 05:35:19 +00:00
Volker Hilsheimer
d8b113f46f Minor updates to the "Touch Knobs" example
Turn on anti-aliasing, and update screenshot.

The example is still not great and under-documented, but at least it
doesn't look horrible anymore.

Pick-to: 6.6
Task-number: QTBUG-120291
Change-Id: Ie709cb51d64c535d7cd0aa1451b3c5bb901324cb
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 2b9d021ba5487f7f5f67b958a17160c4cf468561)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-21 01:52:22 +00:00
Volker Hilsheimer
ba583b5e31 Turn SpinBox Delegate example into snippets
The essence of the example was already fully quoted in the
model/view documentation. Move the code into a snippet
source, and update the screenshot.

Fixes: QTBUG-119976
Pick-to: 6.6
Change-Id: Id2f10bb26a650419969bbfa9b76cb74babd3319e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit 99eaae4323ff1fda2d8cc0184d824b6d9c3f23ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-21 01:52:11 +00:00
Assam Boudjelthia
c27163cd7d Examples: Add Qt6::Gui editabletreemodel and simpletreemodel tests
Android needs the Gui dependency.
Amends 283cdcd3d5fad368c9df1bcae69cbfbf9ade623f.

Pick-to: 6.6
Fixes: QTBUG-120257
Change-Id: Id02b03b9fa08546bc5a126b3e71e67bdd65f8b66
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 4d7ac732557f397cc24c47bc5469db60a0c2a2cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-20 19:47:09 +00:00
Topi Reinio
26c10a8863 Doc: Fix documentation issues for Qt Core
* Fix template arguments in \fn signatures for Qt::compareThreeWay()
  functions.

* Fix template arguments in \fn signatures for QDebug::operator<<()
  functions.

* Fix \sa links to specific overloads of QSpan functions.

* Fix \sa links to specific overloads of QFileInfo::fileTime().

* Remove references to 'Custom Type Example' (example has been removed).

* Fix linking to 'JSON Save Game' example.

* Fix references to 'Queued Custom Type' example.

* Fix linking to QCryptographicHash::Algorithm.

* Fix linking to Qt Qml module.

* Fix undocumented parameters in qHypot().

Change-Id: If9eb9978a14e147f003672a682972b319454c311
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 96740ea3fed8a7837dc282135661723858fff198)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-19 22:49:49 +00:00
Volker Hilsheimer
2d3ee8ac34 Update Sliders example
Simplify the "responsive layout" implementation. Just use a QBoxLayout
with changing direction instead of repopulating a QGridLayout, and
change the orientation of one set of sliders instead of creating two
sets in a stacked layout.

Simplify the resizeEvent() implementation accordingly.

Update the documentation snippet text to match the code, and document
the resizeEvent() override.

Pick-to: 6.6
Fixes: QTBUG-119977
Change-Id: I73a1bb215c956fa283291ebf0ea45ff9a975c727
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f3fb89ba298e1741320d8bfac9cbd0d503373bff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-19 08:02:47 +00:00
Volker Hilsheimer
1f0c629a48 Move the settingseditor example into tests/manual
The example uses QTreeWidget when it should use a QTreeView with a
dedicated item model, primarily shows how to use item views (and very
little about QSettings), and is generally not useful to show how an
application could or should use QSettings to store settings.

Turn it into a manual test instead; it's useful for that as it supports
ini and plist files, and settings in different scopes.

Fixes: QTBUG-119978
Change-Id: I7ce039f6391c41c679d126d90a251eee60327c39
Reviewed-by: Ed Cooke <ed.cooke@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit bddf27cd5a5412c8282fab43111e7319874ca44e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-15 17:21:32 +00:00
Volker Hilsheimer
7378c709f5 Examples: fix touch handling in painting examples
On macOS, we don't deliver a press event for the first press on the
track pad (Qt::WA_TouchPadAcceptSingleTouchEvents is not set by default,
so Qt doesn't deliver a single-press on the track pad as a touch event -
that makes some sense or at least maintains compatibility). Because of
that, point 0 is never added to the finger-mapping hash.

When point 0 is then released, we didn't check if we found a valid
iterator for that point ID, and the example crashed.

Fix this by checking that we have a valid iterator before dereferencing,
and by handling Stationary events in the same way as pressed (add the
point to the mapping if it's not already there).

Pick-to: 6.6 6.5
Fixes: QTBUG-110266
Change-Id: I32337b801aaabf9b821a97ddc15ad78747b5e6a2
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 9d8473cdf63537dee65e9c235249b4e4901baa1a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-15 16:30:46 +00:00
Ed Cooke
a00c80e1ce Update the books example
Remove the .ui file and write the equivalent implementation.

Replace the outdated star icons with new star icons. 5 empty stars
are now provided and filled in depending on the rating. The new stars
are SVG, however, we do not use an SvgRenderer as we cannot use the
QtSvg API from QtBase directly. It is safe to assume the SVG image
loading plugin is present, the worst case scenario would be empty icons,
but it would still build. We instead use QIcon.

For the rating, draw the star icons in a combobox, replacing the old spinbox.

Update the layout by moving the table view to the bottom, and
arranging the input fields at the top.

The scrollbar policies have been set to Qt::ScrollBarAsNeeded for the table view.

Fixes: QTBUG-118476
Pick-to: 6.6 6.5
Change-Id: I27c13534ab06e17531d155469a1cc6e7e05197af
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 76b2852b7cff183ba31d6b09b00cbabdffb9ba71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:02 +00:00
Volker Hilsheimer
6c726979f7 Turn the "concentriccircles" example into snippets, update screenshot
The example has a lot of code and documentation, but in essence shows
how to use float-based QPainter APIs and how to set a render hint. That
is two lines of code, which we can show as snippets.

Update the screenshot of the example with a higher-resolution version.

Pick-to: 6.6
Fixes: QTBUG-119983
Change-Id: Iafcb813dff6ab8c269176f7994c95947ebf5e559
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 33254fb41f29b510d3d74dbaab60f0a67ef56d46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:02 +00:00
Audun Sutterud
e978d4046a examples: Update content of "draggabletext"
Qt Quarterly was shut down long ago.

Fixes: QTBUG-119982
Pick-to: 6.6
Change-Id: I910b03ab11bf9aa728cc23d736a6f13902b6fcfe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8d0d520cd313a653226f734ef819021f83e66721)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:28 +00:00
Friedemann Kleint
1c06f86d25 SimpleTreeModel: Polish TreeModel::setupModelData()
- Use QStringView.
- Use a list of a pair-like struct to represent the state instead
  of 2 lists.
- Use qsizetype.
- Use constLast() to avoid detaching.

Pick-to: 6.6
Change-Id: Icc3586451f081f6166fece52675d5379160f51da
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-12-06 18:22:41 +01:00
Friedemann Kleint
a3e20df03d Polish the SimpleTreeModel example
- Fix/silence most clang-tidy/compiler warnings
  * unsigned/int comparison
  * Avoid repeating return / default parameter types
  * Make functions static/use static invocations
  * Use string literals everywhere
  * Use auto * for pointers
  * Streamline code, use ternary operators
  * Move constructor parameters
  * Observe rule of 5 by using Q_DISABLE_COPY_MOVE
- Add some bells && whistles, resize properly, expand all

Complements 25027444a9b53d61a6257dc5f5ce0ffdb3b06f98.

Pick-to: 6.6
Change-Id: I78f48d187981ecabf69a5d4d42715bad026fa9e6
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-12-06 18:22:41 +01:00
Friedemann Kleint
283cdcd3d5 EditableTreeModel: Add a test
Add a test running QAbstractItemModelTester on the model.

Pick-to: 6.6
Change-Id: I40c141c7e754ca05234da611534bd65e456be2fb
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-12-06 18:22:41 +01:00
Friedemann Kleint
d50b56b475 Polish the EditableTreeModel example
- Fix/silence most clang-tidy/compiler warnings
  * unsigned/int comparison
  * Avoid repeating return / default parameter types
  * Use auto * for pointers
  * Streamline code, use ternary operators
  * Move constructor parameters
  * Observe rule of 5 by using Q_DISABLE_COPY_MOVE
- Add some bells && whistles, resize properly, expand all

Change-Id: I1721458ff66dcba123ff3a2cf50e7d15387a4e8b
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-12-06 18:22:41 +01:00
Safiyyah Moosa
11c522495d Docs: Add stereoscopic example to OpenGL examples
This fix uses the \ingroup command to add the stereoscopic example to the
examples-widgets-opengl group.

I also elaborated on the hardware requirements.

Fixes: QTBUG-119280
Pick-to: 6.5 6.6
Change-Id: I6d5b992e533b897d84100f0f897aae97ef89290f
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-12-05 12:37:30 +01:00
Samuel Gaist
fd1405e61b examples: update local fortune example to use transaction
The local version of the fortune server and clients were not using the
transaction paradigm yet. This patches fixes it and makes the example in
line with the network version.

Pick-to: 6.6 6.5
Change-Id: Ieb68f67e2921f46acd682f81dfa5dc5b040c88f5
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-12-04 22:13:26 +01:00
Friedemann Kleint
5134b3ad54 EditableTreeModel: Polish TreeModel::setupModelData()
- Use QStringView.
- Use a list of a pair-like struct to represent the state instead of
  2 lists.
- Use qsizetype.
- Use constLast() to avoid detaching.

Pick-to: 6.6
Change-Id: I5ff8a17a4d583a7d2a0a11a52c29b9117280382c
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-12-04 10:55:01 +01:00
Friedemann Kleint
d9c71b834c SimpleTreeModel: Add a test
Add a test running QAbstractItemModelTester on the model.

Pick-to: 6.6
Change-Id: I6ea5d34308357409b9a13eb0271392c8d171addd
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-12-04 07:38:56 +01:00
Jaishree Vyas
1202594db6 Doc: PainterPaths-Graphic&Multimedia-Example typo in the documentation
Changed the brief and some grammatical errors.

Fixes: QTBUG-119602
Pick-to: 6.6
Change-Id: Ib64abeb735899b0ae1cee64709ad3d7f8f440d9e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-12-01 20:56:10 +01:00
Andreas Eliasson
0201d5e232 Doc: Match descriptive text with code snippet
The code snippet reads QDataStream::Qt_6_5. Change the post-descriptive
text to match this.

Fixes: QTBUG-118907
Pick-to: 6.6 6.5
Change-Id: I3b3d03e9095a6ba6febfb652b3bc7173ed4ccfa4
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-12-01 10:42:41 +01:00
Christian Ehrlicher
fa045a3ce7 SQL/drilldown example: add new icons and misc cleanup
Cleanup the drilldown example:
 - use icons with the current style
 - remove unneeded QOverload<>
 - remove some empty lines which don't look good in the documentation
 - use Q_SLOTS/Q_SIGNALS instead slots/signals

Fixes: QTBUG-113696
Change-Id: I62476a8989c0abd1f424d1425cb05489491e2153
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-23 11:33:28 +01:00
Matthias Rauter
f6e7fdd4ad Refurbish the shaped clock example
The shaped clock example has the appearance of the analog clock, which
was refurbished with 619ec1a6406a8be7bfa9d96b9e693e7a3323d8dc. This
change applies the refurbished design to the shaped clock.

Task: QTBUG-118871

Pick-to: 6.6
Change-Id: Ibcfc8e9fb239a1c6f7ea685f6cab1e50b2060a53
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-17 23:36:38 +01:00
Laszlo Agocs
9f3d6e325f Make contextinfo example a manual test
Change-Id: I9023016d50e82bba1fa73632cc1409b3d016f352
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-11-17 22:27:01 +01:00
Lucie Gérard
4c36bb854c Remove undocumented embedded examples
Task-number: QTBUG-119117
Change-Id: I7fd104742771e2ce6d4ad7afd66e2beca3b4f672
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-11-17 19:39:33 +01:00
Matthias Rauter
619ec1a640 Refurbish the clock example
Fixes: QTBUG-118871
Pick-to: 6.6
Change-Id: I0a1a6444cb381d49adbc39e73d7862c9cfe61dce
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-13 19:14:59 +01:00
Laszlo Agocs
9ee30b1dc2 Fix broken capture in hellovulkancubes example
Amends 339323b999feed077adecc0afaa215f8caffc043

Capturing a function argument (or any local variable)
by address is a bad idea.

Fixes: QTBUG-118912
Fixes: QTBUG-118986
Change-Id: I521d319a37f7acd6c66732f5f7d3cf1be4d49029
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-11-09 18:17:33 +01:00
Kai Köhne
b23a06e039 Doc: Add HTTP Client example also to Web Technologies category
HTTP belongs to Networking, but also fits well with the scope
of Web Technologies - qtnetworkserver is there after all, too.

So just add the example to both.

Pick-to: 6.6 6.6.0
Change-Id: I588e4e0eefc92ba396fbb21d6f55b33f68332a74
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-06 17:59:51 +00:00
Edward Welbourne
1940f0c7be Rework documentation of the serialization converter example
The documentation was previously code-heavy and short on exposition,
while focusing almost entirely on the CBOR converters. Prune most of
the CBOR code quotes, shuffle some snippet markers, add and remove
others and rewrite the main text.

Shift focus to the base-class for converters and how it's used by
main(). Retain relative focus on the CBOR converters, as they are
relatively full-featured hence illustrate more than the others do, and
replace the sequence of single-line sections about the others with a
section collecting all into a table and saying some general things
about them.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I8d41f25c165eb1a7ba20cb68aee6ab6b2fd050f8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-01 21:28:55 +01:00
Edward Welbourne
1022b0d111 Eliminate duplicate overrides of Converter methods in example
The Out-only converters shouldn't need to implement loadFile(), as it
shouldn't be called - a converter is not used for input unless it says
it supports input. At the same time, provide the "ground state"
implementations for optionsHelp(), outputOptions() and probeFile() to
save the trivial implementations the need to duplicate one another.

In the process, make the handling of loadFile()'s outputConverter more
consistent among those that do implement it.  Always set
outputConverter if it's initially null (the caller does assert this).

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I856d12c791d1f8e0accdb7dd1412d493117b2302
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-01 21:28:55 +01:00
Edward Welbourne
8b8fc42f2c Move Converter class, in eponymous example, to a file of its own
There's more details coming and it's good hygiene anyway.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ief3acf6e508bc93eaa8490f6c49300b25c1d3556
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-01 21:28:55 +01:00
Edward Welbourne
d57a78657e Break out the list of available converters to a static method
Mostly to pave the way for moving the class code to a file of its own,
but this incidentally saves the need to std::as_const() every use.
Moving the underlying object to a local static of a private method
also saves the need for heap allocation (which was leaked).

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I30f4bf3c46d39e04d0ac4e3e9ba431945ebb9193
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-11-01 21:28:55 +01:00
Edward Welbourne
0b1670134b Replace confusing member variable with a predicate
The Converter class, in the eponymous example, had a null member
variable that wasn't a nullptr - it pointed to an instance of
NullConverter - so that other converters could test whether a
Converter * they'd been passed was null (in the sense of pointing to a
NullConverter). This, however, was susceptible to misreading - I
misread one such comparison as a nullptr check and thus thought it
redundant with an earlier actual nullptr check. To spare future
readers similar confusion, replace the public static member variable
with a protected (since only other derived classes need it) static
predicate, to at least give the reader a clue that this is using the
word null in a class-specific sense.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I1e4f494b303d1bf90107f8c6fa3a4a22f6d81b90
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-01 21:28:55 +01:00
Edward Welbourne
a9c47dde50 Rename Convert Example to Serialization Converter
The old name didn't say what sort of thing it was converting; and our
guidelines for examples discourage using the word Example in the
title. Also reword the description of the tool in the command-line
parser and an assertion.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I6f52f5227362b4b807c8aabfd2103287af42bca0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-30 18:19:57 +02:00
Edward Welbourne
4e20b852bb Convert fprintf(stderr, ...); exit(EXIT_FAILURE); to qFatal(...)
The serialization conversion example used raw C's way to abort on
error; change to using Qt's way of doing the same. Likewise, convert
the various other uses of fprintf(stderr, ...) to qWarning() and of
printf(...) to qInfo().

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ia8821d3c20f58f71c106028ec422ad473c11e164
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-30 12:43:14 +02:00
Edward Welbourne
b80be2a684 Make Converter::saveFile() consistently error on unexpected options
Have the text dumper do the same as all the others, instead of
ignoring unknown options.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I3c1dcbeda19e679be562110e44c5f566dfcc79ce
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-30 12:43:14 +02:00
Volker Hilsheimer
7c59c5ed13 Examples: remove OpenGL code paths from painting examples
The extra code for using the OpenGL paint engine is significant enough
to be distracting from what the examples are supposed to show. If we
want to show how to use QPainter on an OpenGL widget, then we can make
dedicated and documented examples for that, in the OpenGL category. And
we have such examples in the Qt OpenGL module anyway.

As is, the examples feel more like manual tests of the OpenGL paint
engine; if we need more coverage there, then we can add it there.

Change-Id: I7b56ea6d08c02cd0a1050ab03991656a0538498d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-10-27 16:22:59 +02:00
Volker Hilsheimer
bd5c6fab40 QueuedCustomType example: use QThread::requestInterruption
Drop the home-made solution with mutex and bool (which could have been
an atomic, but we have had a ready-made solution in QThread for a long
time).

Pick-to: 6.5 6.6
Change-Id: Id213a021f0ae94215afb28ff874fcb597dd1e6f9
Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io>
Reviewed-by: Ed Cooke
2023-10-27 07:55:42 +02:00
Volker Hilsheimer
ae39b16345 Convert tooltips example to snippets
The important bits from the example are ~10 lines of code, no need
for building a poor-man's version of a graphics or item view.

Pick-to: 6.6
Change-Id: I7874c66765c5b46230c92846ee3de1ee83f47e45
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-10-27 07:55:34 +02:00
Tor Arne Vestbø
1fd1ffd03d standarddialogs: Don't assume QMessageBox::exec() returns clicked role
When adding custom buttons to a QMessageBox the return value of exec()
as well as result() is not a StandardButton value, but instead an opaque
value, and the documentation says to use clickedButton() to determine
which button was clicked.

Pick-to: 6.6 6.5
Change-Id: Ib47a218989b4dcb5d51f648bc55bc02399bae602
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-10-24 22:30:03 +02:00
Edward Welbourne
32500a76a0 Rename the JSON Save Game Example to Saving a Game to File
Partly because it also saves to CBOR, but also because our guidelines
say to avoid using "Example" in the title.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Id858475a6b0474228cfe8044e188cc763f56e3a8
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-20 11:19:48 +02:00
Edward Welbourne
c78d9bf549 Split VariantOrderedMap out of Converter's header in example
Although used mostly in the same files, they're separate types, so
define them in separate places.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I9e64b382ad48f9a74e432ccd49b6f5fcc9316da3
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-16 22:38:17 +02:00
Edward Welbourne
08ac3ddde7 Remove unused Map alias for VariantOrderedMap in convert example
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ic82f7961df5f7a5bb0cd6cc113e4019508e58f47
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-16 22:38:17 +02:00