Commit Graph

1958 Commits

Author SHA1 Message Date
Tor Arne Vestbø
35063254fd Fix missing references to 'Qt Widgets - Application Example'
Amends eda71105ff

Pick-to: 6.5 6.6
Change-Id: I44fa9acef37667d635d5770ce5d50fc52d92aa88
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-27 17:39:23 +02:00
Tor Arne Vestbø
71f156fff0 Fix qdoc link warnings after moving a few examples to manual tests
Pick-to: 6.5 6.6
Change-Id: I81a6e9d52e858c3f733d4c527c70408772813b56
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-27 17:39:23 +02:00
Tor Arne Vestbø
2a65849e10 Move dock widgets example to manual test
Pick-to: 6.5 6.6
Change-Id: I23ca3f2450df8f6c71509235ccec655d88d0d6d7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-26 23:15:02 +02:00
Tor Arne Vestbø
fc0e82f58a Move dirview example to manual test
Pick-to: 6.5 6.6
Change-Id: I9057d5efb1cdf3e425e879f8cc96a544c1892e77
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-26 23:15:02 +02:00
Tor Arne Vestbø
65e7303ec9 Move digital clock example to manual test
Pick-to: 6.5 6.6
Change-Id: I043c0060a71d9de2f3e74aab0759d07a20880c3a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-26 23:15:02 +02:00
Tor Arne Vestbø
e46fb69a87 Move chart example to manual test
Pick-to: 6.5 6.6
Change-Id: I95a40834853a0157d8fa6137431bfd86ce855b2f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-26 23:15:02 +02:00
Tor Arne Vestbø
3a8265a429 Move character map example to manual test
Pick-to: 6.5 6.6
Change-Id: Ie27fe436fc7ae7774beaa78f8a27f6009027753a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-26 23:15:01 +02:00
Tor Arne Vestbø
288c7ef557 Move calendar example to manual test
Pick-to: 6.5 6.6
Change-Id: Ie2215ae0feeb322888619aed632e20db9b69e20b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-26 23:15:01 +02:00
Tor Arne Vestbø
42b58f8cb4 Move border layout example to manual test
Pick-to: 6.5 6.6
Change-Id: I3f45043a64275f8678288e1d9839271eafa1fd2b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-26 20:47:45 +02:00
Tor Arne Vestbø
6c96218b43 Move qpa examples to manual tests
Pick-to: 6.6 6.5
Change-Id: I7b25b1c8100f04eec3d9a571f59a1babef55b1d5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-26 20:47:45 +02:00
Tor Arne Vestbø
f4a80552c2 Move permissions example to manual test
Pick-to: 6.5 6.6
Change-Id: If7482ff20079d91ddba26a1abcb06b3054cc72ad
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-06-26 18:45:25 +02:00
Amanda Hamblin-Trué
ce39beea0c Revamp Bindable Properties Example
The use of Q_ASSERT(false) is bogus as we don't need to test here, but
want to signal unreachability.
Q_UNREACHABLE_RETURN allows us to tell the compiler that the point
can't be reached while also getting rid of the no return error.

Task-number: QTBUG-114689
Pick-to: 6.6 6.5
Change-Id: I007cd243055237bcc21772a4130a6c1a44fd882d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-06-26 12:16:25 +02:00
Mårten Nordheim
1a9ba8ee7d Network-chat example: Remove unused constant
Change-Id: I29768a38136af026c8613a47adea390f11ff46a9
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-22 16:04:42 +02:00
Mårten Nordheim
0471df7987 Network-chat example: Only disconnect if still connected
If we are already disconnected we end up printing warnings about how it's
illegal to call waitForBytesWritten on an unconnected socket

Change-Id: I8c864d105d5372edfee84affb362cca3021b8ea0
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-22 16:04:42 +02:00
Laszlo Agocs
204c91c971 rhiwindow example: Make -g option (OpenGL) work on macOS
Of course we managed to rely on a GLSL feature that is only
in GLSL 130 and newer, not 120 which is what the default 2.1 OpenGL
contexts support on macOS.

Change-Id: Ib75e750ea15d59e51b2207669068fba7719a48b1
Pick-to: 6.6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-06-21 15:09:03 +02:00
Mikolaj Boc
7022d0e223 Replace QDialog::exec() with open() in text edit example
On WASM, the shortcut triggering the dialog in textedit example
seemingly lets the event invoke the default action. What really happens
is that the dialog's exec() does not return and WASM does not have a
chance to set preventDefault() on the keyboard event it receives. This
masks other problems with keyboards shortcuts.

Uses of exec() on message boxes were replaced, too. Closing operation
is now performed in two steps, first the event is ignored and maybeSave
is called to query for potential changes of the text document.
If there are no changes or the file is discarded, the close continues
with a second event, now accepted.

PrintDialog::exec(), QPrintPreviewDialog::exec(), QFileDialog::exec()
were also eliminated in favor of open().

Finally, indirect calls to exec() via QColorDialog::getColor were
removed.

Task-number: QTBUG-76587
Change-Id: Ia90fad46ec3f94244723512be3ec93b64df9d9ef
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-06-20 07:28:42 +01:00
Tor Arne Vestbø
14f31bf16e Add missing QApplication include in streambookmarks example
Amends 3ccf2f8308.

Pick-to: 6.5 6.6
Change-Id: Ib51777ef9af44aff7fbb813b58eb0fbb74761373
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-17 14:02:04 +02:00
Edward Welbourne
3ccf2f8308 Examples: "About &Qt" should show info about Qt, not quit
A few examples seem to have copied and pasted a help action "About
&Qt" that triggered QCoreApplication::quit. This does not look like
best practice. Use QApplication::aboutQt instead.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I1887a3c999d752a24c7c4d3cabc4a5d63b29b966
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-06-16 21:37:11 +02:00
Edward Welbourne
59d2869765 Core examples: consistent #include order
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I014a895a8abeccc9d17b68fb67c00cea22957fed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-06-16 21:37:11 +02:00
Friedemann Kleint
408fbd3f2d QMessageBox: Remove include of qdebug.h
Move the implementation qRequireVersion() to prevent having
to include qdebug.h which pulls in many other headers.

Amends b5d874e36f.

Fix missing include introduced by
3a553507a1.

Pick-to: 6.6
Task-number: QTBUG-114214
Task-number: QTBUG-97601
Change-Id: Iba68ffca95061666d9458ffa5700d07c7669da5b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-16 19:42:12 +02:00
Topi Reinio
ebc371de0d Doc: RSS listing example: Fix file quoting
The example was moved to qtnetwork but its documentation
still referred to old paths under /examples/corelib.

Add documentation dependency to qtwidgets as RSS listing
example's docs link to a number of widget classes.

Pick-to: 6.6 6.5
Change-Id: Ief1c9dc2ca38ba3da1fe3039500292147ec4cc7d
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-06-15 11:34:17 +00:00
Edward Welbourne
e54a7c5667 Move RSS listing example to networking
It's really showing how to request a resource and act on its becoming
available. The use of XML to do so is incidental; the use of
networking is central.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ibcf438c7ef3b2464ddfa8b96a79fb15523e4a468
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-06-14 11:57:31 +02:00
Edward Welbourne
4b6986db32 Do XBEL example's last !QT_NO_... -> QT_CONFIG()
Amends commit 723e331f0a

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ib9a094ab432a80b8b2dbbbecb497dca13d23a553
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-06-14 11:57:13 +02:00
Friedemann Kleint
3a553507a1 Brush up the DOM bookmarks example
- Use modern string literals (use QStringLiteral instead of
  QLatin1StringView for strings that go into the DOM API).
- Use mime types in the file dialog handling
- Streamline code
- Remove mentions of SAX
- Use per class includes
- Do not use QObject::tr()
- Use the configure system instead of QT_NO... defines
- Fix some doc text typos

Complements 3dd3268ded.

Pick-to: 6.6 6.5
Task-number: QTBUG-111974
Change-Id: If0dc7b61e729d0a71f37743efc9b82e285d3f451
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-06-13 01:51:10 +02:00
Friedemann Kleint
723e331f0a XBEL stream reader: Brush up
- Use mime types in the file dialog handling
- Use per class includes
- Use the configure system instead of QT_NO... defines

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Iea915604e89d3005270f0eb83eca882855589a44
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-06-13 01:51:10 +02:00
Volker Hilsheimer
b908c5cf28 Move scroller/graphicsview example into tests/manual
The example seems incomplete, is undocumented (and unused in shippets,
in spite of tags being present), and generally full of comments that
give the impression that this is for manual testing rather than showing
best practices.

Pick-to: 6.5 6.6
Change-Id: Ie615420e493cc6bb461c5d9ff8d4ae82bb3591db
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-12 21:22:36 +02:00
Volker Hilsheimer
a89f575be3 Move storageview example into tests/manual
The code is mostly an implementation of a model based on QStorageInfo,
shown in an otherwise uninteresting tree view.

Pick-to: 6.5 6.6
Change-Id: Id6ce70d71ddc9bcd6e82a9ee12f5e1af159eac7a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-12 21:22:36 +02:00
Volker Hilsheimer
ce13dc8c2f Remove flattreeview example
The relevant bits are a two-line snippet.

Pick-to: 6.6 6.5
Change-Id: Id1731e5bc6585b1d1fd684817b39d19ad0a8a9cc
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-12 21:22:36 +02:00
Edward Welbourne
97f68cd306 XBEL examples: construct the text of the separators cleanly
Create the fixed string once and reuse it. Also give a name to the
escape code that's its repeated character.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I3d6416070f1d5490ec137e251daff0e1637fb788
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-06-12 15:46:14 +02:00
Edward Welbourne
b610c7aa89 XBEL stream reader: shuffle order of functions
Put readBookmark() first of the constituent parts, as it's the most
intelligible (albeit currently undocumented) and gives some clue to
the purpose of readTitle(), which is next.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I91d3d6bf8adc3f3001c90274bb62a9da6bf05362
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-06-12 15:46:14 +02:00
Oliver Eftevaag
fc9aae544b Dialogs example: add checkbox for ColorDialogOption::NoEyeDropperButton
If we wish to introduce a new color dialog option, then we might as well
use it in our example.

Change-Id: I7771d9d50e2ab0489fbeece8dea38a0b72b9b21e
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-12 15:11:26 +02:00
Topi Reinio
17ddf2a6a5 Doc: Fix documentation issues
The Qt Widgets Application example was moved to manual tests,
and no longer contains the snippet identifiers. Fix \snippet
and \quotefile commands to quote similar code snippets from
other examples or snippet files.

Fix also the following documentation warnings:

* No such parameter 'parsingMode' in QUrl::fromEncoded()
* Missing image: rsslisting.cpp

Pick-to: 6.6 6.5
Change-Id: Ibc989e83abc49837db08628facaf8e5f72b2f123
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-06-09 18:24:15 +00:00
Edward Welbourne
8e1b60b331 There is no frank.xbel so don't tell qmake to find it
Both the DOM and XML stream versions of the XBEL bookmarks example had
a frank.xbel in their EXAMPLE_FILES, but there is no such file. So
asking qmake to include it is spurious.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Iec08042d181fc09c2c428685ce841a13161ab273
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-09 14:05:06 +02:00
Edward Welbourne
202b1dca5d XBEL example - modernize strings: use "..."_L1 for literals
The XML stream reader and writer accept QAnyStringView arguments these
days, so passing a QLatin1StringView is entirely sufficient. This
makes static functions to provide access to unique QString instances
redundant. Linkers are allowed to uniquify the literals the "..."_L1
reference.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I7f37e97631e11683b9ddd3842fc6233547bed5ff
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-06-09 14:05:06 +02:00
Edward Welbourne
5fd4a65d95 XBEL example: minor simplifications
Pass one function's return as a parameter to another directly.
Use a ternary expression rather than conditional initialization.

Use initializer-list construction instead of appending to an empty
QStringList; and inline the result where it's used.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I781aedba8dcc4251193b55d82fe684c9b5da241a
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-06-09 14:05:06 +02:00
Edward Welbourne
705e4e63c6 XBEL example: Fix null dereference bug
As readXBEL() does call readSeparator(nullptr), the latter should cope
with being passed nullptr as item.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I786e4438b566438448b5d54ff6442c27f1255aa8
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-06-09 14:05:06 +02:00
Edward Welbourne
4d8dddd699 XBEL example: use nullptr rather than 0 for null pointers
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I7cb95ab6f84854d36a949d1ce667cb80a9c626be
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-06-09 14:05:06 +02:00
Kai Köhne
eed17b3634 Examples: Remove unnecessary Q_INIT_RESOURCE calls
Explicit calls to Q_INIT_RESOURCE are only needed for
resources embedded in static libraries. See also

  https://doc.qt.io/qt-6/resources.html#explicit-loading-and-unloading-of-embedded-resources

Pick-to: 6.5 6.6
Change-Id: I06a24d1c04369eedc78ca60a6ca02ce33907d9e7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-06-08 16:15:02 +00:00
Edward Welbourne
3ab7b7e230 Fix deprecation warnings agains u"..."_qs in dnslookup.cpp
Pick-to: 6.5 6.6
Change-Id: I29a177c7d46304c5b494218f5862195eb92c7684
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-06-07 10:26:04 +02:00
Tor Arne Vestbø
a3dde7c93e Move widgets blurpicker example to manual test
Change-Id: I7e19b84ac4b6a8e380fc9a7dcc37cc08ced89b4b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-05 19:13:33 +02:00
Axel Spoerl
eda71105ff Move widgets Application example to manual tests
With 6e77da640aa84c1efe330d4a5224c9c7425ece57, the documentviewer
demo's TxtViewer plugin has been fully documented in order to replace
the Application example.

This patch moves the application example to manual tests.

Pick-to: 6.5
Change-Id: I67d975e478c7bc840613c8af1301a4eafe8f1a42
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-04 01:18:19 +02:00
Laszlo Agocs
da4de6b6e3 Polish forward decl in vulkan and opengl examples
Pick-to: 6.5
Change-Id: I9f05aedc7649ab7e248b7332c04a6664e85182d8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-06-01 09:09:49 +02:00
Mårten Nordheim
0925a98ec3 Network chat: Update example meta info
Task-number: QTBUG-108873
Change-Id: I46a412beb406cf66daf552adbef165dc246dadc2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-05-31 12:56:01 +02:00
Mårten Nordheim
f3d2e2f555 Network chat: style fixes
The if statements were originally broken to fit 80-column width
but didn't have the braces we typically require.
It anyway fits inside our new 100-column width, so just do that.

Task-number: QTBUG-108873
Change-Id: Ib632f35607e6b716141c4c5d8211de7a0745c6ab
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-31 12:56:00 +02:00
Mårten Nordheim
e33bbdb0ea Network chat: simplify lookup function
Task-number: QTBUG-108873
Change-Id: I3ca0c976236003c708130ed120dba14cfbbf8185
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-31 12:55:59 +02:00
Mårten Nordheim
804b26b77d Network chat: when removing an entry in multihash, specify which one
Using only the key means all clients with that IP address are removed.
But there could be multiple clients running on the same multi-user
system.
So, use the value as well to remove just the specific one.

This also fixes a bug where, when a client disconnects, all of the
connections are removed from the client's map, but only _one_ is removed
from the GUI.

Task-number: QTBUG-108873
Change-Id: I87da862e8f337fd9c246ff5a2d243e514076fa5f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-05-31 12:55:58 +02:00
Mårten Nordheim
6eac22e2ca Network chat: avoid double lookups into hash
Task-number: QTBUG-108873
Change-Id: Iafa5a7a1ec99d2414f175f2d30fe03a90c6716f3
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-31 12:55:57 +02:00
Mårten Nordheim
9db22a63a9 Network chat: Use QStringBuilder
It is a best practice after all

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

Task-number: QTBUG-108873
Change-Id: I8125ffd63cd0ad1970575fb1a6b85021c03c38d5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-05-31 12:55:54 +02:00