Commit Graph

46990 Commits

Author SHA1 Message Date
Tor Arne Vestbø
d5c867ee29 Implement XCB key mapper in terms of QPlatformKeyMapper
Change-Id: I81af1200b7b1113062d66a76a185a6d15eab0ba9
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-09 19:24:07 +02:00
Friedemann Kleint
1ffe7fbff0 Fix documentation of QMetaClassInfo
Mention the modules using it instead of claiming it is not used
in Qt.

Pick-to: 6.6 6.5
Change-Id: I8c9490dfd89444509961c73eeff2f8584e0c5df4
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-10-09 17:24:04 +02:00
Antti Määttä
0bbb2f6981 Fix CTF with namespace build
Include moc must be outside the namespace.

Pick-to: 6.6 6.5
Change-Id: Ibdd539b5fdd8ab4aeb0019bcbb62d5702c310065
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-10-09 18:24:04 +03:00
Mårten Nordheim
0fa4af060e QTemporaryFile: Add support for std::filesystem::path
Since it hides QFile's overloads this was not supported for
QTemporaryFile.

[ChangeLog][QtCore][QTemporaryFile] Added support for passing
std::filesystem::path to rename and createNativeFile.

Change-Id: I909ff1d5b9c586824c9901d7dad278dfad09ffc3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-09 16:25:57 +02:00
Tor Arne Vestbø
7d663d2e08 Guard QWindowsContext::instance() during screen change on shutdown
Destructing the QWindowsScreenManager might result in a
WM_DISPLAYCHANGE, at which point our QWindowsContext instance
is likely gone. We need to guard against that.

Fixes: QTBUG-117473
Pick-to: 6.6 6.5
Change-Id: If32941c5c11231f7c27e9dde54f4315f18da1100
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
2023-10-09 15:25:54 +02:00
Tor Arne Vestbø
ab99cf6077 QKeySequence::toString(): Treat Modifier+Qt::Key_Unknown as empty string
We were already doing this for a key combination without modifiers,
but now we do the same for e.g. Control+Unknown. This matches the
behavior we have for QKeySequencePrivate::decodeString(), where
we return Qt::Key_Unknown if we can't resolve the key, even if
we have resolved some valid modifiers, e.g. "Meta+Trolls" as in
the tst_QKeySequence::parseString() test.

Change-Id: I238e29276e6ce356ae60c67585739587fa388f07
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-09 15:25:54 +02:00
Tor Arne Vestbø
e4994ccfe0 Teach QKeySequencePrivate about QKeyCombination
Being explicit about whether we're dealing with QKeyCombination or
a plain Qt::Key helps understand the code.

Keys are still stored as ints though.

Change-Id: I2cb7bf2c5fabcecbd4dd3e99ba6240fb1910dcc7
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-09 15:25:54 +02:00
Tor Arne Vestbø
8850e86981 QKeySequence: Remove unused private helper methods
The functionality is available in QKeySequencepPrivate still, if needed.

Change-Id: Iefa2e5b31a550fd2a419d2aee028ce4c1ddfb7a2
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-09 15:25:54 +02:00
Kai Köhne
6e33e3e899 Doc: Highlight some examples for 'User Interface Components' category
Task-number: QTBUG-117243
Pick-to: 6.5 6.6 6.6.0
Change-Id: Ie8e7a07e7bbfd5037ccf6a6477f801ea9ed9e3c4
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-10-09 13:26:17 +02:00
Kai Köhne
bb781bdb2d Doc: Highlight some examples for the "Graphics & Multimedia" category
Task-number: QTBUG-117211
Pick-to: 6.5 6.6 6.6.0
Change-Id: I9ebe20719ad96b0d9ced40745eb6ee09d3e6fb40
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-10-09 11:26:17 +00:00
Kai Köhne
1b5402d229 Doc: Fix link to renamed setIncludesSubDomains() method
Fix capitalization of setIncludesSubDomains(). While a it,
make the links explicit, so that qdoc generates warnings if they fail.

Pick-to: 6.5 6.6
Change-Id: I74542c288083ec58f866a616da32bd40fcb3f40a
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-09 12:32:59 +02:00
Yuhang Zhao
d9820b0207 cmake: un-special case clang-cl for runtimeobject
clang-cl can correctly handle runtimeobject.lib for quite some time
already, no need to special case for it anymore.

Change-Id: I87aa98134ad847808b3129c5629ccf8fa1dce253
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-09 13:48:01 +08:00
Ahmad Samir
5522e33128 QMenuBar: compile with QT_NO_FOREACH
The loop doesn't change the member container while iterating over it,
but handleReparent() is called from eventFilter() and changeEvent(), so
take a copy to iterate over.

Task-number: QTBUG-115803
Change-Id: I58ff5bddf99f07a46348b7802432e0899b3170df
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-10-08 17:55:01 +03:00
Ahmad Samir
641bccce2a QGraphicsAnchorLayout: compile with QT_NO_FOREACH
The m_edges container isn't changed after it's initialized in the
constructor (in a later commit I'll make this container const, so as to
keep this commit backport-able), and it isn't changed by the loop. Port
all loops over m_edges to ranged-for.

Remove "#undef QT_NO_FOREACH" from the source file, as that was the only
usage of foreach in it. And remove that source file from NO_PCH_SOURCES.

Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: I9cfc0c95865cbc7415dbecc82388c64c65ded4be
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-10-08 17:54:54 +03:00
Anton Kudryavtsev
4f1bb8ee40 platform plugins: use string view types more
Change-Id: I793cfff1afca6b98a672615e33a19f8210e429dd
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-08 11:38:41 +03:00
Ahmad Samir
b358672556 QLocalSocket: port to QDeadlineTimer
Easier logic for such use-cases.

Change-Id: I4ce14bbaeda5441294f33993195396d9f47710dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-07 21:07:06 +03:00
Ahmad Samir
6ecf43120f QHttpSocketEngine: de-duplicate some code
Change-Id: I4699e3ea0d4687a9772f6f90e6033f5582c1a346
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-07 21:07:06 +03:00
Ahmad Samir
738a5ad4f2 QDateTime: de-duplicate some code
Change-Id: I1c842029c2b597f97418b49c894127ab43dafbf7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-07 17:59:17 +03:00
Volker Krause
d25438ebbd Search extra library paths for Android dependency XML files as well
This fixes a regression compared to Qt5. In Qt5 absoluteFilePath()
unconditionally searched for all files in extra prefix dirs and the Qt
install prefix, in particular also the -android-dependencies.xml files.

After the changes in Qt6 up to now however those files are only searched
in the Qt install prefix. This broke external libraries also making
use of the -android-dependencies.xml mechanism, such as some KDE
frameworks.

Pick-to: 6.5 6.6
Change-Id: Ic53aab50c70f853f3b1d621d6de6edb3df223905
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-10-07 09:44:00 +00:00
Thiago Macieira
61d99530c8 moveToTrash/Unix: avoid QFileInfo to get an absolute file name
We know what engine we're using, so don't go the long way around via
QFileInfo and QFSFileEngine to get back to QFileSystemEngine in order to
calculate an absolute and clean path.

Since we're doing that, we may as well use QFileSystemEntry's ability to
give us the file name portion of this absolute path without having to go
via QFileInfo and QDir again. We just need to make sure that a dir name
isn't ending in a slash: absoluteName() would remove that for us, but
only if the entry isn't already absolute and clean.

Change-Id: I9d43e5b91eb142d6945cfffd17871389d359e750
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-06 18:43:30 -07:00
Thiago Macieira
fa97531952 moveToTrash/Unix: reorganize the #ifdef
Change-Id: I9d43e5b91eb142d6945cfffd178708f58b71e7ef
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-06 18:43:29 -07:00
Ahmad Samir
032ffb70a8 QAbstractSocketEngine: port to QDeadlineTimer
qnativesocketengine_win.cpp: don't check if timeout is < 0, because
remainingTimeAsDuration() doesn't return negative values.

All the changes done in one go, not function by function, as that causes
the least churn. You can think of them as a couple of very similar
changes repeated various times.

Drive-by change: replace `forever {` with `for (;;)`

Task-number: QTBUG-113518
Change-Id: Ie9f20031bf0d4ff19e5b2da5034822ba61f9cbc3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-07 02:28:12 +03:00
Mårten Nordheim
51c812af07 QHttpThreadDelegate: use new(std::nothrow) instead of try..catch
We usually compile without exceptions, so the try..catch is a noop.
So, if the `new` fails we would crash (or get UB) anyway. Instead
of that, use the nothrow version of `new` and check the result.

Pick-to: 6.6 6.5
Change-Id: I1902b717c70afcc44c1f3237370aae346262452a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-07 00:10:32 +02:00
Marc Mutz
72d51f1c42 QUuid: de-pessimize QDataStream operator
Use a stack buffer instead of a QByteArray to hold the 16 bytes for
the QUuid serialisation, replacing toRfc4122() with toBytes() and a
memcpy().

As drive-bys, drop the needless cast from char* to uchar*
(qToLittleEndian() has void* arguments, so char* is fine) and drop {}
around single-line if body.

Pick-to: 6.6
Change-Id: I6ffabcf07fc9a730a782e20e113999a0dcf15067
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-06 22:10:31 +00:00
Marc Mutz
3321101d8f Move qpointer.cpp → qpointer.qdoc
It contains no implementation. Proof: it includes no headers.

Pick-to: 6.6 6.5
Change-Id: I64b42ce799eec05a0faff2021e2b60460695e192
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-10-07 00:10:31 +02:00
Liang Qi
42d9c1913a xcb: replace a warning with debug info in qxcbconnection_xi2.cpp
Fixes: QTBUG-117820
Pick-to: 6.6 6.5
Change-Id: I3b89305e1a8d92a02166efee7067108572f7a97a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-10-07 00:01:22 +02:00
Thiago Macieira
22029a76c3 qcompilerdetection: Add missing qtconfiginclude.h
The Q_DECL_{IMPORT,EXPORT} macros change with the configuration, so the
lack of our configuration this ended up producing inconsistent builds.

Amends 43ec3d8d01.

Pick-to: 6.6
Change-Id: Ifeb6206a9fa04424964bfffd17892394d19e648f
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-06 15:01:22 -07:00
Axel Spoerl
92d837e684 QDockWidget: Do not propagate title from a closed dock widget
When a dock widget is closed while floating, it still reports being
floating even though the QWidget::windowHandle()->isVisible() returns
false. This is documented behavior and will not be changed.

c153066baa relied on the isFloating() to
return false, if the dock widget is closed. When the window title was
changed by setWindowTitle(), the change was overridden by reading the
old value from the window handle.

=> Amend the patch and add a windowHandle()->isVisible() as a condition.

In c153066baa, an autotest for the title
propagation (QTBUG-113591) was added to floatingTabs().

=> Harden the setWindowTitle() test function. Move the tests related to
QTBUG-113591 and QTBUG-117764 to this function.

Fixes: QTBUG-117764
Pick-to: 6.6 6.5
Change-Id: Id37a9a22d4d13abad4ea55c74ea4e834bdb2bfab
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-10-07 00:01:22 +02:00
Liang Qi
44894c579c cmake: remove xcb dependency for accessibility-atspi-bridge feature
Qt a11y(ATSPI) support only depends on DBus and ATSPI, it should
also work fine on Wayland when xcb was disabled.

Task-number: QTBUG-117535
Pick-to: 6.6 6.5
Change-Id: Ibd7ebb32b94de1888920f0fe2b85ae3bd4d2c77a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-10-06 21:51:12 +02:00
Liang Qi
7e14e6c2d3 a11y: add runtime checking for xcb only calls
This amends d23562da1c .

Pick-to: 6.6 6.5
Task-number: QTBUG-117535
Change-Id: I33f97f3c26409a33c8a069f9dcdfe61bbd88e2ec
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-06 21:51:12 +02:00
Liang Qi
2ad3da8fce a11y: fix the build without xcb headers
This amends 6802065da8 .

Pure Wayland runtime and build envs without X11/xcb are more common.

Need to find solution for ATSPI_MODIFIER_SHIFTLOCK on Wayland later.

Pick-to: 6.6 6.5
Task-number: QTBUG-117535
Change-Id: I65d41546e3dbb86c3a939a496ed43ac1737cf539
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-06 21:51:11 +02:00
Ahmad Samir
9e5df4ae53 QStringConverter: clarify decode()/encode() API docs
These methods return a struct which is implicitly convertible to
QString/QByteArray respectively. Don't hide the return type from QDoc,
this simplifies telling users what those methods return exactly.

Fixes: QTBUG-117705
Pick-to: 6.6 6.5
Change-Id: Ibb22a1e54fffce8f5f20aaabe47983870ccfba1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-06 22:51:11 +03:00
Mårten Nordheim
23996976cf http: fix leakage of network cache qiodevice
The QIODevice is owned by the caller of data(), so we should have
freed it.

Amends a6776de0c7

Fixes: QTBUG-117787
Pick-to: 6.6 6.5 6.2
Change-Id: Ic5575649038480f52cc13ee229980ee1c7cee728
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2023-10-06 19:40:23 +02:00
Anton Kudryavtsev
d9370d0962 QByteArray: use constexpr more
Change-Id: I89bfb51659df798bc4dfa37d764b56ea8a289fbf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-06 19:18:54 +03:00
Christian Ehrlicher
076bf63a81 SQL/PostgreSQL: misc cleanup
Misc cleanup for the PostgreSQL driver:
 - use constexpr instead const for some constants
 - use new signal/slot syntax
 - unconditionally call PQfinish() - check is done inside the function

Change-Id: I47b83ef3436225f698fca24c68e5c9cde32c1163
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2023-10-06 15:48:46 +02:00
Tor Arne Vestbø
c74cfae7a3 Long live QPlatformKeyMapper!
The QKeyMapper class never got a platform integration companion.

As we might be adding more functionality here in the future, let's
fix that now, instead of adding more hooks directly to the platform
integration class.

The QKeyMapper will soon update its possibleKeys signature to
return QKeyCombination, but for now transform the result.

Change-Id: I88ef498180b2a8a7937a74627b7eb6b5156e872a
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-06 15:48:45 +02:00
Tor Arne Vestbø
d9bb8c0a17 Automatically reflect new input context input direction when locale changes
All platforms except Wayland fail to check for input direction change
when the locale changes, and only emitLocaleChanged.

We can simplify this for the platforms by checking if the new
locale caused a change in input direction, and if so emit
inputDirectionChanged on their behalf.

Change-Id: I84d8df9392db5e716f5c277d0cc9e17e5a21783f
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-06 15:48:45 +02:00
Timothée Keller
84d0ebabaa Windeployqt: fix typo
Change "qpaths" to "qtpaths" since the former is not a valid option.

Fixes: QTBUG-117817
Pick-to: 6.6 6.5
Change-Id: Ib8c8c80f31c1c54747340442c6bf3185c7c69001
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-10-06 12:08:31 +00:00
Liang Qi
70d3c15e8e xcb: set _KDE_NET_WM_DESKTOP_FILE and _GTK_APPLICATION_ID for window
in top level, which are in used very common for KDE and GNOME.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-117488
Change-Id: I88fe7b4afe44e4ac8f07e60e990cbe68498e98d9
Reviewed-by: Nicolas Fella <nicolas.fella@kdab.com>
Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-06 09:42:46 +02:00
Christian Ehrlicher
4e8b54eb81 Preparations to deprecate QItemDelegate
QItemDelegate was superseded since Qt4 by QStyledItemDelegate but it
took until Qt6.7 to remove the last occurrences in qtbase.
 - remove unused includes / replace with qabstractitemdelegate.h
 - replace references in the documentation with QStyledItemDelegate
 - adjust the examples and tests to use QStyledItemDelegate

Pick-to: 6.5 6.6
Change-Id: I246755004ce2d01192a726ca0972106c237df0cc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-10-05 21:08:45 +02:00
Anton Kudryavtsev
9187348505 qtextdocument::insertText: port to QSV
and add QChar overload to reduce allocations
Also port tests from char* literals to char16_t literals

Change-Id: I99381a2da08d9d35e6135c48bd92bd8d72533065
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-05 22:08:45 +03:00
Anton Kudryavtsev
0ccb8ab1db qtextdocument: replace fromLatin1 with L1 literal
to reduce allocations

Change-Id: Ie6f734269c9e880ff208629a625c88f4841e9533
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-05 22:08:45 +03:00
Anton Kudryavtsev
33d606412d qtextdocument: use qsizetype more
in Qt::mightBeRichText, Qt::convertFromPlainText
and emitFrameStyle to support large strings

Pick-to: 6.6 6.5 6.2
Change-Id: I7187bd81d3cbcc11ba898e015bd2a8ec64e3bf34
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-05 22:08:44 +03:00
Anton Kudryavtsev
e9e076df55 QString: use qsizetype more
It's last legacy int

Pick-to: 6.6 6.5 6.2
Change-Id: I691f7b15dead91166831cdf6c33a9f4d2d58b62e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-05 22:08:44 +03:00
Anton Kudryavtsev
05737f831c QString::insert: micro optimization
Don't call resize on QVLA, just wrap pointers in QSV
As drive-by, fix typo in comment

Change-Id: Id90236cfb53d861b8bd57fa9452aba4b8d9b20bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-05 22:08:44 +03:00
Marc Mutz
1219dbcd12 QPointer: ensure construction from nullptr is constinit'able
Construction from nullptr wasn't, before, because it was using the
QPointer(T*) constructor, which cannot be constexpr. Add a constexpr
QPointer(std::nullptr_t) constructor to enable this use-case.

This requires to mark the (T*) constructor as Q_WEAK_OVERLOAD,
otherwise legacy construction from a literal 0 would be ambiguous.

No documentation changes needed, as the set of valid expressions
(apart from constinit'ing) has not changed. Mention the nullptr ctor,
though, without \since.

Add a test to confirm that contruction from derived still works.

Change-Id: If9d5281f6eca0c408a69f03fecba64a70a0c9cf0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-05 20:19:40 +02:00
Marc Mutz
c0ba4ad49d QtAndroidAccessibility: fix unneeded runtime initialization
Initializing QPointer with nullptr is currently still going through
the (T*) ctor, which is not constexpr, so is initialized at runtime.
This will change in Qt 6.7, but that doesn't help the older branches.

Use the default constructor, which is constexpr, and assert that no
runtime initialization happens by using Q_CONSTINIT.

Amends f929756578.

Not picking to 6.2, 5.15 because, while affected, they're in too
stable a mode for this, and they also lack Q_CONSTINIT.

Pick-to: 6.6 6.5
Change-Id: I41bb6f36d529effda008f166fd05a8896157edc9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-05 20:19:40 +02:00
Marc Mutz
a0d931e482 qfuture_impl.h: remove unused qpointer.h include
The last QPointer user was removed in commit
07d6d31a4c. Prune the include.

Change-Id: Id48ffd2f8f5c1790bbdc54d66ac0c404b0af9cd2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-05 20:19:39 +02:00
Mårten Nordheim
1bfdbe5c71 Inline Functor struct into FunctorCallable
It's currently its only user, so drop the extra code and inheritance.

Change-Id: I6e525a9629b7289cc770133936e089683b763289
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-05 19:50:33 +02:00
Marc Mutz
c3986032a8 QPointer: mark the dereference operator noexcept, too
The std types do that on their smart pointer types, so while it's not
100% correct (the function has the precondition !isNull()), follow
upstream and mark this operator noexcept, too.

Change-Id: Ie688598215afe2db4c0c26fcfa192fc7c8e22150
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-10-05 19:40:03 +02:00
Marc Mutz
4f191cf657 QPointer: plaster API with noexcept
Mark almost all public functions of the clas as noexcept.

Exceptions:

- assignment and construction from T*: allocates an ExtraData in
  QObjectPrivate

- dereference: the std types do that, but it's not 100% correct, so
  not proposed in this patch

As a drive-by, remove pointless inline keywords.

Change-Id: Ice91dfc429a4268546c0b8275da329be05f4edcb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-10-05 19:40:02 +02:00
Tor Arne Vestbø
fc1549c014 macOS: Silence warning about supporting secure state restoration
We don't support or implement state restorations via the AppKit
state restoration APIs, but if we did, we would/should support
secure state restoration. This is the default for apps linked
against the macOS 14 SDK, but as we target versions below that
as well we need to return YES here explicitly to silence a runtime
warning.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-117745
Change-Id: I0145504a79e53499852832d23dc7d4d6838dfa1b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-05 19:40:02 +02:00
Marc Mutz
2b8e1a706e QPointer: mark converting assignment operators noexcept
All operations they perform (copy/move construction + swap()) are
noexcept, so these functions should be noexcept, too.

Amends 93019dc0dee3dd3d568775250e3fae8eda072850 and
(FIXME)93019dc0dee3dd3d568775250e3fae8eda072850(ONCE MERGED).

Change-Id: I9010f87f93ce3efcefd8b28d848a3eadd6e74542
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-05 19:40:02 +02:00
Marc Mutz
b6c7335635 QPointer: fix missing converting move-assignment operator
When 6c504f2519 added the conversion
copy-constructor to fix an ambiguity, its commit message argued at
length why a move-assignment conversion operator was not possible. But
we actually have the existing converting move and copy ctors, so we
can just use copy-and-swap and move-and-swap, so do that.

As a drive-by, make the copy-assignment operator use copy-and-swap.

[ChangeLog][QtCore][QPointer] Added missing converting move-assignment
operator. This is forwards-compatible with Qt 6.6.0: compiling against
6.6.0 will just use the lvalue overload.

This is BC and SC, forwards and backwards (inline code, and going back
in time will just use the lvalue overload), so picking to 6.6.

Pick-to: 6.6
Change-Id: Ibbefb0927c08d8c716a952c6c592a02df2a89008
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-05 19:40:02 +02:00
Rym Bouabid
9d32288a38 Revamp Bindable Properties exp: Revisit documentation
Remove "Example" from the title.
Add \examplecategory Data Processing & I/O

Fixes: QTBUG-114689
Pick-to: 6.6 6.5
Change-Id: I695df195819cc371d404c4c5f01a0c4830d9c438
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-05 15:44:32 +02:00
Giuseppe D'Angelo
7d18ad49a3 QStringView: simplify the constructor from QString
We have to single QString out because of the isNull/isEmpty distinction.
Still, we can avoid having a constructor template on it constrained on
the argument being precisely QString. This is a historic remnant; in Qt
5 the constructor also worked with QStringRef.

Change-Id: I5457a83d5b77887f57ea9910a826f729ec276d28
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-05 02:40:02 +02:00
Mårten Nordheim
2c6b7ff501 QNetworkInfo[NetworkManager]: Make ctors explicit
Change-Id: I65a37bd108bd52b9ab754127e9f6c4929bf3eca1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-05 01:35:01 +02:00
Laszlo Agocs
1d019de6b7 rhi: Fix intro doc snippet with Vulkan
The QVulkanInstance must outlive the QRhi (if Vulkan is used).
Otherwise subtle problems may pop up upon application exit.

Pick-to: 6.6
Change-Id: Ia7074c7f53633d51cf3bbdcc84e7f578214d9648
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-10-05 00:23:46 +02:00
Mårten Nordheim
b153181546 Mark potentially unused variable as maybe_unused
Fixes compile error with MinGW clang.

Amends de6f405313

Pick-to: 6.6 6.5
Change-Id: Idc1fac9d92369cfc79b5c770830bb43b3c5aae91
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-04 21:16:29 +02:00
Assam Boudjelthia
29919f3dc9 Android: Add Android 14 to QOperatingSystemVersion
Fixes: QTBUG-116643
Change-Id: I014ada85deda44226e68d230aebc3c3d5a62df00
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-04 22:04:46 +03:00
Anton Kudryavtsev
c24572d2a4 QString: proper compare of iterators
Canonical way is compare result of std::find_if against end by != operator, not <

Change-Id: Ifffbaf11416ea0738a1ccbb2f2f8482193390070
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-04 22:04:46 +03:00
Rym Bouabid
b956fec7ee Remove Custom Type Example and Custom Type Sending Example
The whole Q_DECLARE_METATYPE part is superfluous in these two examples,
as QVariant works with any type as long as it is copy-constructible.
And QVariant will call the equivalent of qRegisterMetaType, so that
doesn't need to happen, either.
Showing how to integrate the type with qDebug is fine in theory, but
also a repetition of content that can be found in other places.

Given that there isn't much else being shown in these two examples, it's
better to remove them from examples and move them to manual tests.

Some parts of "Custom Type Example" were used as snippets in other
documentations under qtbase/src/corelib. So, they were added in
customtypeexample.cpp file in the snippets folder.

Fixes: QTBUG-117001
Pick-to: 6.6 6.5
Change-Id: I45b16338912e3f7394cbb5169642bd31af32d5e1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-04 21:04:45 +02:00
Rami Potinkara
adb7e2525e Android: fix display cut mode being short edges always
Fixed _SHORT_EDGES and _DEFAULT conflict.

Mapping from Qt API's to Android's is following:
-QWindow::FullScreen -> _DEFAULT
-Qt::MaximizeUsingFullscreenGeometryHint -> _TRANSLUCENT
-Others  -> _NEVER
-Not supported -> _SHORT_EDGES (Use Java as workaround)

For example in QML:
-visibility: Window.FullScreen
-flags: Qt.MaximizeUsingFullscreenGeometryHint

Fixes: QTBUG-114437
Task-number: QTBUG-96877
Pick-to: 6.6 6.5 6.2
Change-Id: I730b3e3f76401b52548ece05dee60526d0be8207
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-10-04 19:04:45 +00:00
Anton Kudryavtsev
694f4f3a3b write_pbm_image: use QBAV more
to reduce allocations

Change-Id: I99351a8042a315b4b0742567ba77082b576cbece
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-04 21:42:50 +03:00
Kai Köhne
ec7f06fa62 Remove 'SecurityCritical' attribute for psl-data
The list is used to prevent the setting of super-cookies for independent
domains, so in a way, the content is related to security.

Anyhow, having it always up to date is not super critical, as this is
used mostly as a band-aid. Also, the updates are fairly expensive in
file size, and as upstream doesn't do classic 'releases', we must define
how often we should update.

Let's remove the urgency to update it for every patch-level release by
removing the SecurityCritical attribute. Instead, we should aim for
updating it right before minor releases, so about twice a year. This is
btw what other projects are doing: Chromium updates the list
twice a year, Debian even less often.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I05790f28002190ab0caa5a2a75e3b87cd44462d1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-04 18:36:53 +00:00
Tor Arne Vestbø
cf13e4c84c macOS: Activate Qt's platform a11y whenever the system queries us
Otherwise the cached information we store about e.g. table rows
and columns will not be updated, as QAccessible::isActive() is
false during QAbstractItemViewPrivate::rowsInserted(), and as a
result we'll be operating on stale information when the system
comes back later to query us about one of the cells.

This was observed when running a Qt Widgets table app with
the system's Keyboard Viewer open.

Pick-to: 6.6
Change-Id: I88efd46dbc3d35c8b1888d3e29ef3d001bb9eac7
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-10-04 14:54:33 +02:00
Harald Sitter
918fed3915 a11y: fix race condition on atspi startup on Wayland
This amends db346e711c .

Previously we could race between dbus connecting and our "manual"
enabled call since we didn't take into account whether dbus is
connected or not.

This lead to scenarios where opening an application (in particular under
Wayland) would result in the application not being able to register on
the a11y bus because registration was attempted too early.
By simply taking connectedness into account we'll make sure to not
run registration too early anymore.

Pick-to: 6.6 6.5
Change-Id: I46a3c0b57f8a0c83d3e5fae9e355c2061954031f
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-04 12:54:33 +00:00
Christian Ehrlicher
8615884728 QMap/MultiMap/Hash/MultiHash: synchronize documentation
Synchronize the documentation of the four container classes:
 - document the return type of insert() and replace()
 - don't reference QMultiHash/Map from QHash/Map except in the details
   paragraph

Task-number: QTBUG-117757
Change-Id: I93ee7eec0c298854e05e83a43f1c7cffd0610d72
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-10-04 11:56:04 +02:00
Vladimir Belyavsky
2581bed66b QRhiD3D11: do not crash on endFrame() when IDXGISwapChain is null
There are reports on crashes in QRhiD3D11::endFrame() due to nullptr
access to swapChain (IDXGISwapChain). It's still not clear under what
conditions this might happen, but we can make a speculative fix (as a
last chance) by simply adding a check that the swapChain is not null.

Instead of crashing in such cases, we will warn now and return
QRhi::FrameOpError, similar to the case when IDXGISwapChain::Present()
failed.

Task-number: QTBUG-109708
Pick-to: 6.6 6.5
Change-Id: I2b0430347a229a618176a38ce3dc9c6e5a33a60c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-10-04 09:44:42 +00:00
Marc Mutz
1ba4f73692 QPointer: make swap(lhs, rhs) a hidden friend
This is how we like our free functions these days.

Task-number: QTBUG-87973
Change-Id: I55b5f2674d24c7b76b8dc425a4f1c5520b8c1ec4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-04 07:43:59 +02:00
Christian Ehrlicher
aeeb77650f Qt container documenation: Misc fix for std comparison
std::map/multimap/unordered_map/unordered:multimap also need a 'Key'.

Fixes: QTBUG-89904
Pick-to: 6.6 6.5 6.2
Change-Id: Ib653c941b671905762270c82218e50dfed8fc8c6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-03 21:08:43 +02:00
Eskil Abrahamsen Blomfeldt
a890df0283 coretext: Support variable application fonts
Named instances of variable application fonts are exposed
automatically through CTFontManagerCreateFontDescriptorsFromData()
(and also for the URL equivalent).

The main change here is just to call this instead of the overload
which only returns the first font.

Note that this also updates the test: This is because the conversion
from CoreText normalized weight values to TTF values is not 100%.
In the CoreText code, we map Heavy (0.56) to ExtraBold, but ExtraBold
gets converted to 0.6, which is closer to the CoreText value for Black
(0.62).

To avoid hitting this inconsistency, the QtExtraBold has been changed
to Black weight instead, which resolves to the same on all platforms.

Task-number: QTBUG-108624
Change-Id: Ied6d42e9e3e1ba8b7102936c5be3d285b3d9e07f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-10-03 19:25:46 +02:00
Alex Bu
1aba24a2ed Egldevices: Use valid DRM handle to get platform display
Use a valid DRM handle as display attribute to get platform display.
This fix is used together with the default framebuffer fix for the
display issue of egldevices backend on Jetson AGX Orin devkit.

Pick-to: 6.6 6.5
Change-Id: Ia1975936653461c5a7e534c714a123837c62bc10
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
2023-10-03 18:47:42 +03:00
Kurt Kiefer
17a68dae5e eglfs: add a default framebuffer to NVIDIA eglstreams
Newer versions of NVIDIA's DRM driver are rejecting the previously
accepted but non-standard use of framebuffer_id -1 in order to set
the output mode but not issue a page flip.

This change adds a default framebuffer to the egldevice driver for
use with the initial calls to set the CRTC mode and plane.

Pick-to: 6.6 6.5
Change-Id: I63dbb6b099250fcff7d995eec38fb75c675894cd
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
2023-10-03 08:47:42 -07:00
Anton Kudryavtsev
8419b56097 qFindChar: pass char16_t by value
Cheaply-copied types should be passed by value
according to https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-in

Change-Id: I341193c0a65931c1406fc7d711ef74d763178dee
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-03 08:38:02 +03:00
David Faure
3d631da88b Fix copy/paste typo in qdom.cpp leading to wrong errorColumn
Detected by KDReports unittests ;-)

Pick-to: 6.5 6.6
Change-Id: I33ab4c16a0fa55d7feffccc807998213132676fb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-10-02 23:23:01 +02:00
Topi Reinio
f0f0a5ccb6 Doc: QtCore: Fix documentation issues
* Fix references to Wait Conditions Example, Semaphores Example, and
  MIME Type Browser Example as they were renamed.

* Rename 'Shared Memory' example as its title clashes with
  the title of another page (sharedmemory.html).

src/corelib/global/qfloat16.cpp:
    * warning: Invalid '\relates' (already a member of 'qfloat16')

Pick-to: 6.5 6.6
Change-Id: Ia28be8e3882a7ad1fadcdbd50a657705d58526bd
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-10-02 21:10:59 +00:00
Topi Reinio
b5169b5c90 Doc: Fix QIcon documentation
* Move \externalpage topics to external-resources.qdoc, as that command
  cannot be embedded in other topics.

* Fix references to non-existent function fallbackIconTheme().

Pick-to: 6.6
Change-Id: I5d08206c53aea9c2d4c6fddf5d04df187b01ef53
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-02 21:10:59 +00:00
Ahmad Samir
42c4d6c249 String views: de-duplicate API docs
Will be reused in later commits.

Change-Id: I078ad7eb0aac6eb389453d8bc32c414c840bc22e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-02 23:28:13 +03:00
Tor Arne Vestbø
26b279eda1 Make QKeyMapper::possibleKeys's event argument const
To match the QPA layer (QPlatformIntegration, QPlatformKeyMapper).

Change-Id: If1b4817eb334c6cdf1ccd587794701245076bd2f
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-02 22:13:36 +02:00
Ahmad Samir
9dfa0b5711 QStringList: de-duplicate API docs
Change-Id: I806634b859b8fed9b7a42aac55a056b0c6408fb3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-02 22:12:35 +03:00
Anton Kudryavtsev
ab651c22ae QString::section: replace QList with QVLA
to reduce allocations

Change-Id: Ib996549a018b457d2ee4f073efb0d950268c7738
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-02 22:12:35 +03:00
Rym Bouabid
4aab2ef0ac Revamp Queued Custom Type Ex: Revisit the documentation
Remove "Example" from the title.
Add \examplecategory {Data Processing & I/O}.

Task-number: QTBUG-117147
Pick-to: 6.6 6.5
Change-Id: Ieaab75dedb60329dcdcbbcfe6e2ad360df4d98df
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-02 19:08:42 +02:00
Tor Arne Vestbø
fa54471050 QCocoaInputContext: Don't emit locale update on startup
We're just resolving the initial locale, via the call site
in the constructor.

Change-Id: I186f4c491c013cce265a855963a8624ce5c6da97
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-02 19:08:41 +02:00
Eskil Abrahamsen Blomfeldt
500be123f4 Support variable applications fonts with DirectWrite
For GDI, there doesn't seem to be any way to do this, so it depends
on selecting the DirectWrite font database explicitly.

This moves the supportsVariableApplicationFonts() check into the
QPlatformFontDatabase instead of the font engine, since that's
where it belongs.

[ChangeLog][Fonts] Added support for selecting named instances in
variable application fonts when using the DirectWrite backend.

Task-number: QTBUG-108624
Change-Id: I51e0fedd7a9616088a06453a1d17f48bd18fa5a7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-10-02 18:00:33 +02:00
Eskil Abrahamsen Blomfeldt
0138d910b2 DirectWrite: Fetch correct style name in font info
When getting the font info for a resolved QFont on DirectWrite,
the style name would not be set, so there would be no way to
check the style name of the actual resolved font.

Change-Id: I5ff27e95619a330b7d2a0252222fad8629837418
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-10-02 18:00:33 +02:00
Morten Sørvig
d4e5898ba0 wasm: Don't assert on empty getRelocatablePrefix()
Emscripten expects to find shared libraries at the root
of the in-memory file system; set prefixPath accordingly.

(Emscripten does not always use the file system though,
for example when linking the main wasm file).

Change-Id: Ia8053274e23f15fb9ea74a6bebf1ed607cc2c2fc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-02 18:00:33 +02:00
Axel Spoerl
c10a50ac3c QHeaderView: Fix columsMoved/rowsMoved connection to item model
Amends f8fc93fdef and corrects wiring to
wrong slot.

Found-by: Marten Nordheim <marten.nordheim@qt.io>
Task-number: QTBUG-117698
Change-Id: I9833f7abc190e2f89b534ad5761db83ba5b895a3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-02 16:00:33 +00:00
Tor Arne Vestbø
d50bf18726 Support more verbose debug output for QKeyEvent
Sometimes it's useful to know the scan code and virtual key as well.

Change-Id: Ic120189470a9ff44a5cb7f6dcc1405654136424f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-02 18:00:33 +02:00
Jan Grulich
e25c773f2b QCryptographicHash: don't forget to unload OpenSSL providers
Automatically unload loaded crypto providers on cleanup. In most cases
we don't load them, but when we do (e.g. when MD4 is used), we would be
leaking memory.

Fixes: QTBUG-115233
Pick-to: 6.5 6.6
Change-Id: I91318d391ab35d00647d1e9e2408fc987811a2d3
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-02 16:34:31 +02:00
Antti Määttä
cd7c1037c2 Fix compiler error
Fix missing ';' before '}' error.

Change-Id: If377623b65c00b728c00db20a0d81e200150ae7d
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-10-02 16:54:46 +03:00
Axel Spoerl
975c0bdf73 QDockWidget: Don't use QWidgetResizeHandler on Windows
QWidgetResizeHandler sets its own mouse cursor, which can cause the
wrong icon being shown in corner cases (e.g. floating dock with custom
title bar and windows container).

Windows handles resizing of toplevel windows on platform level. A
QWidgetResizeHandler is not necessary.

=> Do not create one on Windows.

Resizing of floating dock widgets is tested in
tst_QDockWidget::dockPermissions(), floatingTabs(), hideAndShow().
=> No separate autotest needed.

Fixes: QTBUG-102196
Pick-to: 6.6 6.5 6.2
Change-Id: I20ab203e6b7ecc1dbda0524c7ff9bef271a7c04f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
2023-10-02 14:50:57 +02:00
Morten Sørvig
5f1c29376c Add catch-all DPR update to expose event handling
The platform plugin should already DPR (or DPI) change
events, however if that does not happen we update in
the expose event as well as a last resort to make sure
the window's DPR value is in sync.

Also print a warning and ask for a bug report.

Pick-to: 6.6 6.0
Change-Id: Ibb144f163281a28216c2fa3353ed50237e91ce25
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-02 12:50:57 +00:00
Morten Sørvig
628692a2f2 wasm: make haveAsyncify() return true for any asyncify
User code usually don't need to differentiate between asyncify
1 or 2 (JSPI), since the differences are abstracted over by
the wasm event dispatcher.

haveJspi() returns true for JSPI only as before, and can be
used to differentiate between the two.

Add canBlockCallingThread(), which returns true also for
secondary threads (which don't need asyncify to block).

Change-Id: Ia37513f2d4c56ef6351c950b5fc31ad15fa389d9
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-02 09:41:50 +02:00
Christian Ehrlicher
4536ff2533 QDataWidgetMapper: use pmf-style connect
Use pmf-style connect, remove Q_PRIVATE_SLOT and remove the _q_ prefix
for the private slots.

Change-Id: I7e606e24f4f89183eb12fefcf53d0d8952a90516
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-02 09:28:03 +02:00
Øystein Heskestad
c73ee7353a Fix not emitting proxyAuthenticationRequired signal for NTLM
During NTLM http proxy authentication QHttpSocketEngine did
not emit the proxyAuthenticationRequired signal during
handling of HTTP 407 responses. As a consequence, the proxy
server was spammed with connection requests that never
worked.

Fixes: QTBUG-109718
Pick-to: 6.6 6.5
Change-Id: Icf0ccf58e3f2690d210652713155a303026ed3b1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-02 07:13:45 +00:00
Mitch Curtis
ccda336246 Doc: state that models are not thread-safe
Fixes: QTBUG-107598
Pick-to: 5.15 6.2 6.5 6.6
Change-Id: I0e7ea8d4b2094d92b3cad5eec5b30e6e3ac64018
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-02 12:22:44 +08:00
Thiago Macieira
da0571d878 QtTest: block almost all Unix signals in the WatchDog thread
Signals delivered via kill(2) are delivered to any thread that is
running, so let's make sure the WatchDog thread doesn't get them.

This may be hiding bugs in the user's handler code, but in simple unit
tests the user may not be expecting there to be multiple threads in the
first place.

Pick-to: 6.6
Change-Id: I512648fd617741199e67fffd17822cdcdf30926c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-01 16:29:42 -07:00
Christian Ehrlicher
011d71664b QAbstractItem/Column/TreeView: rename private functions (remove _q_ prefix)
Cleanup the private function names after the change to pmf-style
connections.

Task-number: QTBUG-117698
Change-Id: Id15ef245cacca9c00bf65271bccf4da82fb7fd2f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 19:33:30 +02:00
Christian Ehrlicher
81e53db238 QTreeWidget: rename private functions (remove _q_ prefix)
Cleanup the private function names after the change to pmf-style
connections.

Task-number: QTBUG-117698
Change-Id: Ib03acba5823101f05d695aa31fd0d7f131443c01
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 19:33:28 +02:00
Christian Ehrlicher
490dc22ebd QListWidget: rename private functions (remove _q_ prefix)
Cleanup the private function names after the change to pmf-style
connections.

Task-number: QTBUG-117698
Change-Id: I38f13fff8312ac1f3f9da6e034f3131de7bd6247
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 19:33:27 +02:00
Christian Ehrlicher
72a39ed3ed QHeaderView: rename private functions (remove _q_ prefix)
Cleanup the private function names after the change to pmf-style
connections.

Task-number: QTBUG-117698
Change-Id: I9a5e178af997bfcfef78f7a3b9b84da6d653186d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 19:33:25 +02:00
Christian Ehrlicher
03b437bbad QTableView/Widget: rename private functions (remove _q_ prefix)
Cleanup the private function names after the change to pmf-style
connections.

Task-number: QTBUG-117698
Change-Id: I60275b7da6bf5e78562ccfd38a02719cc313eb49
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 19:33:24 +02:00
Christian Ehrlicher
3ad6bdcc62 Widgets/Itemviews: remove unused private slot macros
Remove the now unused Q_PRIVATE_SLOT() macros for all itemviews classes
after the conversion to the new style-connection syntax.

Task-number: QTBUG-117698
Change-Id: Id4b8077d9f07741cc418a2126843565940701125
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:31 +02:00
Christian Ehrlicher
f8fc93fdef Widgets/Itemviews: use pmf-style connect in QHeaderView
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Task-number: QTBUG-117698
Change-Id: Ia0745dc10a917f3af4b448b3156d66bdb5d6ce64
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:23 +02:00
Christian Ehrlicher
39d486171b Widgets/Itemviews: use pmf-style connect in QColumnView
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Task-number: QTBUG-117698
Change-Id: I955bd088e24ada7aa87645d28dc9b201bc67e927
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:22 +02:00
Christian Ehrlicher
063e25e512 Widgets/Itemviews: use pmf-style connect in QListWidget
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Task-number: QTBUG-117698
Change-Id: If2c259c3f7737cec736c134c8bc83c4cb14906ba
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:20 +02:00
Christian Ehrlicher
2666c773ba Widgets/Itemviews: use pmf-style connect in QTableWidget
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Task-number: QTBUG-117698
Change-Id: I2b5bb99c77e6e783a4cd7b0065d2f52a0266d88b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:19 +02:00
Christian Ehrlicher
c55a7e4167 Widgets/Itemviews: use pmf-style connect in QTreeWidget
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Task-number: QTBUG-117698
Change-Id: I652c8d6f27b23a7d4467dc39b7c12850f4d25f66
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:18 +02:00
Christian Ehrlicher
0bb35ee2f0 Widgets/Itemviews: use pmf-style connect in QTreeView
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Task-number: QTBUG-117698
Change-Id: Ic6617b3611a2ce156e9e568c1d07343f649562c4
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:17 +02:00
Christian Ehrlicher
3e144bdc74 Widgets/Itemviews: use pmf-style connect in QTableView
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Task-number: QTBUG-117698
Change-Id: Ifd6a55080a803b3aba2e35b9679a5194ff3f633c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:15 +02:00
Marc Mutz
64b07fc811 QAtomicScopedValueRollback: fix a typo
Pick-to: 6.6 6.5
Task-number: QTBUG-115107
Change-Id: I9ca5d143b5c89443fc40859c035be43cde3d73c4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-10-01 10:48:49 +02:00
Marc Mutz
e054d9f558 QAtomicScopedValueRollback: make store_part() static
... because we can.

Pick-to: 6.6 6.5
Task-number: QTBUG-115107
Change-Id: I23b5edc6111615cbd0352847b2f1a1667948c40a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-10-01 10:48:45 +02:00
Albert Astals Cid
88c74240a8 FileChooser portal: Make sure filter.name is not empty
Xdg-desktop-portal will reject any OpenFile request if there is an empty
filter, so if we can't find the mimetype in the mimedatabase we just
use it's "raw name"

Pick-to: 6.6 6.5 5.15
Change-Id: I705ae7523445e5c2ec97a42ee334401bc90adb68
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-01 08:23:32 +02:00
Ahmad Samir
00c1c04bd5 String classes: make first/last/chopped() delegate to sliced()
De-duplicates code.

Change-Id: Id29511e7e571ed14f9e3cfd4355b901d81ea2562
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-30 19:29:51 +03:00
Tor Arne Vestbø
fdd2fc2c71 Remove QKeyMapper::changeKeyboard()
As described in QTBUG-27681, we no longer send KeyboardLayoutChange
events in Qt 5 and up. We have QInputMethod::localeChanged, but that
doesn't cover the cases where the input language stays the same, but
the layout is changed.

None of our widgets react to KeyboardLayoutChange these days, but
ideally we should send KeyboardLayoutChange if we can plumb it from
the platforms.

However that plumbing wouldn't live in QKeyMapper, and having it
around as dead code doesn't help, so remove it for now, and track
the work to implement it in QTBUG-27681.

Task-number: QTBUG-27681
Change-Id: I480590550f3bc741b829fb30aa85393b07d5c16f
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-30 11:11:39 +00:00
Tor Arne Vestbø
eb4103e0b9 Remove QKeyMapperPrivate
There is no point in maintaining the keyboardInputLocale and
keyboardInputDirection in the QKeyMapperPrivate, as these
things are handled by QInputContext nowadays. The values
were never updated either, so the base class implementation
of QPlatformInputContext referring to them was confusing.

With those gone, we can remove the entire class.

Subclasses of QPlatformInputContext typically only override
locale(), so we now base the input language direction on the
current locale(), giving dynamic updates of the direction as
well (without the signal, but this will be fixed in a follow
up patch).

Change-Id: I16ae4097eadadd278e60edea3c1101ab90ed7444
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-30 13:11:36 +02:00
Marc Mutz
fdf7774bc6 QPersistentModelIndex: fix relational operators not being noexcept
They actually can be, so the implementation need not change. Just add
the noexcept tag (which is BC, it's not part of the name mangling on
any compiler).

Silences a bunch of XFAIL in the test (the test is automatically
picking up the change, no need, and no way, to manually remove the
QEXPECT_FAIL).

Change-Id: I24b6ba1248001056de64f341617943e7aea5ae93
Reviewed-by: David Faure <david.faure@kdab.com>
2023-09-30 13:02:05 +02:00
Marc Mutz
49f9271360 QPersistentModelIndex: fix UB (op< on unrelated pointers)
Pointers can only be legitimately compared with less-than (<) if they
point into the same array (or one past the end). This is decidedly not
the case for heap-allocated objects like
QPersistentModelIndexPrivates, so doing it is UB.

Fix by using std::less, which is guaranteed to be a total order, even
for unrelated pointer values.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: If04341b4b55784e7732782f3ae829f53b0ceab9c
Reviewed-by: David Faure <david.faure@kdab.com>
2023-09-30 13:02:00 +02:00
Thiago Macieira
94df3f8d6b QStorageInfo/Unix: check the mount point length before isParentOf()
Execute the cheaper test first, so we loop over the entries more
quickly.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd178749a12c966739
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-29 19:55:48 +00:00
Thiago Macieira
da95ad91b3 QStorageInfo/Linux: move from MountInfo's contents
Copying QStrings and QByteArrays is reasonably cheap, but moving is
cheaper.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1787498ead687da2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-09-29 12:55:47 -07:00
Thiago Macieira
914b3bc985 QStorageInfo/Linux: don't copy the mount info's contents until the end
All these where somewhat cheap to copy (QStrings and QByteArrays), but
why copy multiple times at all? Just copy at the end.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1787497434632dd4
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-29 12:55:47 -07:00
Thiago Macieira
c8d31833f0 QStorageInfo/Linux: remove unnecessary isSymlink() call
symlinkTarget() suffices, because if the candidate is not a symlink, it
will return an empty string. Plus, /dev/disks/by-label is a udev-managed
directory, so everything should be a symlink.

This doesn't change the number of statx() calls because QDirIterator
needs some information on file types to decide how to filter and,
unfortunately, that information is missing for symlinks (we know it's a
symlink, but we don't know what it points to). Moreover, due to
QDirIterator's design, we always statx() one entry past the one we
wanted.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786ce1bd3398d1b
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-29 12:55:47 -07:00
Thiago Macieira
a8e3eb6875 QStorageInfo: add qstorageinfo_linux_p.h to the file listing
Otherwise Qt Creator won't index it.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786cda60859226b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-09-29 12:55:47 -07:00
Allan Sandfeld Jensen
b1e6dc8d9c Compress QTimer events the same on all platforms
It was limited to only the most common platform, Windows.

Change-Id: I1821a5201f85b14f8f43469775af816519724f6b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-29 21:30:09 +02:00
Topi Reinio
7fdef80a6b Doc: Fix QRgbaFloat function signatures
Commit baac34de modified the set[Red|Green|Blue|Alpha] function
signatures. Amend the \fn commands to reflect those changes.

Pick-to: 6.6
Change-Id: I947995fc5c80baac111a04272cd848961c22eb73
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-09-29 19:30:09 +00:00
Tor Arne Vestbø
c0d1029e8e Rename QtWindows::KeyboardLayoutChangeEven -> InputLanguageChangeEvent
We react to WM_INPUTLANGCHANGE, and handle it by calling
handleInputLanguageChanged on the input context.

As input language is not the same as keyboard layout
(a keyboard layout might change without the input
language changing), let's be accurate about what's
happening.

Change-Id: I8914994a8d46485179741e010d0da5135b023668
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Andrey Butirsky <butirsky@gmail.com>
2023-09-29 20:22:34 +02:00
Christian Ehrlicher
a126d3627c Widgets/Itemviews: use pmf-style connect in QAbstractItemView
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Change-Id: I8f2d64b77849bf5fea01b7f80bbd5d0c0a09c4fa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-09-29 20:07:10 +02:00
Volker Hilsheimer
9b37762c55 JNI: Add promotion for signed char and extend test case
The jbyte type is a signed char, which also promotes to int in variadic
argument functions.

Extend the test case to make sure that we don't get any warnings for
the most relevant parameter types.

Change-Id: I7811e1eebdbc989ab5989eb1a2c502acd0540bc7
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
2023-09-29 16:50:41 +02:00
Tor Arne Vestbø
9800c63533 revert "xkbcommon: make shortcuts persistent across layouts"
This reverts commit 5e76a9569e.

The change's stated goal was to make shortcuts "stable",
i.e. work the same, regardless of which keyboard layout
the user has selected.

In doing so, it changed the semantics of shortcut handling
to depend on the order of the keyboard layouts reflected
by XKB, picking the first Latin layout in the list, instead
of prioritizing the currently selected/active keyboard
layout.

This change in semantics is a major behavior change, and
breaks common and valid setups such as having [en,fr] or
[en,de] layouts.

For example, the French layout uses an AZERTY layout,
where the Q and A keys are switched compared to QWERTY.
With the change in place, pressing the physical A key
on a French keyboard, with Control pressed, no longer
selects all text, but instead quits the application,
as the shortcut is interpreted based on the English
layout, which just happens to be first in the list.

Similar issues exist for German layouts, which use
QWERTZ, or more complex layouts such as the Neo layout.

The semantics of prioritizing the order of declared
layouts instead of the active one is inconsistent with
both macOS and Windows, as well as other toolkits on
Linux, including GTK and earlier versions of Qt.

It's also not discoverable by the user that the order
now matters. For example, there is no UX in the Gnome
setting that tells the user to ensure the order matches
their expectations for shortcut handling. And if there
was, this would only apply to Qt apps built with 6.6.0,
creating inconsistent behavior for users.

Worse, the X server is limited to four concurrent keyboard
layouts (groups), so if the user adds more layouts than
that, Gnome will replace the X server's view of layouts
only when switching to a layout beyond the first four.
And in that case, the X server's view of the layouts is
actually starting with the fifth layout declared in the
Gnome preferences. The logic in the reverted patch does
not take this into account, making it confusing for the
user which layout actually takes precedence.

Note that reverting this change does not affect our
fallback logic for layouts that do not produce Latin
symbols for the given key press, such as Greek or Russian.
Those layouts will continue to fall back to a Latin
layout for their QKeyEvent::key().

[ChangeLog][QtGui][X11/Wayland] A change in 6.6.0 that
resulted in keyboard shortcuts not respecting the user's
active layout has been reverted.

Pick-to: 6.6
Task-number: QTBUG-108761
Change-Id: Iec2897cd1541c0c125cc5b1078d0beec12b501c0
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-29 13:11:39 +00:00
Ievgenii Meshcheriakov
65953e05d3 QCoreApplicationPrivate: Do checks for application instance as late as possible
`QCoreApplicationPrivate::self` is set to nullptr in `~QCoreApplication`
without any synchronization. So it is not safe to access it from
instances of `QDaemonThread` that may outlive the application instance,
but are using the Qt event system. This patch moves some usages of
`self` behind other checks, so that the QtDBus management thread can
continue workoing without race conditions detected by Thread Sanitizer
while running tst_qdbusconnection.

Change-Id: Iece65e4126a59e3a1a41dfb6a99c84527b8d389c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-09-29 13:25:42 +02:00
Michael Weghorn
5093e517b9 a11y: Keep current combobox entry in sync
When changing the selected index in a combo box,
also update the current index in the item view's
selection model right away, and don't delay this
until when the combobox popup gets shown in
QComboBox::showPopup.

This is needed to make sure that the selection
is properly exposed to the accessibility layer.

On the accessibility layer, QAccessibleComboBox,
the a11y implementation for the combobox, exposes
the entries in its list child
(s. QAccessibleComboBox::child) and Orca queries
the selected item when the combobox gets focus,
which didn't return the proper results earlier,
resulting in no or the wrong entry getting
announced.

Extend the existing combobox a11y tests
accordingly.

Pick-to: 6.6 6.5
Fixes: QTBUG-117644
Change-Id: Ia26de5eafd229f7686745a2fbe03fc1eb6a713f8
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-29 09:55:40 +00:00
Axel Spoerl
2b63d0ccf3 QComboBoxPrivateContainer: add missing keyEvent->accept()
Call QEvent::accept() when a key event has been acted on.
This prevents redundant event delivery and consumption.

Task-number: QTBUG-117644
Pick-to: 6.6 6.5
Change-Id: I069c61c14890577683894f165fd2585ba05c45ff
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-29 11:55:40 +02:00
Axel Spoerl
d8e1100548 QComboBox: Modernise connect statements
Replace string based syntax with PMF.
Use QObjectPrivate::connect.
Rename _q_ functions.
Fix dangling connections in QComboBox d'tor: Completely disconnect
model, instead of only disconnecting QObject::destroyed.

Task-number: QTBUG-117644
Pick-to: 6.6 6.5
Change-Id: Ie87ac4881029ed1ef2f5c627f631cc54ccb39706
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-29 08:37:00 +02:00
Ahmad Samir
2fd9735e7a Add a verify() method to all sequential containers
A helper method encasuplating the asserts related to index into the
container and length, modelled after the QVLA::verify().

`pos <= size` is OK because if pos == size, the e.g. sliced()'ed
container is just going to be empty.

Normalize how verify() is used, the first arg is an index and the second
a length.

This method is constexpr even in QString/QByteArray merely for
consistency with similar methods in other string classes (this
necessitates using `d.size` in verify() in QString/QBA because size()
isn't constexpr).

Change-Id: I90e3c56d76c802259297a06d11d46ee342a1daf2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-28 23:45:24 +03:00
Dennis Oberst
016addc201 QString: assign() [4/4]: (it,it) overload for UTF-8 data types
Implement the missing overload to handle UTF-8 specific data types,
including char8_t (C++20), char, uchar and signed char.

Introduce the helper function 'assign_helper_char8' which handles the
non-contiguous_iterator case. The contiguous_iterator case is already
handled by the QAnyStringView overload.

Include 'qstringconverter.h' at the end of the file, since it can't
be included at the top due to diamond dependency conflicts.
QStringDecoder is an implementation detail we don't want users to
depend on when using assign(it, it). It would be unnatural to not
be able to use a function just because we didn't include an
apparently unrelated header.

[ChangeLog][QtCore][QString] Enabled assign() for UTF-8 data types.

Fixes: QTBUG-114208
Change-Id: Ia39bbb70ca105a6bbf1a131b2533f29a919ff66d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-09-28 17:58:41 +00:00
Alexander Volkov
e68a0da0b9 Avoid crash when keysymToQtKey(keysym, Qt::ControlModifier) is called
For example when Ctrl+Home is sent by virtual keyboard on Wayland.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I41f1d2a28c9091efa621d5826a3b9e3e0e481ceb
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-28 17:34:26 +00:00
Kai Köhne
54b5ffb602 Doc: Don't mention setDefaultCiphers() (removed in Qt 6.0)
Pick-to: 6.5 6.6
Change-Id: I775da7679bf4ff398a22334103c3116befec7da9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-09-28 19:29:31 +02:00
Orkun Tokdemir
8041bfba47 CMake: Update timestamp file for Cross-Config builds
Since https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8564 is
merged, the timestamp file for {target}_json_file.txt should be updated
for `Cross-Config` builds.

The actual error message before this commit when CMake 3.28 is used:
```
ninja: error: 'src/corelib/Core_autogen/timestamp', needed by 'src/corelib/meta_types/Core_json_file_list.txt', missing and no known rule to make it
```

Pick-to: 6.2 6.5 6.5.3 6.6 6.6.0
Change-Id: Ib544b18b67d2d4722f3801b1f46a0e0e18e59d48
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-09-28 16:23:59 +00:00
Edward Welbourne
02d8dc5f8c Rework getting normalized dates adjacent to a given one
I originally wrote dateNormalize() because I expected to need it more,
but it turns out to only be needed for two cases of getting the days
before and after a given one. So rename to adjacentDay(), pass the +1
or -1 step and simplify a little.

In the process, fix a mistake in the winding backwards across a year
boundary, where I'd incremented the year instead of decrementing it.

Change-Id: I1bb0a8323fec7c1caffa7f20879f08d3526ba7ea
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-28 14:51:33 +02:00
Edward Welbourne
44cbd4c315 Don't std::move() trivially-copyable types
CodeChecker tells me struct tm and even MkTimeResult are trivially
copyable, so std::move()ing them is fatuous.

Change-Id: Ic7328e588beabfd4a984b2b5e2ed17c065d00f01
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-28 14:51:33 +02:00
Ievgenii Meshcheriakov
ad692a1fbb Doc: update future direction of QCoreApplication::notify()
Change the Qt version for future directions of
QCoreApplication::notify() to 7. The required changes were not
done in Qt 6 as planned. Add the code that is implementing those
changes for Qt 7.0.0.

This amends 4fe865ac7a.

[ChangeLog][Future direction notices] In Qt 7,
QCoreApplication::notify() will not be called for events being delivered
to objects outside the main thread. The reason for that is that the main
application object may begin destruction while those threads are still
delivering events, which is undefined behavior. Applications that
currently override notify() and use that function outside the main
thread are advised to find other solutions in the mean time.

Change-Id: I4dd2193092542474962cdcde4921f38b173f2f00
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-28 14:51:33 +02:00
Po-Hao Su
7c4aa794ca SQLite: Handle identifiers correctly
This change can be described in the following 2 categories:
1. Support 3 ways to escape identifiers mentioned in SQLite Keywords
   In SQLite Keywords (https://sqlite.org/lang_keywords.html), it shows
   that there are 3 ways to escape identifiers, i.e., "", [], ``. So, I
   have overridden "bool isIdentifierEscaped(const QString &,
   IdentifierType)" to support it. In addition, there was a bug of
   _q_escapeIdentifier. If there is a field name called length [cm],
   which uses square brackets to show units, _q_escapeIdentifier will
   not escape it to "length [cm]".
2. Identify identifiers correctly if identifiers have been escaped
   There is a bug of QSQLiteDriver::record and
   QSQLiteDriver::primaryIndex.
   If we input escaped identifiers with separator, let's say
   "databaseName"."tableName", both will change the input into
   databaseName"."tableName, which is incorrect and causes
   qGetTableInfo cannot get the right results. In addition, I overrode
   stripDelimiters to strip "databaseName"."tableName" correctly.

There are still some assumptions for isIdentifierEscaped,
escapeIdentifier, and stripDelimiters, but I think this change it better
than what we have now.
1. For isIdentifierEscaped, if identifiers have a dot and the dot is a
   separator, it is the users' responsibility to escape the pair of
   schema and table name correctly. For example,
   "aSchemaName"."aTableName", not "aSchemaName".a"TableName". That's
   because we don't know whether the dot is just a dot of the name or a
   separator.
2. For escapeIdentifier, if identifiers have a dot and the parts before
   and after the dot are not escaped, escapeIdentifier will treat the
   dot as part of the table name or field name. The same as the item
   above, it is users' responsibility to do it right.
3. For stripDelimiters, the same as above, it is users' responsibility
   to do escape if users want to use format schemaName.tableName or
   tableName.fieldName.

Change-Id: I9d036a2a96180f8542436188f75a220a0fe58257
Reviewed-by: Po-Hao Su <supohaosu@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-09-28 20:51:33 +08:00
Volker Hilsheimer
f791570b86 QTestPrivate property tests: don't try to create abstract types
Amends 5743837a26, after which Qt
Positioning and Qt SCXML failed to build as some properties operate on
abstract classes.

Check whether we can instantiate the tested class before trying to do so,
otherwise return a default-constructed unique_ptr.

Pick-to: 6.6 6.5
Change-Id: Ida9d4375197a93438062b1e1473b4a2a22cc7054
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-09-28 13:51:33 +02:00
Łukasz Matysiak
af3e139941 Remove obsolete code related to ioctl on vxworks
Previous implementation of qt_safe_ioctl mentioned that vxworks defines
ioctl in a non-standard way.
As of VxWorks 23.03 ioctl is now properly defined so the comment and
check in the code are obsolete.

Task-number: QTBUG-115777
Change-Id: I0fdf614e45063b031e2c998339d6987ba69167ca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-27 23:56:27 +02:00
Mårten Nordheim
3b655bcda7 QNetworkInfo[NetworkManager]: Clean up some string macro usage
Change-Id: I7ee967b09aeafb8bfbedd509032dd1f45fd4956e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-09-27 21:48:25 +02:00
Marc Mutz
bb51f0d814 qSwap: try without -Wno-noexcept
The warning from the comment was probably caused by our noexcept
detection code. Now that we use std::is_nothrow_swappable, those
warnings should not longer happen.

Remove the warning suppression macros, and the #include that was
necessary for them.

Change-Id: Ib750cb1af4a8da3fb63b16d26ec51a9fb4a93ea1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-09-27 21:09:28 +02:00
Alexey Edelev
9349e463d4 Use the actual target name as base name for android deployment settings
QtC is unable to find the deployment settigns if target uses custom
OUTPUT_NAME. There is no particular reason for using the target
OUTPUT_NAME property as the base name for android deployment settings.

[ChangeLog][General][Android] The target name is used as a base name of
android deployment settings, but not the OUTPUT_NAME property.

Pick-to: 6.2 6.5 6.6
Fixes: QTBUG-117509
Change-Id: I1ac3b0ad305dc55289bef39c6e946bcf684e772f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-09-27 17:44:59 +00:00
Liang Qi
fc556e3571 QAccessibleComboBox: Cleanup comboBox() calls
Handle comboBox() returning nullptr.
Avoid repeated qobject_cast by calling comboBox() once per function.

Fixes: QTBUG-115161
Pick-to: 6.6 6.5 6.2
Change-Id: I3d102cebe807da379fa4d9ee2aee1e72b8fdf004
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-27 19:44:59 +02:00
Volker Hilsheimer
185c3b080c JNI: Fix native functions that take a declared QtJniTypes class
Now that QtJniTypes::Objects are no longer primitive types that are the
same as a jobject, using those types in registered native functions
breaks. JNI will call those function with a jobject on the function
pointer, and lacking any type safety, the call to the registered
function will proceed with a wrong type of object on the stack.

To fix that, register the native function via a proxy that is a variadic
argument function, and unpack the variadic arguments into a list of
typed arguments, using the types we know the user-code function wants.
Then call the function with a tuple of those types using std::apply,
which gives us type safety and implicit conversion for free.

Add a test that exercises this.

Change-Id: I9f980e55d3d13f8fc16c410dc0d17dbdc200cb47
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-09-27 19:44:58 +02:00