qt6-bb10/tests/auto/corelib
Giuseppe D'Angelo 6e2c9dc7a6 QKeyCombination: move the operators into namespace Qt
QKeyCombination comes with a few operators that combine a Qt::Modifier
and a Qt::Key. These operators are normally defined in Qt's own
namespace (which by default is the global namespace), but indeed the
arguments are declared in the (nested) namespace `Qt`. This is wrong,
as their lookup will fail if a user places an unrelated operator| in
a custom namespace U and then tries to use QKeyCombination's operators:
the overload in namespace U will hide the ones defined globally;
unqualified lookup (as per [over.match.oper]) will search in the
namespaces associated with the parameters (QtNamespace::Qt), but the
operators are *not* in there!

In other words:

namespace NS {
  X operator|(Y, Z);
  auto kc = Qt::Shift | Qt::Key_A;
}

fails to compile if QKeyCombination's operator| is *not* defined in the
`Qt` namespace.

Fix this by indeed defining the operator where it belongs. The functions
are all inline and non-exported so there should not be any ABI issues.

Change-Id: I6d7a4e976fb109b7bf514011142b9a9573e507c5
Pick-to: 6.7 6.5 6.2
Fixes: QTBUG-126820
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1f77e8566f71d98f4bc6bbf5092594e67a32f268)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-31 15:21:36 +00:00
..
animation Change license for tests files 2024-02-04 09:56:42 +01:00
global QKeyCombination: move the operators into namespace Qt 2024-07-31 15:21:36 +00:00
io Call std::addressof instead of operator& in QDebug::toString 2024-07-25 11:21:35 +00:00
ipc ipctestcommon.h: port away from qsnprintf() 2024-07-30 16:47:32 +00:00
itemmodels [doc] Q(Persistent)ModelIndex: document behavior of data() on invalid Q(P)MIs 2024-07-06 10:17:53 +00:00
kernel tst_QDeadlineTimer: fix format-string in toString() implementation 2024-07-22 21:00:13 +00:00
mimetypes tst_QMimeDatabase: update shared-mime-info local testing instructions 2024-07-23 22:52:53 +00:00
platform Rename target of the BSTR test in QtCore to avoid conflict 2024-07-09 14:10:16 +00:00
plugin QLibrary/Unix: update the x86-64-v3 prefix path in our search 2024-07-11 08:27:24 +00:00
serialization Tests: disable various compiler warnings 2024-07-12 00:48:40 +00:00
text QAnyStringView: check QASV(char) isn't UTF-8 2024-07-17 16:26:27 +00:00
thread QThread/Unix: fix normal exit/terminate() race 2024-07-11 08:27:17 +00:00
time Update CLDR Windows timezone data to v44.1 2024-06-02 15:25:00 +02:00
tools QArrayDataOps: fix FP equality comparison 2024-07-26 11:22:32 +00:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00