Replace various QFETCH()/QCOMPARE() pairs with QTEST().
Just because it's terser.
Change-Id: I8496a293e3634991dcb33b8c7939f1c3028a63c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
In the fontconfig, the fonts will be populated with the variable font
and the named instance from the variable font. In this patch, it will
skip the variable font, and populate the named instances from the variable font.
The FcFontMatch function ignores the FC_INDEX when match the font,
changed the code to match the FC_INDEX by iterate the font list.
[ChangeLog][Fonts] Added support for the named instances from the variable fonts.
Pick-to: 6.7
Fixes: QTBUG-111994
Fixes: QTBUG-112136
Co-authored-by: Peng Wu <alexepico@gmail.com>
Change-Id: Ic598d69a1e76109958fafa1226ea927656092319
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
When a QMessageBox is created with setModal(true), the user can in theory
choose to show() it, and then return back to the main event loop, instead
of calling exec(). We tried to support that case via a single shot timer,
called on the next pass of the event loop, that checked if the applications'
current modal window was the alert, and if not, showed it at that point.
That logic failed when there were more than one alert show at the same
time.
We do maintain a stack of the modal sessions and their windows in the
Cocoa event dispatcher, so we could use that to check if a modal session
had been started for the alert's window, but a similar solution is to
just check the alert window's visible state.
Fixes: QTBUG-121557
Pick-to: 6.7 6.6 6.6.2 6.5
Change-Id: I6f52a53e8f678bb8a071e334a09ab30669d95bbf
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Back when we set the guard and _then_ destroyed the object, the
atomic_thread_fence was correctly placed between the guard setting and
the dtor invocation.
We know nothing about the payload type. For all we know it could be
some fancy lockless data structure. So in general we need the acquire
fence to synchronize the reads done by the dtor with stores performed
to the object in other threads. The acquire fence did that for us.
But when we reversed the two operations, the fence has moved to after
the dtor call, leaving the dtor unprotected. Move it back to before
the dtor call.
That leaves the store to the guard unordered w.r.t. the execution of
the destructor. To fix, make it a store-release instead.
Amends e3e2674100b1ecbad7117f15c7aa13a704a7d34e.
Pick-to: 6.7 6.6 6.5
Change-Id: Ic7adbe17c8b474e82af4e84950c0109984b495d1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of separate QJsonObject and QJsonArray types.
Resulted from API-review
Pick-to: 6.7
Change-Id: I977d692d3709a8c3aa872683ddda54a143c25e67
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This naming should make it clearer that (successful) calls to
readJson(), readBody(), and readText() consume the data received
so far.
Resulted from API-review
Pick-to: 6.7
Change-Id: I09ca9eac598f8fc83eecb72c22431ac35b966bf5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
In operator<<(), stream the QJsonDocument directly, instead of
toJson(Compact).
This is how QJsonDocument operator<<() also does things, but that
knowledge should be need-to-know, and QJsonArray doesn't, seeing as
operator>>() just streams a QJsonDocument, and then calls toArray().
Pick-to: 6.7 6.6 6.5
Change-Id: Ia378bf0fb04ce33e3af24a2ce67778e89c41e31a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
The only user of the vector passes begin()/end() to BitIStream, which
appears to be 64-bit-clean.
Pick-to: 6.7
Change-Id: I4ad0b9e9547008fecc4c816cc92ff9db4b2066e3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
To accommodate the deduplication and non-owning changes
in previous commit.
Resulted from API-review
Pick-to: 6.7
Change-Id: I61eb071503d6714c7fd42b3fe533698a8dcd2e27
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
To accommodate the deduplication and non-owning changes
in previous commit.
Resulted from API-review
Pick-to: 6.7
Change-Id: Ie1c4e9959c1ba7e8ed2be6607d9f6497ae15af39
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Note: documentation will be updated in a follow-up commit
This commit makes QRestReply and QRestAccessManager
classes lighter, non-owning wrappers. Furthermore their
APIs don't duplicate the wrapped QNetwork* APIs.
This makes it easier to use / opt-in to these helpers
in pre-existing applications which are based on
QNetworkAccessManager and QNetworkReply.
Since APIs are no longer duplicated, the QRest
classes are more obviously a convenience _wrapper_,
as opposed to being an alternative vertical stack.
In practice this change consists of:
- QRestAM never instantiates QNetworkAccessManager,
but accepts it via constructor. It does not take
ownership of the QNetworkAccessManager.
- QRestReply accepts QNetworkReply via constructor. It
does not take ownership of the QNetworkReply
- Signals and most duplicated functions are removed
from both QRestAM and QRR.
- QRestReply is no longer a QObject
- Since QRestAM doesn't have much to report anymore,
the debug operator is dropped.
Resulted from API-review
Pick-to: 6.7
Change-Id: Ib62d9cc2df41cac631396a84bb7ec4d2d54b0c8c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
If the line width is negative, then we might exit the layout
loop before consuming any text, and thus the loop will never
finish. This is a side effect of a change for maximumWidth:
991c056438b311566bc4ea543af0f33dfd5dffbb.
49a63d375972079ae3000c8b7d512d58d4de32bb fixed this issue for
QTextLayout::setFixedSize(), but I forgot to do the same in
the overload of QTextLayout::setNumColumns() which includes
an alignment width and therefore sets the line width in addition
to the column count.
Basically, we just make sure the line width is never negative so
that the width > line.width condition also means the width > 0.
Pick-to: 6.5 6.6 6.7
Fixes: QTBUG-115459
Change-Id: If904bfc64cd74e819a0864db55fa9555073d0781
Reviewed-by: Vladimir Belyavsky <belyavskyv@gmail.com>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Small rearrangement to make diff on later variant/union commit
more readable
Pick-to: 6.7
Task-number: QTBUG-119002
Change-Id: I3f6120b5dcd324b6493072d2eb58209866fb7dc6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The implementation calls a const member function on the QJniObject
passed in, and no move happens. And the parameter is not a universal
reference either.
Found during header review.
Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: I9479df798178b089277aa230f50f4e73f38ceb2c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
QJniObject is not prepared for being subclassed (no virtual destructor),
and doing so is formally UB.
Instead of making QJniArray(Base) a QJniObject subclass, give it a
QJniObject member and make it convertible to/from QJniObject. Existing
code still works with this change, even though it removes all the
inherited QJniObject APIs for accessing fields and methods. However, as
the Java array classes have a very narrow and well-defined API anyway we
could, if needed, add those as C++ member functions instead of going
through calling-by-string.
Found during API review.
Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: Ic4437116eed5e15226449bdabe48ab657cb14dc3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Java still only can handle arrays of at most 2^31 entries, and the JNI
API for working with arrays is using types that are essentially int.
Assert that the container passed in is not larger than that.
Found during API review.
Task-number: QTBUG-119952
Pick-to: 6.7
Change-Id: Ia0cbdbf098cf5b2c8ec50f0dd24dadf833bf40d0
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
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>
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>
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>
Version 883ced078a83f9d79a98933145425c221a5e51f0, fetched on
2024-01-25.
[ChangeLog][Third-Party Code] Updated the public suffix list to upstream
SHA 883ced078a83f9d79a98933145425c221a5e51f0.
Pick-to: 6.7 6.6 6.5 6.2 5.15
Task-number: QTBUG-121325
Change-Id: I95e82b5c351218c1641e11e7a166ae21be2c5ad6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
QCalendar is not a trivial type, so using it as a default argument in
various fromString() overloads introduces an extra overhead.
In this case the function actually always needs a QCalendar object,
and a default-constructed QCalendar reproduces a valid gregorian
calendar. But getting rid of a default argument still gives us the
benefit of constructing the object only in the library, not at every
call site.
So, split each overload into two - with and without a QCalendar
argument.
Amends 41f84f3ddb780ec751e3fc706dd242fc4a99de7a
Found in 6.7 API review
Pick-to: 6.7
Change-Id: I7329276cbda0e5471dc5348af92fc8c9ca4e0738
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
MS says we should stop using LCID, so make a note about that.
This file should only be compiled when Q_OS_WIN is defined, so
don't bother with #if-ery to check that.
Remove two redundant forward-declarations.
Record what qt_localeFromLCID is for - undocumented private API
exported for the use of a platform plugin - since that isn't
immediately obvious to someone only looking at QLocale.
Change-Id: I81ad945bb92d4f81a3ca2aaf97a945635b137a2e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Giving it a symbolic name is clearer (and saves me the need to
duplicate the comment when I add some more references to it).
This amends commit bcdd51cfae24731a73d008add23d3c1e85bbd8d0
Task-number: QTBUG-115158
Change-Id: I7577e0cde783fcda840009c7aea46934964c6e4c
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
The existing caller returns early on finding a match, so never ran off
the end of the iteration unless there were no matches. I'll soon be
adding a new caller that wants to iterate all matches, so will run off
the end even when there are some. So only raise the Error if we found
nothing.
Task-number: QTBUG-115158
Change-Id: I1cae4674eb5e83c433554c15ecc4441b756f20eb
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
The Supplement type did the needed mapping (using nodeValue when the
value wasn't a string) and it turns out to be useful to do the same
for the DOM object packaged by a Node, too. Pull out into a helper
function, use dict-comprehension and expose as a method of Node.
Change-Id: Ice6737a54a33372b45cf42152e3fdbf5f2da7ba4
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Actually triggered by investigating QTBUG-121485, where the issue
turns out to be at construction time, but the complete lack of any
testing of endonyms clearly needed addressed in any case. In the
process, break up the long list of private slots in the test-class
declaration.
Task-number: QTBUG-121485
Change-Id: I49021f78d3bea2e1e55b2755a45943ab3fc23722
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Every test row was following its locale-specific test with tests for
Irish and Greek day names, repeated regardless of the locale-specific
data. Express these tests as rows in their own right and shorten the
per-row testing, so we only do each once.
Change-Id: I8f919b50ac54423bacab6e5a9d34254b7db59a55
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In the process, change it to use QCOMPARE(A, B) rather than QVERIFY(A == B).
Change-Id: I26c64100b08aef43c56f5266c0de71f5cde12816
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The mutable operator[] method was marked as inline only at the
definition, not the declaration. This is known to cause compilation
failures on MinGW when the function is used in other inline
implementation (cf. e.g. QTBUG-56459). It's not, atm, but fix the
issue proactively.
Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: If805122d9f8dbd72641173509c4b860c20fc1cdc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Amends 104a0a9ecdb18d65e4d9075d87e8860c6c9d8335.
Right now it's no problem for the only two places we use it, but it
could be a problem if someone accidentally forgot when using the macro.
Pick-to: 6.7 6.6
Change-Id: I5dd50a1a7ca5424d9e7afffd17ae0a09dc7dd8c1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
On most platforms EWOULDBLOCK is defined to be equal to EAGAIN.
However on some platforms (like VxWorks) it is not the case.
Because of that, error returned from ::write is not handled properly on
such platform.
Since C++ does not allow duplicate switch labels, check if EWOULDBLOCK
and EAGAIN have different values before adding EWOULDBLOCK to the switch
statement.
Task-number: QTBUG-115777
Pick-to: 6.7
Change-Id: I659cb946f239733f5c57b2000fb4e3d296ed9153
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... to complement QTEST_THROW_ON_FAIl/SKIP environment variables.
This allows to conveniently test both modes by running each test
twice.
Task-number: QTBUG-66320
Change-Id: I8b2810e8345061c98472d846017de910a11e0657
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Add exception classes and use them to change the control flow for
QTEST_{FAIL,SKIP}_ACTION from return'ing from just the immediate
function to the full way to the QTestLib infrastructure, here we
filter them out.
There are three modes:
- If QT_NO_EXCEPTION, then we return
- If QTEST_THROW_ON_... is also defined, #error out
- Otherwise, if QTEST_THROW_ON_... is defined, always throw
- Otherwise, the decision is made at runtime (with defaults read from
QTEST_THROW_ON_... environment variables).
Three selftests depend on the old behavior, as they explicitly check
that multiple FAIL SKIP etc emerge, which the new framework, of
course, prevents. Locally disable throwing at the test function level.
Add initial docs and enable exceptions in all of the selftest
subprograms to facilitate switching between the two runtime-selectable
modes.
[ChangeLog][QtTest] Added QTEST_THROW_ON_FAIL and QTEST_THROW_ON_SKIP
C++ macros and environment variables that, when defined, change how
QCOMPARE/QVERIFY/QSKIP etc exit the test function on failure. Instead
of a return, exiting only the immediately-surrounding function, they
throw a special exception instead, thereby exiting from subfunctions
of the test function, all the way to QtTestLib.
Fixes: QTBUG-66320
Change-Id: I96c38d2a1dcdd9de84942cf448a8bbf3ab6d3679
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Markdown support in Qt has always been symmetrically including all the
features to the best of our ability: we can write all the same features
as we can read (including github extensions like tables and checkboxes),
except that we standardize the output (so it's not always identical to
what was read: headings always have hashes, not setext-style; code
fences and thematic breaks are regenerated, so we don't keep the same
style as the original; and so on), and we probably still have a few
bugs. And in fact QTextMarkdownWriter does not (yet) have logic to
restrict itself to CommonMark, even if it's requested by means of the
QTextDocument::MarkdownFeatures ctor argument. (Of course if
QTextMarkdownImporter reads a document with CommonMark-only restriction
applied, and then you rewrite the document with QTextMarkdownWriter,
presumably you would not have any GitHub features in the output.)
So the existing output from configure -list-features was misleading:
texthtmlparser ........... Kernel: Provides a parser for HTML.
textmarkdownreader ....... Kernel: Provides a Markdown (CommonMark and GitHub) reader
textmarkdownwriter ....... Kernel: Provides a Markdown (CommonMark) writer
textodfwriter ............ Kernel: Provides an ODF writer.
Amends e4079eca49adce16e31dac2a18d49d7a55817891
Pick-to: 6.7
Change-Id: Ic2d9664388bbf17cef41ca0eaad600485a1bb7ec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Means we don't need to allocate it on the heap and optional<> fits the
semantics of an optional object better.
Pick-to: 6.7
Change-Id: Id02c4847c2357c3033dce94b68787ed37d6ca276
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A leftover, the class used to have some SSL functionality.
Pick-to: 6.7
Change-Id: Ie987fe086b3e7e5583a9e69dd80e670b131d2832
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Tooling can then use this information to find the correct base class,
even absent C++ scoping information.
Pick-to: 6.7 6.6 6.5
Task-number: QTBUG-101141
Change-Id: I5350da8d2d9aaf5ec86027357131ebac1eb50372
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The definition of iterator_t, and, therefore, of is_compatible_range
depends on this, otherwise say, 0, is being treated as a valid range
and hits a hard error in adl_begin() when trying to call begin(int&).
TIL: decltype(auto) does _not_ SFINAE.
Fix by calculating the return type manually, re-enabing SFINAE.
Pick-to: 6.7 6.6
Change-Id: Icacd70554f4050ecaeb396c9ae60bc4f21a220c9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This was added in 1591a959876bc5a37aacc817e637400c72bf6623 on top of an
older version of md4c, but those casts now exist in upstream code,
which we upgraded to in c29a235833410fde4cb4d502f89129bccd7403f0
Pick-to: 6.7 6.6 6.5 6.2
Change-Id: Ia1a939ed69bcd52ac8afd91dbd574767b59032d6
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Given a dir A that has some files and a subdir B, when a model is set to
only show files, setting the root path to A, the filters are initially
respected. Setting the root path to B then back to A, the filters would
be ignored and B would be visible in the model.
Traversing the path elements in node() led to dir B getting added to
the bypassFilters hash table, which made filtersAcceptNode() bypass the
filters.
I couldn't find a commit explaining the logic behind using bypassFilters
(the trail goes cold at the 'Qt 4.5' mega commit). The only clue I found
was the "// always accept drives" comment in the code, which hints at
this being useful only on Windows(?).
Fixes: QTBUG-74471
Pick-to: 6.7 6.6 6.5
Change-Id: Icb9055524a28990c591e924634a63e29a49835aa
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Wrap the QMetaMethod::invoke() calls in a helper function in
preparation of filtering execeptions as part of QTBUG-66320. Rename
the existing helper function to make the old documentation comment
redundant.
Pick this back to LTS branch in order to avoid needless code
divergence going forward.
Pick-to: 6.7 6.6 6.5
Change-Id: I34ae24bf23ea21d7063016257908f925fc087298
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
It is needed for proper inet socket address working
on this platform.
Pick-to: 6.7
Task-number: QTBUG-115777
Change-Id: Icde7ff7baf257762339f5f72a783c92f6b297a46
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
GCC has a bug [1] that does not allow to specialize templates
outside of a namespace.
An attempt to build the test results in the following error:
tst_manualqdatastream.cpp:18:15: error: explicit specialization in
non-namespace scope ‘class tst_QDataStream’
Fix it by converting the template specializations into simple function
overloads.
[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85282
Pick-to: 6.7
Change-Id: I7803cce1687ca8ae992f1a57394346eb6fc90c8b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The file was added in fd48ce0b73c74dafd5db27bc1f2752ef665df7ef
by a TQtC employee, so the header should mention The Qt Company Ltd.
Pick-to: 6.7
Change-Id: Ib191d2d63656c42f783db87de489814d387dfbca
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This status is supposed to be used when the stream tries to read
or write more data than it is supported by the current platform.
For example, reading more than 2 GiB of data on a 32-bit platform will
result into this status, but it will work fine on a 64-bit platform.
This patch uses the new status in read operations.
Amends fd48ce0b73c74dafd5db27bc1f2752ef665df7ef
Found in 6.7 API review
Pick-to: 6.7
Change-Id: I675b1ee25fafba174ce8f94c3470dbb7893d6d9e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... by allowing d == nullptr to mean the empty state.
Needed to add a few guards and specialize QESDP::detach() to be able
to detach from nullptr.
This also gets rid of the partially-formed moved-from state. It's now
guaranteed to be empty.
Pick-to: 6.7
Change-Id: If874d7c69d91eb4babe667ae577f261610d52fd3
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
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>