Commit Graph

63256 Commits

Author SHA1 Message Date
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
Anton Kudryavtsev
9c819c9073 tools: use const methods more
to avoid implicit detach

Change-Id: I6268d4397631a2a2ff54263dfd0b28a7990c5993
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-08 19:17:36 +03:00
Anton Kudryavtsev
d232acbce0 dialogs: use const methods more
to avoid implicit detach

Change-Id: I2d46696a29f2a454452239e0400af2e2de534cbb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-08 19:17:36 +03:00
Anton Kudryavtsev
9a198e23d9 Tidy up qgraphicsview: use nullptr more
Change-Id: Ie4d2b64175cba12e884260455814774bce8c8787
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-08 19:17:35 +03:00
Anton Kudryavtsev
6327e3679c QGraphicsScene: use const methods more
Avoid unnecessary detach.

Change-Id: I206a7df677119ec309c6c176de881469db057165
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-08 16:17:35 +00:00
Anton Kudryavtsev
d6bd73a343 widgets: use const methods more
to avoid implicit detach

Change-Id: I44b2924decd3c650ece377784f4a73b4e5bbd6c6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-08 19:17:35 +03:00
Anton Kudryavtsev
e312fbc990 qcompleter: avoid implicit detach
by const method usage

Change-Id: Iade97ee80ed9a89915e89b9f17f12b1842c1baab
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-08 19:17:35 +03:00
Anton Kudryavtsev
a9ffdc59a7 testlib: use const methods more
to avoid implicit detach

Change-Id: I8c7de3b7d6a84299714f837da5c9feb39074d0c2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-08 19:17:35 +03:00
Anton Kudryavtsev
8e88797b36 qtls_schannel: avoid implicit detach
by const method usage

Change-Id: I27863d691c228275fc795dfcfbcbcd11e438abc9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-08 19:17:35 +03:00
Anton Kudryavtsev
bf06af559c qxdgdesktopportalfiledialog: avoid implicit detach
by const methods usage

Change-Id: Icbe3e7764ddbb385293c371463d1619d8bd388b6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-08 19:17:34 +03:00
Giuseppe D'Angelo
5e2f22f8a1 QHostInfo::lookupHost: do not violate lookupHostImpl preconditions
lookupHostImpl requires either `receiver` or `slotObj` to be non-null.
Since this code path deals with the string-based slots, `slotObj` is
going to be null, therefore check that `receiver` is non-null.
For completeness: also check that `member` is non-null.

Emit a warning (à la QObject::connect) in case the user did something
wrong.

Change-Id: Ic6dcd51d7ddd977b121484369b1aef48844364c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-08 13:30:36 +02:00
Simo Fält
a2e731e7e2 COIN: Increase timeout for running sbuild for debian packages
Change-Id: Id0b53dece8d4bbf1faa89c1ec409c5d241129779
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 208a587b01)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-08 11:30:36 +00:00
Marc Mutz
de6f405313 QLibraryInfo: fix GCC ubsan build
Same bug that plagues tst_qbytearrayview.cpp, similar fix: drop the
static checks for GCC. Except that here, following code uses the
variable, so it needs to exist. Fortunately, the GCC ubsan bug does
not affect construction from a string literal, so we can use
that. This is losing the position checking for "." in qtConfEntries,
but the the original author (Thiago) informs me that was just a way to
save two bytes, we don't actually need the assertions, so remove them.

As a drive-by, remove the unneeded, and potentially pessimizing
(forces the compiler to allocate storage for it in the binary), static
keyword from the constexpr variable, which should more than make up
for the extra two octets.

Pick-to: 6.6 6.5
Change-Id: I88397ac61c5cd8f53d39e957212c895239aace04
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-08 11:32:44 +02:00
Marc Mutz
defabd265e tst_QFont: fix -Wsign-compare
Amends 17f8e2c441.

Pick-to: 6.6
Change-Id: I896027866c11b5e135c39848cefcf45942f1cf99
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-09-08 11:32:44 +02:00
Marc Mutz
9c63667d01 tst_QHashFunctions: fix std::pair test to use QFETCH_GLOBAL seeds
Because the local `seed` variable shadowed the member one, this test
was run for each QFETCH_GLOBAL with the same data and seed. That
doesn't make sense, so make the test use the member variable `seed`,
as all other tests already do.

Since zero is one of the seeds coming from QFETCH_GLOBAL, drop the
seedless calls to qHash(), too.

Amends 64bfc927b0.

Pick-to: 6.6 6.5 6.2
Change-Id: I1e22ec0b38341264bcf2d5c26146cbbcab6e0749
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-08 11:32:44 +02:00
Marc Mutz
8ca319a172 tst_QHashFunctions: test with actual 64-bit seeds
The old code only tested with seed = 0 and seed = 1045982819, the
latter being a "random number", which, however, fits into
32-bits. Since Qt 6.0 increased the seed from uint to size_t, amend
the test to actually test a seed value with some of the upper half of
bits set, too, also in 64-bit mode.

While we're at it, also test with each seed's bits flipped for extra
coverage.

Remove a static assertion that prevented testing seeds with the MSB
set.

Pick-to: 6.6 6.5 6.2
Change-Id: I5ed6ffb5cabaaead0eb9c01f994d15dcbc622509
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-08 09:32:44 +00:00
Anton Kudryavtsev
003aa16e92 qthreadpool: use const methods more
Change-Id: I16c017e5ff89075aa8faabcc8540d3bd10c80d45
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-09-08 12:32:44 +03:00
Volker Hilsheimer
03d62322b2 QComboBox on macOS: guard against destruction while native popup is open
Since showing the native popup on macOS is blocking and processes events
the QComboBox might get destroyed while the popup is open. Guard against
this by using QPointer and returning early (dismissing the scope guard
that would otherwise reset the menu's parent, writing to freed memory).

The problem is then that the native popup remains visible, as the
destructor of QComboBox calls cleanupNativeCombobox which destroys the
platform menu (i.e. the QCocoaMenu instance), but that doesn't dismiss()
the popup. Add a call to dismiss() to the QCocoaMenu destructor to make
sure that destroying the menu closes it first.

Fixes: QTBUG-116155
Pick-to: 6.6 6.5
Change-Id: If0ac19796603667f4c8e80c302710dc4c9aded50
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-09-08 07:20:10 +02:00
Tor Arne Vestbø
6cf4c5b98f CoreText: Resolve color scheme (dark mode) via the platform theme
We might be drawing glyphs outside the main thread, which triggers
the main thread checker for our access to NSApplication from
qt_mac_applicationIsInDarkMode().

Change the CoreText font engine to pull out this information from
the theme instead, and teach the theme to only updates its color
scheme on the main thread.

Pick-to: 6.6
Change-Id: I02be713d9705c6e0c21107db7f7de039182f601d
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-09-08 07:20:03 +02:00
Tomasz Kozlowski
c8fb928029 Change MaxKeyCount type from enum to static constexpr int
The change was needed because std::fill_n(), which takes it, does not
handle enum type on VxWorks. As it was anonymous with only one member,
it could be changed to static constexpr int.

Task-number: QTBUG-115777
Change-Id: I7cb4d267ad21f6b963d851e30bc91042fbf5c15a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-07 14:36:46 +00:00