Commit Graph

63275 Commits

Author SHA1 Message Date
Rym Bouabid
36c2a9c514 Revamp Mandelbrot example: Fix too long lines
Fix code lines that do not respect the 100 characters limit rule.

Task-number: QTBUG-108861
Pick-to: 6.6 6.5
Change-Id: Idbc148b77b52a359d972233c977bbf2ccf9fcd24
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-11 15:05:47 +02:00
Rym Bouabid
ae0d545d31 Revamp Mandelbrot example: Use a Literal operator to create QString
Create QString at compile time using the literal operator""s instead of
using pointers to characters. This way, no conversion or allocation will
occur at runtime.

Task-number: QTBUG-108861
Pick-to: 6.6 6.5
Change-Id: I4fb51d74abbbfa08fb9fddfa90d8afcebd82a7e2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-11 15:05:47 +02:00
Rym Bouabid
a4d7a4ccb3 Revamp Mandelbrot example: Fix Includes
Reorder the includes following the coding conventions.

Remove unneeded includes.

Add needed includes to avoid Transitive includes.

QGestureEvent is passed by a pointer in the gestureEvent method in
mandelbrotwidget.h. So, we do not really need to include the header.
Instead, forward-declare QGestureEvent class in a namespace.

Task-number: QTBUG-108861
Pick-to: 6.6 6.5
Change-Id: I48cfd663bf98350281ef7f31e6c0ef3e301a08ca
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-11 15:05:47 +02:00
Alexey Edelev
7a70c6fcfd Require the C++17 standard for configure-time syncqt
Require the C++17 standard, but not what is set by Qt for syncqt,
to avoid unwanted standard check in some corner cases.

Pick-to: 6.5 6.6
Task-number: QTBUG-116789
Change-Id: I34e07e172e31d5ffc69b84dd3ef30f02f6e75a9d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-09-11 15:05:47 +02:00
Alexey Edelev
9d11e50190 Add variable linked to configure-time executables to detect CMakeCache wiping
Wiping of CMakeCache should lead to removing of CMakeCache that is
generated for configure-time executable. Otherwise configure-time
executables might still use wrong compiler or compiler flags.

Pick-to: 6.6 6.5
Task-number: QTBUG-116789
Change-Id: I702d5d29e0c5f35a8a36311cf9a84ea7a0f4d781
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-09-11 15:05:47 +02:00
Nicholas Bennett
a9c63e826c Docs: Add macros for common Qt products
Added macros for Qt for Android Automotive, Qt Online Installer, and
Qt Maintenance Tool.

Task-number: QTBUG-116562
Pick-to: 6.2 6.5 6.6
Change-Id: I0ef3bc0fd6b1ddf94c8be2feed7cf5e691c4776f
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Esa Törmänen <esa.tormanen@qt.io>
Reviewed-by: Mats Honkamaa <mats.honkamaa@qt.io>
2023-09-11 07:44:37 +00:00
Lorn Potter
eda0ccb36b wasm: send key release for touchscreen input
Fixes: QTBUG-114203
Pick-to: 6.6 6.5
Change-Id: I117ce857484520167d0c0166280dd604c139ff03
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-09-11 08:45:49 +10:00
Ievgenii Meshcheriakov
087d267a44 QDBusConnectionPrivate: Remove declaration of messageFilter()
The function is declared but never defined.

Change-Id: Ic9c4369ecaee3103b74d2dc9b84cbece99379603
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-11 00:32:40 +02:00
Ievgenii Meshcheriakov
fa78a9f5bd QtDBus: Remove uses of Q_UNUSED on used variables
This also includes variables only used in Q_ASSERT, those
don't generate warnings anymore even when asserts are disabled.

Change-Id: Ia557120d442c100c9437b106a01a4079d48640af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-11 00:32:40 +02:00
Ievgenii Meshcheriakov
dad421222c QDBus: Use type-safe object tree node flags
Change-Id: I7078b11d19d7a6444a020e0d400efbaea22f84a8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-11 00:32:40 +02:00
Ievgenii Meshcheriakov
588700dbfa QDBusSlotCache: Include flags into the hash key
This removes the need for doing two separate iteration to find
entries in the hash. Also QMultyHash can now be replaced by
plain QHash.

Change-Id: Ie704e74c1dbb0c8e40d22a7cd572fcc8a3bfcd5d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-11 00:32:40 +02:00
Kai Köhne
9aaeb1bb3d Doc: Remove see also self-reference in QFileInfo
Pick-to: 6.6
Change-Id: I83f42f85e838c953b19dbcbb8d656408ed148934
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-10 20:22:37 +02:00
Kai Köhne
7c5e64eb0a Doc: Mark QEvent::DevicePixelRatioChange as new in 6.6
Fixes: QTBUG-116872
Pick-to: 6.6
Change-Id: I5094a0c0f3deed1e4f6b59e577367c220be8774e
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2023-09-10 20:22:15 +02:00
Kai Köhne
ef748095fe Doc: Add documentation for added QNativeIpcKey overload
Document new implicit constructor introduced in the commit 08605f0d78

Pick-to: 6.6
Fixes: QTBUG-116870
Change-Id: I518f0a043d7738698ae568ce0b51db3f2c28574f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2023-09-10 20:22:07 +02:00
Ahmad Samir
74098981bd QDataStream: clarify QDataStream::operator>>(char *&s) API docs
The wording was slightly ambiguous giving readers the idea that it will
scan for a \0 terminator in the data; however what actually happens is
that readBytes() gets the length of the string from a quint32 in the
stream right before the data, and readBytes() always adds a
null-terminator.

Fixes: QTBUG-3287
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ie22500a9c191ffd590a6b57babeb67577c24dddb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-10 17:50:11 +03:00
Ahmad Samir
1849489315 QFSFileEngine: fix logic
Inside the do-while loop the if body is executed if `eof` is true, which
means the continue statement is redundant because the while loop
condition contains `!eof`, so the do-while body doesn't get executed
again after that.

Change-Id: If0685eb482f29b88e9c8660886392483a3bd75ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-10 15:15:09 +03:00
Ahmad Samir
3fbcf53828 QElapsedTimer: document Duration and TimePoint typedefs
Fixes: QTBUG-116876
Pick-to: 6.6
Change-Id: I71215d9f9e3caf0c50635a86c65c94a6f097cbe0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-10 15:15:00 +03:00
Ahmad Samir
b0a3cfaf53 QStringList: optimize replaceInStrings
By first checking if the list has any matches before potentially making
it detach.

Change-Id: I7a42c2910ef6efc45033e562573414a3a9ef972e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-10 15:14:50 +03:00
Ahmad Samir
f7ecad0264 QStringList: replace index-based loops with range-for
Use a lambda instead of a struct with operator(), it's only used in one
place and a lambda is more optimizable.

Change-Id: If3917f4819a7c886a08ad1396d92fcbcf606cbcb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-10 15:14:17 +03:00
Ahmad Samir
ada0e8be5d QStringList: test indexOf/lastIndexOf(QRegularExpression) overloads
Change-Id: I8c62b0d36628c2a1519667cc553f3ec33b964dfc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-10 15:13:05 +03:00
Anton Kudryavtsev
567bbbb3e9 qdataurl: extract string literals
to reuse size() to avoid magic numbers

Change-Id: Id1dc69a024ce5597c2d1468e7cb1470df728d84c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-10 12:02:42 +03:00
Anton Kudryavtsev
bb5e3b56db QTextHtmlParser::lookupElement: port to QSV
Change-Id: I7d45d1a8985b57457eaa8226332929b6a1817108
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-10 12:02:34 +03:00
Thiago Macieira
b24630ce02 QLogging: attempt to free memory in qt_message() before abort()
Just so memory leak checkers won't complain.

Pick-to: 6.6
Change-Id: I2b24e1d3cad44897906efffd177fb9ddf0eb0a2a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-09 11:55:41 -07:00
Thiago Macieira
62b53011d3 QNetworkInterface: replace CMake check for ifr_index with SFINAE
Detecting if a member exists is very easy and saves us from running the
test at CMake time. Saves about 350 ms.

Change-Id: I2b24e1d3cad44897906efffd178007fdcdd18e37
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-09 11:55:41 -07:00
Thiago Macieira
88e9ce201b QLogging: deduplicate calling of isFatal()/qt_message_fatal()
Just roll everything up into qt_message().

Pick-to: 6.6
Change-Id: I2b24e1d3cad44897906efffd177fb9867131b795
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-09-09 11:55:41 -07:00
Thiago Macieira
3bdb5e9cc9 QElfParser: handle the case of PN_XNUM program headers
This is an extension point when you have more than 65535 program
headers. Hopefully no one has that many.

Change-Id: Ifbf974a4d10745b099b1fffd177710fae9c31b97
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-09 11:55:41 -07:00
Anton Kudryavtsev
de6d322174 qsocks5socketengine: avoid impicit detach
by const method usage

Change-Id: I0ff04508917a728acec282920df02c667a29e597
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-09 17:14:46 +03:00
Anton Kudryavtsev
abef00138f qiosclipboard: use const methods more
to avoid imlicit detach. While touching code, add reserve usage

Change-Id: I9dcd916f2210537c3f1d695e3e68b53da735d978
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-09 17:14:43 +03:00
Anton Kudryavtsev
6a1a11879d qcocoadrag: use rvalue overload more
to reuse internal buffer

Change-Id: Iab24bf8ff40edc1b64227ab6dbdff02f926b1008
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-09-09 17:14:40 +03:00
Anton Kudryavtsev
f5478b8a63 cocoa: use const method more
to avoid implicit detach

Change-Id: Ifeea193639f357cc53f8af884ae868a18149fbc8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-09 17:14:38 +03:00
Anton Kudryavtsev
87b5d85641 QAndroidPlatformFileDialogHelper: use const methods more
to avoid implicit detach

Change-Id: I5dd37469011ddb0df8c6935deb102098f09a2a45
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-09 17:14:36 +03:00
Anton Kudryavtsev
2c67774f99 gui/text: use const methods more
to avoid implicit detach

Change-Id: I2c6edfcf8b9dc6e9bb0801b7bd58f34a8033a955
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-09 17:14:33 +03:00
Anton Kudryavtsev
14505ca278 gui: use const methods more
to avoid implicit detach

Change-Id: I2c7ae56e0866941e0f0b040129bfc40a9a961f3c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-09 17:14:30 +03:00
Anton Kudryavtsev
2c1fdad76c qcommandlineparser: use const method more
to avoid implicit detach

Change-Id: If01c2d777ceb61e9f919ff0109d054bb7e74a418
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-09 17:14:25 +03:00
Volker Hilsheimer
a7b50c40a0 macOS file dialog refactor: don't heap allocate string and string list
We always allocated them in the constructor function, and never tested
them for nullptr, so just manage them as regular members.

As a drive-by, apply const to read-only variables in relevant code.

Pick-to: 6.6
Change-Id: If0a3ac8982582f2adf5187a3c0357f4da93467fb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-09-08 23:41:15 +02:00
Giuseppe D'Angelo
2f945aaa26 QProcess: remove a XFAIL for QNX
91dcc76fc1 might have fixed the underlying issue, so we no longer
need the XFAIL codepath at all.

Fixes: QTBUG-114720
Change-Id: I67ccbed67a0536b679c50c26eb0b3e51c93dceeb
Pick-to: 6.6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-08 19:00:49 +02:00
Tor Arne Vestbø
e9a1c53214 Add note to QMessageBox::button() about modifying returned button
We don't have a good way to detect whether the button is modified or
not, to bail out of using the native dialog helpers.

Document that this API shouldn't be used to modify the standard
buttons (they are standard after all), and recommend the explicit
APIs for adding custom buttons instead.

Pick-to: 6.6
Fixes: QTBUG-112525
Change-Id: I38c8ef5e1717a85f0db59c9e705d0775982ffb57
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-08 19:00:49 +02:00
Tor Arne Vestbø
a7bfe58989 doc: Fix links to QMesssageBox::Option::DontUseNativeDialog
Pick-to: 6.6
Change-Id: Icb6f28bb17ade242f6ef5dcc4ea65611a6abe9f0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-08 19:00:49 +02:00
Tor Arne Vestbø
17dc1e2152 Rework QIcon theme documentation
Generalized the documentation, and clarified behaviors,
in preparation for adding additional platform icon engines.

Pick-to: 6.6
Change-Id: I4a694dc2cedd08cb195c738048c7dae72cbfe867
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-08 19:00:49 +02:00
Assam Boudjelthia
c76918eca2 CMake:Android: Add jar files to a ${target}JarSources
For better integrations with Qt Creator, add a custom target with
the Jar files so they are shown under the project files. Since
source_group() is not supported, add_custom_target() is used.

Pick-to: 6.6 6.5
Change-Id: Ie527fdce918d526ee6e8953e27d4e0f4131a9828
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-09-08 16:48:33 +00:00
Fredrik Ålund
d21003fc48 Add macOS support for the Mimer SQL QtSql plugin
Make sure the Mimer SQL include files and libraries are found
to enable the Mimer SQL QtSql plugin.

Fixes: QTBUG-111219
Pick-to: 6.6
Change-Id: Ieee0e26f3689dd373fda81c98180066927d25b40
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-08 18:48:33 +02:00
Edward Welbourne
e53d0220da Turn Directions enum into an enum class in serialization converter
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ie1f8ea5e2575427528c19875db7a8e4e27200aec
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-08 18:17:37 +02:00
Edward Welbourne
ad63118071 Turn Converter::Direction into a QFlags enum
This lets us testFlag() instead of using raw bit-field operations.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I2c26e9a24728e81baa42cf14c75271a015460913
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-08 18:17:37 +02:00
Edward Welbourne
77fdd21cbf Serialization converter example: const-ify the Converter type
Its methods act on their parameters without changing the converter, so
can all be const. Its instances thus have no non-const members to
exercise, so can always be const.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ifcdb2f2159c2cfcd7998dd118aa327a32d299ccf
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-09-08 18:17:37 +02:00
Edward Welbourne
eaebb5c4d2 Separate streaming dumper and converter in the convert example
The two were in the same files but mostly unrelated to one another -
aside from the converter defaulting to the dumper for output.
Furthermore, the dumper actually uses QDebug and QTextStream, not
QDataStream; rename it to reflect this reality.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Id65c120c319b555039f7fd186ed262f35ff5260a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-08 18:17:37 +02:00
Edward Welbourne
d8517fb1ab corelib/serialization examples: clang-tidy and coding style clean-up
I overrode clang-tidy where it uglified or obfuscated and did some
clean-up provoked or made possible by its changes. Konrad pointed out,
in review, a constructor that could be = default; it could, in fact,
vanish entirely as a result.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I9b7744a3abaa29e6f9e0689d0f6985bfd88cd0fd
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-09-08 18:17:37 +02:00
Edward Welbourne
319b2e0e86 corelib/serialization examples: use string literals more
A couple more compilation units could use Qt::StringLiterals. Prefer
QL1SV for the code constants, to keep code small. Convert fpToString()
to take QL1SV instead of const char *, with suffix empty by default.
Also rearranged some spacing, some if it suggested by clang-tidy.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I03d810d52afcd4a760d18f2553914b75af716b74
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-09-08 18:17:36 +02:00
Mårten Nordheim
e4d545b4c6 QWindow: Fix error for unused capture
Amends 89ce65c2d0

Pick-to: 6.6
Change-Id: Ifddf6b2e849929137d1db8f777a7cb9fa3cd2038
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-09-08 18:17:36 +02:00
Ahmad Samir
09b852b1d8 examples/: compile with QT_NO_CONTEXTLESS_CONNECT
Examples are usually a good way to get to know a new codebase, do not
teach developers who are new to Qt about the 3-arg connect() to begin
with.

Drive-by changes:
- `this` can't be implicitly captured with [=] in a lambda, instead
  capture by reference
- Update docs related to the sqlbrowser example; the overloaded signal
  it mentions has been removed in Qt6
- In the sqlbrowser example, rename addConnection() (no-arg) overload to
  openNewConnectionDialog, suggested in code review

Change-Id: I30c9f35bda4ac2f460d767ab7f84422ae3ed09f7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-08 19:17:36 +03:00
Christian Ehrlicher
9016def4dc tst_QAbstractItemModelTester: fix unittest
rowsAboutToBeMoved() and rowsMoved() signals aren't emitted for
QSortFilterProxyModel, which meant the two connections in the
ObservingObject's constructor didn't trigger the slots, which let the
test pass (the store/checkPersistentFailureCount stayed at 0).

- Instead connect to layoutAboutToBeChanged() and layoutChanged()
  respectively, these two are emitted for QSFPM
- Use PMF syntax
- Verify m_persistent{Proxy,Source}Indexes aren't empty

Change-Id: I8b83989de02c2bfb22bde9b230cb5b68814f74b6
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-09-08 19:17:36 +03:00