[ChangeLog][QtCore][QResource] Added uncompressedSize() and
uncompressedData(), which will perform any required decompression on the
data, prior to returning (unlike data() and size()).
Change-Id: Ief874765cd7b43798de3fffd15aa053bc505dcb1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
They overlapped and the latter had duplicated code, so make them into
a single data-driven test. At the same time, replace the '-' at the
start of the expected string with QLocale::negativeSign(), since the
test fails otherwise when LC_NUMERIC=nb_NO on Linux (Debian/testing).
Change-Id: I051c75abff16b2e6f8278fcb152b6bde14c71f9a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use QStringIterator rather than indexed loops. This fixes handling of
non-BMP code points (which may be lower or uppercase, see the test).
Change also the semantics of the functions, adopting Unicode §3.13
definitions: a string is lowercase/uppercase if it's equal to its
own toLower/toUpper folding.
As a side effect, empty strings are now correctly reported to be
lowercase AND uppercase.
[ChangeLog][Important Behavior Changes] The semantics of
QString::isLower() and QString::isUpper() have been changed to match the
Unicode specification. Now lowercase (resp. uppercase) strings are
allowed to contain any character; a string is considered lowercase
(resp. uppercase) if it's equal to its own toLower() (resp. toUpper())
folding. Previously, a non-letter character would make the string not
lowercase nor uppercase, and the mere presence of an uppercase (resp.
lowercase) letter would make isLower() (resp. isUpper()) return false,
even if the letter wouldn't change under case folding. As a
consequence, now empty strings are lowercase and uppercase.
[ChangeLog][QtCore][QString] Fixed a number of bugs of
QString::isLower() and QString::isUpper(). Empty strings are now
correctly reported to be lowercase (resp. uppercase), and strings
containing code points outside the BMP are now correctly handled.
Note that the behavior of these functions has also been changed.
Change-Id: Iba1398279a072399a9f21295fe75f6e414f3f813
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The windows filesystemwatcher did not watch for attribute changes for
directories (e.g. hidden flag) so it was not in sync with other
backends. Fix it by adding FILE_NOTIFY_CHANGE_ATTRIBUTES to the watch
flags when watching a directory.
[ChangeLog][QtCore][QFileSystemWatcher] Fixed a bug that caused QFSW not
to watch for attribute changes on Windows. Now it will correctly report
when files and directories become hidden or unhidden, for example.
Fixes: QTBUG-80545
Change-Id: I31767a0da899963e3940b4f5b36d1d581e6aa57c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The actual logging code, qt_message_print(), uses toLocal8Bit(), so
testing by comaring with toUtf8() isn't robust.
Change-Id: I7d6614e4af8c679674dbbf4ff47a88b2b75fc2dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Fix tst_QNoDebug::streaming() to use toLocal8Bit(), to match
QTestLog::ignoreMessage(), which uses fromLocal8Bit().
Change-Id: I65f7b995a582aeab7b7ba61781a229fecd1ed3c3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
... in docs, comments, and warnings. Also adopt
some occurrences around there and in the snippets.
Change-Id: Icc0aa0868cadd8ec2270dda794bf83cd7ab84160
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
In the presence of multiple overloads of a function taking either
QString or QStringView, QStringView should always be preferred.
The rationale is that the QStringView overload may have been
added "later" (read: the function was written when QStringView
was not available yet, so it took QString), and the fact that
a function with the _same name_ offers a QStringView overload
implies the function never needed to store/own the string in
the first place.
Add a (compile-time) test for this preference. This is in
preparation for a future QString(char16_t*) constructor
(in Qt 5.15 / Qt 6).
Change-Id: I60a435e494b653548f8f8d52c5d7e7cac2cc875a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Deprecated the SAX classes and disabled or replaced their uses in
tests if applicable.
Removed the saxbookmarks example, no point in keeping examples for
the deprecated code.
[ChangeLog][QtXml] SAX classes are now deprecated. Use QXmlStreamReader,
QXmlStreamWriter in QtCore instead.
Task-number: QTBUG-76177
Change-Id: Ic171d62fa0527b0f36f94cf09a69586092269957
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Conflicts:
src/corelib/tools/qvector.h
Make QVector(DataPointer dd) public to be able to properly merge
5b4b437b30 from 5.15 into dev.
src/widgets/kernel/qapplication.cpp
tests/auto/tools/moc/allmocs_baseline_in.json
Done-With: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Change-Id: I929ba7c036d570382d0454c2c75f6f0d96ddbc01
It used to be "iterator", causing a qdoc warning:
src/corelib/serialization/qjsonobject.cpp:1405: (qdoc) warning: clang found diagnostics parsing \fn int QJsonObject::const_iterator::operator-(const_iterator other) const
error: out-of-line definition of 'operator-' does not match any declaration in 'QJsonObject::const_iterator'
Add a small test.
Change-Id: Id65effffa720ed1e0fb0ee6937dcc4298f3ef363
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
In Qt6 there is a behavior change with extra stuff after the seconds -
it's no longer allowed and will result in an invalid QTime.
This was introduced with bf65c27789 but
the autotests were not adjusted for it.
Change-Id: Ia78f4f2a8019e46d9d0e8e8b8918a3ab2d4638e2
Reviewed-by: Liang Qi <liang.qi@qt.io>
If a type has both a converter to QVariantList and to
QSequentialIterableImpl registered, we would have chosen the
QSequentialIterableImpl version. In the case of types like QJSValue,
this is more costly. With this change we therefore uses the direct
conversion if it has been registered.
The same applies to QAssociativeIterableImpl and
QVariantHash/QVariantMap.
Change-Id: I9c0b5068efe4bfbc5e0598a200e6db59201e9974
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
It makes sense for it (instead of triggering the QAbstractItemModel
base class implementation, which doesn't do anything). Safe to override
virtuals in this case -- code calling the old version could not do
anything useful, so at least new code gets those functions properly
implemented for free.
Change-Id: Iefe1ff25e15d877435e93ab28289ad2579616f72
Task-number: QTBUG-48076
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: David Faure <david.faure@kdab.com>
Add a light-weight associative container, API-wise very similar to QMap,
that's based on two sorted continuous containers (QVector by default).
The class is internal for now.
Change-Id: Ife12576c4abb39a3ea2acb0a1ba0faca91b3a4c5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
In Qt6 there is a behavior change with extra stuff after the seconds -
it's no longer allowed and will result in an invalid QDateTime.
This was introduced with bf65c27789 but
the autotests were not adjusted for it.
Change-Id: Iee6a9a7ac6cbb2754a68e082bb7074d17fac9d9c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
When QLocale::Country is set to QLocale::India numbers are written so that
after first three from the right and then after every second will be comma.
E.g. 10000000 is written as 1,00,00,000
Task-number: QTBUG-24301
Change-Id: Ic06241c127b0af1824104f94f7e2ce6e2058a070
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Teemu Holappa <teemu.holappa@qt.io>
QString(View)s can be built or manipulated in ways that make them
contain/refer to improperly encoded UTF-16 data. Problem is,
we don't have public APIs to check whether a string contains
valid UTF-16. This knowledge is precious if the string is to be fed in
algorithms, regular expressions, etc. that expect validated input
(e.g. QRegularExpression can be faster if it can assume valid UTF-16,
otherwise it has to employ extra checks).
Add a function that does the validation.
[ChangeLog][QtCore][QStringView] Added QStringView::isValidUtf16.
[ChangeLog][QtCore][QString] Added QString::isValidUtf16.
Change-Id: Idd699183f6ec08013046c76c6a5a7c524b6c6fbc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It is useful to use an array of bit as an integer value.
I add also a prarameter to set endianness when converting
value to UInt32.
[ChangeLog][QtCore][QBitArray] Added toUInt32() to return
the bit array's value as a uint32_t.
Change-Id: I9d8c7a33f11e7ce94cb67aa9a50b11fa42d56168
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QStringListMode::moveRows() had an issue when the destination was before
the source row.
Change-Id: Icf64e5b4cdd6a39faf3ba4ccc3883196b247ccbd
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: David Faure <david.faure@kdab.com>
We're now using the same infrastructure for QVector,
QString and QByteArray.
This should also make it easier to remove the shared null
in a follow-up change.
Change-Id: I3aae9cf7912845cfca8e8150e9e82aa3673e3756
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
QItemSelectionModel::columnIntersectsSelection() should honor the parent
according to the docs. For rowIntersectsSelection() this was fixed a
long time ago but columnIntersectsSelection() was forgotten.
Sync the both functions and use range-based for loops as a drive-by.
Fixes: QTBUG-80644
Change-Id: Iaf08f85e2225204d1e6564fa4bb0bc826352ed53
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
As opposed to unite(), this inserts one map into the other
without duplicating elements.
Task-number: QTBUG-35544
Change-Id: Ie8ab350b29148851a3176cef1007e8a4ca82c273
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This flag is used in QSequentialIterable and QAssociativeIterable to indicate
that the data pointer in VariantData should be deleted after the variant has
been constructed.
The use case for this is
https://codereview.qt-project.org/c/qt/qtdeclarative/+/284151, where we have
a proxy iterator and cannot easily return a pointer to already owned data, as
it is hard to manage its lifetime in the iterator. In contrast, it is clear
that we can release the memory in the QSequentialIterable functions, as it has
already been copied into the QVariant there.
Change-Id: I2b33497d991cd4f752153e0ebda767b82e4bb851
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This saves us from having to bootstrap rcc in regular (non-cross)
compilations, as it can now link to QtCore. Actually un-bootstrapping
rcc is left as an exercise for the reader.
This commit discovered that MSVC cannot handle constexpr arrays bigger
than 256 kB, at which point it simply starts claiming that the constant
expressions using it are not constexpr. ICC has a similar problem at
64 kB, but it tells you why ("note: type "const unsigned char [65537]"
too large for constant-expression evaluation").
Note also that this requires gzip or zstd to be in PATH for compression
to happen. RCC linked to zlib, which is always present due to the
bundled copy. gzip's presence is not likely to be a problem on Unix
systems, but could be for Windows users, especially MSVC ones. If gzip
is not present, QtCore's size will increase by about 1910 kB of
read-only (sharable) data.
Change-Id: I2b1955a995ad40f3b89afffd15a3e65a94670242
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
ISO date format doesn't allow spaces within a date, although 3339 does
allow a space to replace the T between date and time. Sixteen tests
added to check this all failed. So clean up the handling of spaces in
the parsing of ISO date-time strings.
[ChangeLog][QtCore][QDateTime] ISO 8601: parsing of dates now requires
a punctuator as separator (it previously allowed any non-digit;
officially only a dash should be allowed) and parsing of date-times no
longer tolerates spaces in the numeric fields: an internal space is
only allowed in an ISO 8601 date-time as replacement for the T between
date and time.
Change-Id: I24d110e71d416ecef74e196d5ee270b59d1bd813
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
even if we are currently inside processEvents (apparently called manually
and not from QEventLoop::exec()). A carefully crafted application
(see, for example, the linked QTBUG or even updated auto-test)
can trigger itself into failing to exit the current (potentially nested)
event loop. We can harden our Cocoa event dispatcher to detect
such condition and properly propagate 'interrupt' to where it'll
do its job, indeed, interrupting the real event loop (aka [NSApp run]).
This mainly means we have to undo what bool blocker would erroneously do.
Also, long live (as people love to say these days) to another tricky
(somewhat) auto-test (surely, it's not flaky!).
Fixes: QTBUG-79477
Change-Id: I794f0cda23e24d36be67f2bb63d52b74be057c31
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Preparations to move QString over to use QArrayDataPointer instead
of it's own private struct.
Change-Id: I7796a595393394083f6a85863e3c710ebbdea149
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The goal here is to move things over to QArrayDataPointer. This prepares
for it.
Change-Id: I32f54a47594274799600c618f7341c200ceaa306
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>