Commit Graph

1422 Commits (5ea248155654b58fcb52ef326dc4d94de83d0409)

Author SHA1 Message Date
Mårten Nordheim fd54b88d39 tst_QMetaProperty: expand testing around enums and flags
Test more scenarios, like separate namespaces, free enums, etc.
And test that the enumerator() function returns a valid QMetaEnum when
expected.

Change-Id: Ie4fa816ffb66d6b6e1b4c7c50674c31eddbd642e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-05-06 16:52:05 +02:00
Jari Helaakoski 30cc8a28de Fix test compilation issues with QtLite configuration
Now developer build tests compile, but some are not working.
Functional fix will come later via separate tasks.

Task-number: QTBUG-122999
Change-Id: I70487b46c1b32ba4279cb02a4978e4f55ac0d310
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-06 14:29:02 +00:00
Tatiana Borisova 51420d910b QMetaMethod: use new comparison helper macros
Replace public friend operators operator==(), operator!=() of
QMetaMethod to friend method comparesEqual() and
Q_DECLARE_EQUALITY_COMPARABLE macro.

Task-number: QTBUG-120304
Change-Id: Idb3f880a1db4850d73a58ed37f8cbd3454dd5ea2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-04-30 00:11:33 +02:00
Jarek Kobus 159ea47e2f QThread: Reuse isMainThread()
Internally, reuse threadId and theMainThreadId.

Change-Id: Iea6e7d8fcbcaf7e2f4dbf8ab33890d0f7954edc0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-29 23:11:04 +02:00
Tatiana Borisova de0f145022 QMetaSequence and QMetaAssociation: use new comparison helper macros
Replace public friend operators operator==(), operator!=() of
QMetaSequence and QMetaAssociation
classes to friend methods comparesEqual() and
Q_DECLARE_EQUALITY_COMPARABLE macroses.

Task-number: QTBUG-120304
Change-Id: I88e9b228220d36092437bfb71ae2f053d2e99fdf
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-04-29 22:28:51 +02:00
Thiago Macieira 038c199d59 QMimeData: fix setData on URI list without ending CRLF
Commit 8d127c5737 refactored this code
from QByteArray::split to manually iterate over the list (and
QStringTokenizer doesn't work for QByteArray), so we missed the last
element in the iteration.

Pick-to: 6.7
Fixes: QTBUG-124580
Change-Id: I455fe22ef4ad4b2f9b01fffd17c867f6ed350af7
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2024-04-22 13:57:38 -07:00
Tatiana Borisova 7689127d83 QDeadlineTimer: use new comparison helper macros
Replace public friend operators operator==() and operator!=() of
QDeadlineTimer to friend method comparesEqual().
Replace public friends operator<(),<=(),>(), etc of QDeadlineTimer to
friend method compareThreeWay().

Task-number: QTBUG-120304
Change-Id: Ib855ccac9b31b54fe28b822f2985154608fefa27
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-04-18 20:55:50 +02:00
Thiago Macieira 8381a4b44f tst_QVariant: fix stringification of char16_t and char32_t
QVariant::toUInt() cannot convert from those two, so we always ended up
with 0, producing lots of duplicated test rows.

Pick-to: 6.7
Fixes: QTBUG-124349
Change-Id: Ie28eadac333c4bcd8c08fffd17c5a3e39a2cc3f6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-04-15 23:50:51 -07:00
Thiago Macieira 848451095b tst_QVariant: remove duplicate rows from compareNumerics
Task-number: QTBUG-124349
Pick-to: 6.7
Change-Id: Ie28eadac333c4bcd8c08fffd17c5a3d824fe76ec
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-04-15 23:50:51 -07:00
Thiago Macieira d204ea9873 tst_QVariant: fix copy & paste error in double-float comparisons
We wanted to test the (min,max) of each of the two types, but one of the
four combinations wasn't correctly done.

Task-number: QTBUG-124349
Pick-to: 6.7
Change-Id: Ie28eadac333c4bcd8c08fffd17c5a3ccb4205139
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2024-04-15 23:50:51 -07:00
Assam Boudjelthia 0a45996376 JNI: check for pending exception first in getCleanJniObject()
returning early if the object is null will not clear pending exceptions
from the previous failed JNI call, and that will crash the app on the
next jni call if an explicit exception clearing is not done, wish mostly
the case. Checking and clearing for exceptions has to always be done
under this call.

Pick-to: 6.7
Fixes: QTBUG-122135
Change-Id: I0d42d012a4d1305fa07147fd22860d7c005f9b83
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2024-04-04 19:12:55 +00:00
Mitch Curtis 907181cb21 Fix Qt::AA_DontUseNativeMenuWindows being unsettable on 32 bit systems
f1bb9cfbf6 added this value, but it was
only when a test in qtdeclarative tried to use it that it was
discovered that it couldn't be set on 32 bit operating systems (armv7,
AKA imx7) due to overflow as a result of the bit shifting that is done.

Fix it by using an old, deprecated value. If any old codebase using
that older flag tries to build against a newer Qt with this change, it
shouldn't affect it, as setting the flag does nothing in Widgets, and
native menus didn't exist in earlier versions.

Task-number: QTBUG-69558
Change-Id: I520154d02e9ccf007ebd73807685212a19fbee1b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-04 11:31:51 +08:00
Giuseppe D'Angelo 8414a0aa2c Tests: check the output of QFile::open
Wrap the call in QVERIFY.

tst_QTextStream::read0d0d0a was also faulty as it *never* opened
the file because of a broken path. Fix it with QFINDTESTDATA.

Change-Id: I61a8f83beddf098d37fda13cb3bfb4aaa4913fc5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-27 04:24:11 +01:00
Marc Mutz 78db468f48 QMetaMethod: document that fromSignal(nullptr) is ok
... and add a test.

Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: I907899d7c54349d2fc23ea5ab58a1e67826b622b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-03-21 11:20:49 +01:00
Ulf Hermann 717dc9450f QProperty: Destroy binding when refcount is 0
This has to be done from all places where we deref it. Otherwise we leak
memory.

Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-116086
Change-Id: I57307ac746205578a920d2bb1e159b66ebd9b2cc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-03-18 17:42:19 +01:00
Thiago Macieira 1ca89b65d8 QAbstractEventDispatcher: port timer uses to the V2 API
Change-Id: I83dda2d36c904517b3c0fffd17b52b71739928dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-03-13 17:29:13 -08:00
Ivan Solovev 285a2a75b4 QVariant: use comparison helper macros
The relational operators were removed in
8652c79df0 with the argument that they
do not have a total order. Back than it was a valid argument, because Qt
did not support any of the C++20 ordering types.

Now Qt has its own implementation for all three ordering types, so we
could technically add relational operators and claim that QVariant
provides partial ordering.

However, that could potentially lead to many bugs and/or unexpected
results, if people start using QVariant as a key in std::map/QMap
containers.

We do not want that to happen, so we only use the helper macros to
implement (in)equality operators.

This commit also extends the unit tests, providing more extensive
testing of (in)equality operators and the pre-existing
QVariant::compare() method.

Fixes: QTBUG-113234
Change-Id: I783f3b5df552da782627f4ed0a5bb1b577753a23
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-12 21:51:43 +01:00
Volker Hilsheimer 10afa38aa4 JNI: Fix error with overload resolution when passing string types
The variadic templates are supposed to be removed from the
overload set when any of the parameters is a literal string type,
as otherwise we get conflicts with the legacy overload taking
class names and signatures as const char *. The detection of
a literal string types was missing a few specializations, so that
we ended up with the wrong overload being called, and class
names getting interpreted as method names instead.

Add the missing specializations, and add more test coverage
for using the old overloads.

Task-number: QTBUG-122235
Pick-to: 6.7
Change-Id: I5488f2009c8f62d74fac6754844f57cf64011414
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Lauri Pohjanheimo <lauri.pohjanheimo@qt.io>
2024-03-06 13:00:19 +00:00
Lucie Gérard 8741e4a60c Correct license for files
According to QUIP-18 [1], all tests file should be
LicenseRef-Qt-Commercial OR GPL-3.0-only

[1]: https://contribute.qt-project.org/quips/18

Task-number: QTBUG-121787
Change-Id: Iee9f4fca676e77ab9d8ed485a28ce5ea8803be15
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2024-03-05 14:39:33 +01:00
Ahmad Samir 4bc0834bc1 Timers: add Qt::TimerId enum class
Which will be used to represent timer IDs. Thanks to Marc for the idea
to use "a strongly typed int".

QTimer got a new id() method that returns Qt::TimerId (can't overload
timerId()). Various classes in qtbase have a member named timerId(), but
a new method is needed anyway in QTimer so id() it is (this is the
reason QChronoTimer only has id() and no timerId()). Besides
timer.timerId() has an extra "timer".

This commit fixes the inconsistency between QObject using `0` timer id
to indicate "failed to start", while QTimer::timerId() returned `-1` to
indicate "timer is inactive". QTimer::id(), being a new method and all,
now returns Qt::TimerId::Invalid, which has value `0`, so that the
values match between the two classes. Extend the unittests to ensure
QTimer::timerId()'s behavior is preserved.

[ChangeLog][Core][QObject] Added Qt::TimerId enum class, that is used to
represent timer IDs.

Change-Id: I0e8564c1461884106d8a797cc980a669035d480a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-03 19:56:55 +02:00
Ahmad Samir bd764cc1ca Add QChronoTimer, a timer with nanoseconds precision
The interval in QTimer is a QProperty of type int, which means it's
limited to the number of milliseconds that would fit in an int (~24
days), this could cause overflow if a user constructs a QTimer with an
interval > INT_MAX milliseconds. And it can't be easily changed to use
qint64/std::chrono::nanoseconds:
  - changing the getters to return qint64 means user code would have
    narrowing conversions
  - the bindable QProperty interval can't be changed to qint64 during
    Qt6's lifetime without the risk of breaking user code
  - adding a new bindable QProperty that is qint64/nanoseconds is an
    option, but it has the complication of what to do with the int
    interval; set it when setInterval(milliseconds) is used by using
    saturation arithmetic? and what about notifying observers of the
    changed interval?

Thus the idea of creating a new stop-gap class, QChronoTimer, as a
cleaner solution. Both classes use QTimerPrivate.

During the lifetime of Qt6, QTimer's interval range is about 24 days,
whereas QChronoTimer's interval range is about 292 years
(duration_cast<years>nanoseconds::max()).

Currently the plan is to fold QChronotTimer back into QTimer in Qt7.

Mark all QPropertyS in the new class as FINAL since they aren't
intended to be overridden; this offers a performance boost for QML[1].

[1] https://lists.qt-project.org/pipermail/development/2024-February/044977.html

[ChangeLog][QtCore] Added QChronoTimer, which uses a
std::chrono::nanoseconds intervals, as a replacement for QTimer.

Fixes: QTBUG-113544
Change-Id: I71697f4a8b35452c6b5604b1322ee7f0b4453f04
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-03-03 19:56:55 +02:00
Ahmad Samir 4fa9034d0c Copy QTimer source files to QChronoTimer
Ultimately this is the best way to keep the log history of the code.

Change-Id: I3413deffdb093a3239d65b6ca939e744224e722a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-03 19:56:55 +02:00
Volker Hilsheimer 8d613f8a94 JNI: support construction of QJniArray from std::initializer_list
Add implict constructor, treat the list like any other container.

Simplify the test code, and explicitly constructor-initialize when
we want an array and might have an array, so that we don't end up
with constructing arrays of arrays.

Change-Id: I14615f897cf8a2188510cfe1085ffc70a2396d5d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-02-26 20:17:27 +01:00
Volker Hilsheimer a730c42608 JNI: Support QStringList as a parameter of native functions
Since we support QString and QList specializations, we should also
support QStringList directly. That's a bit more involved as we need
to specialize the code path for QString, which is not convertible to
or from jobject. But once we have mapped the type to jstring it
follows the implementation for lists of objects.

We now need to generate temporary local references when
converting a QString to a jstring, so manage a local frame. We do
so explicitly in chunks of 100 local references.

Change-Id: I7ae5cf7d0ba0099992c36f3677980c346526804b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-02-23 19:11:04 +01:00
Volker Hilsheimer f4eef86137 JNI: implement support for native functions taking a list
This didn't work yet because the partial specialization of the
JNITypeForArgImpl factory was missing. Add a test case for
QJniArray<double> and QList<double>.

What doesn't work (yet) is QStringList for a native Java function
taking a String[]. That will be added in a follow-up commit.

Change-Id: I4d3fa0ecc04b98b9749f8358792f86c02ddbbc14
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-02-23 19:11:04 +01:00
Ahmad Samir 026e1e3fdb QTimer: use QTest::ingoreMessage() for negative internvals tests
Pick-to: 6.7 6.6 6.5
Change-Id: I87d095b748a7488a71b22710ab7ed72d9451c769
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-02-15 22:35:00 +02:00
Ivan Solovev 612b67cf13 QTimer: do not set active state when setting a negative interval
QObject::startTimer() returns 0 in case of failure, for example when
someone tries to register a timer with a negative interval.

However, QTimer internally uses -1 as an invalid timer id.
This could lead to a situation when the timer was not really started,
but QTimer::isActive() returned true.

This patch fixes it in two ways:
- check the return value of QObject::startTimer() and treat 0 as an
  error.
- do not treat 0 as a valid timer id when calculating the active state.

As a drive-by: move the `using namespace std::chrono_literals;`
declaration to the top of tst_qtimer.cpp, so that we do not need to
repeat it in each test case.

Fixes: QTBUG-122087
Pick-to: 6.7 6.6 6.5
Change-Id: I0e21152b2173ebb5fb0dada1b99a903a321ca9c4
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-02-12 23:49:54 +01:00
Jarek Kobus 0d0810e2dc QObject: fix installEventFilterOrder() test flakiness
Don't rely on timer precision and use int counter instead.

Amends 1fe88bf4cd

Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: I057b4dd51014784ec9b244301b43583f3de6ddd1
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-02-04 18:33:37 +01:00
Lucie Gérard ff1039c217 Change license for tests files
According to QUIP-18 [1], all tests file should be
LicenseRef-Qt-Commercial OR GPL-3.0-only

[1]: https://contribute.qt-project.org/quips/18

Pick-to: 6.7
Task-number: QTBUG-121787
Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2024-02-04 09:56:42 +01:00
Ahmad Samir 1fe88bf4cd QObject: add unittest to check the order of eventFilter() calls
installEventFilter() prepends new objects to the eventList, so that
events that are posted while processing events are left to the next
round of event processing.

This is a baseline test to check that subsequent commits preserve the
current behavior.

QCOMPARE_GT is available since Qt6.4, so make the check backportable to
older releases too.

Pick-to: 6.7 6.6 6.5 6.2 5.15
Task-number: QTBUG-120779
Change-Id: I5ed5e9c2917a9be62de4af19c3b72889399b4fe6
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-02-01 23:42:56 +02:00
Volker Hilsheimer cfcd56a78f JNI: Fix QJniObject::callback test case
Don't call the native function directly, call the Java function that
calls the native function.

Pick-to: 6.7
Change-Id: Icdcf250313a38f6e4bc2b90fb7b0adbfa5a890fb
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2024-02-01 14:22:35 +01:00
Volker Hilsheimer cc5251ed59 QJniArray: make reverse-iterable
Add rbeing/rend overload, relevant typedefs, and decrement operators.
As a drive-by, add noexcept to begin/end functions.

Found during header review.

Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: I32d9a7d50a1f03550944c2247516c455d4822fe7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-29 16:06:47 +01:00
Volker Hilsheimer e5074cd354 QJniArray: add missing post-increment operator
Augment test case. Found during header review.

Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: I326395397167edb05ff1f45f7151614c02b7e7eb
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-29 16:06:47 +01:00
Volker Hilsheimer 8f04615bcd QJniArray: add missing typedefs
Add missing nested typedefs for both the QJniArray container and
the QJniArrayIterator. Expand test case to make sure that some standard
algorithms (such as std::distance and ranged for) work with those
types.

Found during header review.

Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: I96f348215c6f1e0e1ce777d9bdd2f172d7e52974
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-29 16:06:47 +01:00
Fabian Kosmale ac001bef79 moc/QMetaProperty: Remove limitation on non-own-class notify signals
The moc generated code does a sanity check that NOTIFY signals actually
exist in the parent class when they cannot be found in the class moc
currently runs on.
The logic there was however too simplistic, and couldn't deal with
signals taking a parameter.
Fix this, and take the opportunity to use a proper static_assert instead
of generating a "normal" compile error.

We do not do any checks for the presence of QPrivateSignal, as the whole
point of QPrivateSignal is that it should be private (and not e.g.
protected).

Moreover, we adjust QMetaProperty::notifySignalIndex to take
single-argument notify methods into consideration as well when
encontering an unresolved notify index.

Fixes: QTBUG-115989
Pick-to: 6.7
Change-Id: I8a056a15777f3132691e207b4b9ab6c2c9b2126d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-01-26 14:51:35 +01:00
Christian Ehrlicher e752c77b35 QObject: Let moveToThread return succcess state
Add bool QObjectPrivate::moveToThread() which returns the success state
of the attempt to move the object to the new thread. For Qt7 the public
signature of QObject::moveToThread() should be changed to directly
return this value.

[ChangeLog][QtCore][QObject] QObject::moveToThread() now returns a
boolean success state.

Pick-to: 6.7
Change-Id: I8441c8155a76b804b473ab9c45c2be6840ef1677
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-24 21:35:09 +01:00
Volker Hilsheimer 100071af82 QJniArray: fix const_iterator declaration, make it default-constructible
Iterators are required to be default-constructible and
value-initialized iterators must compare equal.

In a const_iterator, the pointee should be const, not
the iterator itself.

Found during header review.

Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: I036c0a62ade8c59dc5d62c0823b375223719af3f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-24 00:26:37 +00:00
Volker Hilsheimer 2c9525a501 QJniArray: add test case for QJniArray::size
Fix build of the test by removing the reference from the
container type before accessing the nested typedef.

Pick-to: 6.7
Change-Id: Ic35f312bac70b8f8f80149a3432329070c8c8c7d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-23 13:56:54 +01:00
Ahmad Samir afddb327bd QObject: assert connection type isn't UniqueConnection for lambdas
An assert is harder to miss than a warning, which makes it more likely
to get fixed. Thanks to Mårten Nordheim for the idea.

Add the assert in inline code so that users compiling their code in
debug mode (or with -DQT_FORCE_ASSERTS) can hit the assert even when
built agaist a release build of Qt (not everyone compile their code with
a debug build of Qt). Thanks to Giuseppe D'Angelo for the idea.

Pick-to: 6.7 6.6 6.5
Task-number: QTBUG-115125
Change-Id: I2935d32ea5a2c288d7a836abbae66ac53cb5ab2f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-12-22 19:16:47 +02:00
Volker Hilsheimer 240ea74b25 Blacklist QEventLoop test on QNX
Both the GUI and core version of that test is flaky on QNX.

Pick-to: 6.7 6.6
Task-number: QTBUG-119359
Change-Id: Ied7013e04bdd12270a84ab32d2bd4e45c52136c3
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
2023-12-18 21:55:14 +01:00
Volker Hilsheimer a936b86ec8 JNI API review: minor API and implementation cleanups
- prefix ValidField/SignatureTypes predicates with "If"
- make QJniArray SMF constexpr and noexcept
- remove const from return-by-value QJniArray functions
- rename QJniArray::asContainer to toContainer
- constrain QJniEnvironment::registerNativeMethods to valid class types
- don't home-grow std::forward
- make default QtJniTypes::Object constructor implicit
- don't include copy/move constructors in QtJniTypes::Object variadic
  constructor

Pick-to: 6.7
Change-Id: Ied02993d32d8b0f3ef1e571b75ada15ede1f8389
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-12-15 12:17:17 +01:00
Po-Hao Su 311f889632 QProperty: clean up unnecessary sentinel class
Instead of introducing the nested class InheritsQUntypedPropertyData
as a sentinel class for inheritance check, we can use BinaryTypeTrait
to handle the check. By doing this, we no longer need to maintain the
nested class.

Change-Id: Ie3aae976015d5fae6b6d072cad6ee52cd30b769d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-12-09 08:37:44 +08:00
Thiago Macieira ead408ca1b QMetaType: fix typenameHelper() for types in the QtPrivate namespace
GCC at some point decided that it wouldn't include the full namespace
expansion in __PRETTY_FUNCTION__ for any type that is in the same
namespace as the template function being expanded (that is, the
QtPrivate) namespace. I don't know how long this behavior has been in
place, but it can be seen with GCC 13, where the expansion of that macro
inside QtPrivate::typenameHelper<QtPrivate::ModelIndex>() is:

 constexpr auto QtPrivate::typenameHelper() [with T = ModelIndex]

This can be easily worked around by using a different namespace.

Fixes: QTBUG-119650
Pick-to: 6.6 6.5 6.2
Change-Id: Ica7a43f6147b49c187ccfffd179df309e43a70cb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-12-08 14:03:55 -08:00
Ahmad Samir 9e6c9eda6f QMetaEnum: let key(s)ToValue match fully-qualified unscoped enumerators
For an unscoped enumerator, e.g.:
namespace N {
    class C {
        enum E { F };
    };
};

N::C::F and N::C::E::F are equivalent and key(s)ToValue should match
both.

This already works for scoped enums because the name of the enum can't
be dropped.

Fixes: QTBUG-118240
Pick-to: 6.6
Change-Id: I84d7bbb7aa8f82b2a7c2bc7e4edd5d77d37335c4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-26 22:51:49 +02:00
Edward Welbourne 7befd4cad4 Purge empty BLACKLIST files from tests
There's no point to the file if it has no content.

Change-Id: Ie0deb59a63d5f7a654fcab1218e0a814710072ff
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2023-11-24 18:09:16 +01:00
Edward Welbourne 9f3ae15933 Add a comment to tst_qtimer.cpp to point out its reuse by QtGui
The same test code is compiled by two different modules' tests, which
won't be obvious to the reader of the code unless it's pointed out
explicitly.

Change-Id: I99dba6eb186939c372636c5c1fc29799003d32a7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-24 15:37:17 +01:00
Volker Hilsheimer d2c6e9ab99 Blacklist tst_QGuiEventLoop::processEvents on QNX
The test log shows flaky failures of this test several times a day on
QNX, so blacklist it.
To do that, we need to be able to isolate the "GUI" mode of this test.
To do that, add a single data tag that depends on whether the test
project is built for GUI or Core, and blacklist only the "gui" data tag.

Task-number: QTBUG-119359
Pick-to: 6.6
Change-Id: I91c2380de0a3febedcf781f27fed4a1fa6aa5515
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-11-22 21:15:38 +01:00
Rym Bouabid bf946e8e3b QObject: allow calling findChild() without a name
Add an overload of findChild() without a name argument to be able to
call the function with options value only.

[ChangeLog][QtCore][QObject] Added findChild() overload taking no name.

Task-number: QTBUG-103986
Change-Id: Id06b6041408fcf4cc1eeba975afce03f3a28f858
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-11-22 14:42:17 +00:00
Ahmad Samir 9cf47946fc tst_QTimer: refactor CMake code
It's used to build different variations of the unittest,
linking against QtCore-only/QtGui, with/without GLib, that's four
individual tests.

Change-Id: Iaf0f37041dbb148134631f86be99feaa881a8ce8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-11-22 06:34:29 +02:00
Rym Bouabid e608bc0192 QObject: port findChild/ren() to QAnyStringView
Change the object's name type in QObject::findChild/ren() to
QAnyStringView, because they are only used for comparison against
objectName property.

qt_qFindChild{,ren}_helper() functions taking an objectname as
QString have to stay in the ABI as they were exported in inline
methods before Qt 6.7.

Unlike QString, constructing a null QAnyStringView doesn't involve
any code-size overhead. So, get rid of the split in qt_qFindChildren_helper
that was introduced for QString. Remove unneeded
qt_qFindChildren_with_name helper function and qt_qFindChildren_helper
overload without a name.
findChildren(options) method used to call qt_qFindChildren_helper overload.
Instead, call findChildren overload with name argument and pass
QAnyStringView{} as the object name.

[ChangeLog][QtCore][QObject] Ported QObject::findChild/ren() and
their helper functions to QAnyStringView.

Task-number: QTBUG-103986
Change-Id: I68bda0e581f984ae48b7581ad86cc1b95008c1b0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-11-22 01:26:46 +01:00