Implemented a new proxy model to transpose the source model.
Rows will become columns and vice-versa.
Both flat and tree models supported.
[ChangeLog][QtCore] New class QTransposeProxyModel to
swap rows and columns of the source model.
Change-Id: I902963c6b81aa0f63b5ad2bddca538f28b565084
Reviewed-by: David Faure <david.faure@kdab.com>
Replace BackgroundColorRole/TextColorRole with
BackgroundRole/ForegroundRole and explicit deprecate them for 5.13
Change-Id: I6b0d99844a32d2f5fdfd1878317a7b7422b800d3
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
When QMimeProvider parses the shared mime database xml files,
it will read the <comment> element for mime comment and treat the
`xml:lang` attribute as locale language string. When no `xml:lang`
attr is provided, QMimeProvider will read the value and treat it as
a en_US locale string as the default key.
When we call QMimeType::comment(), it will try to get the locale
comment string with the default language (QLocale().name()), once
it can't find a matched result, it should return the default key
(which QMimeProvider set it as en_US locale before) as fallback.
Task-number: QTBUG-71314
Change-Id: I444f8159d6f19dfef6338cd79312f608d8f13394
Reviewed-by: David Faure <david.faure@kdab.com>
Follow the pattern of char and float, and treat shorts as a more generic
type in QVariant::canConvert()
Task-number: QTBUG-60914
Change-Id: Ib1cc7941ee47cb0fc0098f22f98a03cd6f6b63fe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Added operator[] to QCborValueRef and mutating operator[] both there
and in QCborValue. If the value (referenced) is not a container, it
is replaced with a map and a reference into the result is returned.
If the value is an array and the key is a string, negative, or more
than 0xffff, the array is first converted to a map.
Change-Id: Ibbc9e480fb25eb3d05547c8a1b99e762b2a68b68
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The bitmap cache for the first 64 signals being connected was only set when the
connection is added. It was never unset when the connection was removed.
Internal use of the connectedSignals bitmap is not hurt by it occasionally
saying a signal is connected even though it is not, since the purpose of those
checks is avoiding expensive operations that are not necessary if nothing is
connected to the signal.
However, the public API using this cache meant that it also never spotted
signals being disconnected. This was not documented. Fix the behavior by only
using the cache if it is up to date. If it is not, use a slower path that gives
the correct answer.
To avoid making disconnections and QObject destructions slower, the cache is
only updated to unset disconnected signals when new signal connections are
added. No extra work is done in the common case where signals are only
removed in the end of the QObject's lifetime.
Fixes: QTBUG-32340
Change-Id: Ieb6e498060157153cec60d9c8f1c33056993fda1
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Spaceship operator was disabled for QCborValue, but not the test.
Change-Id: Icb91da689f62ef6de9f4fa926346505c5e50e9eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
PCRE2 does not support JIT on winrt. This test row takes a long time
(30 seconds here) without JIT and thus might cause test timeouts in
COIN when run on winrt.
Change-Id: I79d9f6be16dbe16594ae2bf51f353acd06b3d2fe
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This way there is only one for loop, which is more optimizer friendly
Change-Id: Iaa02026627d5259c3eea1ff5664e8f22664eef73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since Qt 5.10, qTo/FromBig/LittleEndian<float/double> stopped working.
It may be confusing, but big endian floats do exist, so not to break old
code, we should support them.
Change-Id: I21cdbc7f48ec030ce3d82f1cd1aad212f0fe5dd0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
the test is stable in Qt 5.12.
Task-number: QTBUG-60993
Change-Id: I0c366567121688d9518e90b5e8f9ec1b4006b7b9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
on macOS, where it was skipped but where it now seems to be stable/work.
Task-number: QTBUG-39983
Change-Id: I100a57f23b43074ebacc012be247d92acc6ae336
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
POSIX specifies that tzset() consults environment variable TZ and
modifies some globals; it also specifies mktime(), localtime() and
strftime() to behave as if they called tzset(). Fortunately, we only
call strftime() from a test and only call localtime() when not
threaded. Provide wrappers for tzset() and mktime() that share the
lock used by our environment-access code, to prevent races on the
environment (and tzset()'s globals) when we call them.
In the process, re-use tst_QDateTime's TimeZoneRollback in its older
test systemTimeZoneChange() and presume that this can now be tested
cross-platform, since TimeZoneRollback is used in another test where
this works.
Fixes: QTBUG-71030
Change-Id: I79f559b8857ea2803e73501008bf0d7158c6731f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This test triggered a compiler warning for good reason, it made no
sense, trying to change it to what it was probably meant to be.
Change-Id: I01a848272b42dae2aaa58a4f5bed998644d864da
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
QImage's operator>>(QDataStream&) did not set an error mode on the
stream on read failures. That would break QDataStream transactions.
Since the current QImage serialization cannot differentiate between
truncated and corrupted data, we set the ReadPastEnd error as expected
by the transaction system.
Also specify the expected file format on decoding QImage from stream,
to avoid all the format handlers' canRead() being invoked. This is
necessary since some of them may call ungetChar(), which fails when
the stream is in a transaction.
Also add testing of this feature to the QDataStram transaction
autotest. That required a slight rewrite of the fake sequential
QIODevice subclass. The previous implementation had incorrect
behavior of peek(), which is required by QImage decoders.
Task-number: QTBUG-70875
Change-Id: If3f1ca7186ad1e6ca0e6e8ea81d2b2fbece6ea01
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use a template on the size of the char[], as suggested by Ville
Voutilainen. This resolves ambiguity about whether such look-ups
should be done via QString or QCborValue (not that it would have made
any difference).
When we come to add mutating indexing of QCborValue, chained
dereferences like map[i][j][k] need to stay in operator[] const
throughout, to avoid detaching intermediates to create references into
them due to using the mutating operator[] on the earlier dereference's
return. So const-qualify the QCborValue operator[] const variants at
the same time, to match those of QCborValue itself.
Change-Id: Ib1652ae9440fe3767a653afa2856b74040210e07
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Theoretically, it could improve the speed. Some of the modified lines
also make the style homogeneous.
Change-Id: Iaed7b16fa75e485be0f825220c366903525448ce
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is a regression from commit 346c15102b, which creates a new QRegExp
in setFilterRegExp, losing previously set case sensitivity property
(i.e. when the code does proxy->setFilterCaseSensitivity(Qt::CaseInsensitive)
before setFilterRegExp).
Interestingly that commit ensured that setFilterFixedString would still
preserve CaseSensitivity, but not setFilterRegExp(QString).
Change-Id: I3d37d001ce6e86dd90e7e07431440a42607172f9
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
When a time-zone does a spring-forward, skipping an hour (either to
start DST or to move its standard time), there's an hour that doesn't
exist on the day in question. That hour can be the first hour of the
day, in which case using 0:0 as the default time is broken. So catch
this case and use the first time that day that makes sense.
Fixes: QTBUG-70823
Change-Id: I23dae9320a3cdd2c988841a7db1b111edb945730
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There is not reason why it should be kept in secret. Not having public
accessor forces a user code to keep a copy of the id. Visible for
example in QML (QQmlValueType).
Change-Id: If0de65fb8d91bcd50880c66b5f87c68f6d888dd3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Move the creation of the symbolic link/junction from the _data() slot
into the actual test function. The parameters are passed by a newly
introduced struct. This ensures only the symbolic links/junctions that
are actually needed are created. It can then no longer happen that
filtering for one data row invokes recursive deletion of the mountpoint
junction.
Also use of the newly introduced convenience createSymbolicLink()
in canonicalFilePath()
Task-number: QTBUG-63989
Change-Id: Ia78fd4ad6097136934ab5a375f4c352713d0f115
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
QUrl::RemoveAuthority is RemoveUserInfo | RemovePort | 0x10, so the
condition
if (options & QUrl::RemoveAuthority)
would match if any of the other bits for the username, password or port
were set, which meant we would skip the host comparison. Ditto for
username and RemovePassword.
[ChangeLog][QtCore][QUrl] Fixed a bug that caused QUrl::matches to
incorrectly compare two URLs with different hostnames or different
usernames as equal, if certain QUrl::RemoveXxx options were passed.
Change-Id: I015970a03b874898bba7fffd155856ab9d6cb1be
Fixes: QTBUG-70774
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Before this change we inserted newline only if an option has a
description and ended up with an arbitrary long line with all options.
[ChangeLog][QtCore][QCommandLineParser] Fixed a bug that caused the help
output to show two options or more in the same line if the options didn't
have a description.
Task-number: QTBUG-70174
Change-Id: Id54b9ae13ee596869e4dc14e09301aea19eed2f8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: If030b56ad97e047d89d442629262b4839df306d4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Replacing the qmake test with the one corelib/thread/thread.pri uses
for those classes.
Change-Id: Ie803190b821736c89b056ae51b7dfe92046189eb
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
We were handling this properly, but not testing them. I guess we weren't
testing because the condition is a valid intermediate state, so
hasFailure() is correct it returning false.
Testing inspired by the bug reported in
https://github.com/intel/tinycbor/issues/137
Change-Id: Ib47c56818178458a88b4fffd1554ecfdd0af637e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This is already blacklisted for macOS 10.12 and reproducing in 10.13.
Task-number: QTBUG-61037
Change-Id: I464e42d0ae5ab24104250edc69a90454ba605eaa
Reviewed-by: Liang Qi <liang.qi@qt.io>
The test was computing GMT with a suffix added to it for the offset;
but when the offset is zero there's no need for it. Cleaned up the
logic so that it only checks for a "padded to two digits with zero" if
the number is single-digit (and use string arithmetic in preference to
wantonly complex .arg()ing; and use simpler names). Since we don't
try to check anything unless GMT does appear in the string (because
the actual zone ID was used, instead of GMT with an offset), the case
of zero offset has nothing more to check than that GMT was present,
the precondition for checking anything.
Task-number: QTBUG-70322
Change-Id: I0b8abe7e63d9d72fa9cf32f188b47a78a849044b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's not thread-safe so should only be used within systemData()'s
locked code. This eliminates the last callers of it by making it a
local function of the compilation unit, exposing a method from
QSystemLocale() to get round its use of private parts. Make the
constructor for QSystemLocale only stomp its _systemLocale global if
previously unset, but let instantiation still clear
globalLocaleData.m_language_id, so that it can be used as a way to
trigger an update to system locale data.
Change-Id: I908dca9fd30bbf20f42321ab8f9094f2fa37b7b0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
On platforms where char is signed, like x86, the following is an error
(narrowing conversion):
unsigned char x[] = { '\xc3' };
Change-Id: I495bc19409f348069f5bfffd15518f9ef4e43faf
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It takes multiple source models and concatenates their rows into a single model.
With full unit tests.
[ChangeLog][QtCore] New class QConcatenateTablesProxyModel, to
concatenate the rows from multiple source models.
Change-Id: Iaf4f325473adef106f423677fdc5ee0e35e87d35
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
Before this patch QStringListModel::setItemData emitted dataChanged
twice if the roles map contained both DisplayRole and EditRole.
This fixes the duplication.
Increased efficiency of QStringListModel::itemData
Task-number: QTBUG-67511
Change-Id: Ibaea17530f15627a3cb8003e5284e54001731ded
Reviewed-by: David Faure <david.faure@kdab.com>
Implemented the virtual method moveRows to allow row movement.
[ChangeLog][QtWidgets][QListWidget] Implemented moveRows in model
Task-number: QTBUG-69807
Change-Id: I212b560b8778306a0315d9d5e4710efcc7dbbe44
Reviewed-by: David Faure <david.faure@kdab.com>
This new test double-checks the bugfix for QSortFilterProxyModel::insertRows
in commit 70ba75519d. Previously, when using QComboBox on top of
QSortFilterProxyModel and calling QComboBox::addItem with row==rowCount(),
an empty item was inserted in one place, and then another item was modified
(instead of the inserted empty one). This test checks that the above bugfix
indeed fixes the behavior of QComboBox::addItem when used in this manner.
Task-number: QTBUG-69158
Change-Id: Id01345e0525694a57250c656222d626e2267aa8e
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: David Faure <david.faure@kdab.com>
There was a QStringView::compare(QString, CaseSensitivity) but it's
good that the symmetric also exists
Change-Id: Ic789f11d41eb8cfa393cb51c19bd1f89bb87d912
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Some people suggested the later, so let's have a second look at it
before it's too late.
Although I was in favor of the former I'm now having second thoughts.
connectTo() is meant to only be used in classes which have a clear dominant signal,
but there are rare classes that have two (example: QAbstractButton::toggled, QAbstractButton::clicked).
QAbstractButton::connectTo() would be ambiguous if we ever wanted to add these shorthand connects
to QtWidgets
Change-Id: I198ad3326d31dcf89b9c47a299124572ee7b11b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
...not just the debug flag. The information is saved outside of the CBOR
map for two reasons:
1) removing the hack that depended on how QCborStreamWriter and
TinyCBOR internally work, allowing for the extra parameter to be
written directly. We wouldn't be able to use that hack anyway and would
have needed a further, uglier hack to encode a byte whose value we
don't know.
2) outside the map, this information can be parsed more quickly and
then we can discard any plugins we shouldn't actually load.
Since we're doing this for a flag, I decided to move the Qt version
there too for reason #2.
Change-Id: I61ecce6b1324410bbab4fffd153d4e5fc696d19e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
In preparation for Qt 6 deprecating the binary JSON format. Also reduces
the size of the metadata a little: for the xcb platform plugin, it went
down from 264 bytes to 138; for the jpeg image plugin, it went from 320
to 135.
I've had to change the signature so older versions of Qt won't try to
parse the CBOR data as Binary JSON. Unfortunately, before QJsonDocument
could get a chance to reject it, qJsonFromRawLibraryMetaData() needed to
allocate memory and that causes crashes with Qt < 5.11.2.
Change-Id: Ieb48f7c0dd0e4e0fb35efffd153bee34e16ce347
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
We no longer support macOS 10.11, iOS/tvOS 10, or watchOS 3.
Change-Id: Ide03d8fac06185ef4162ba75ee54a0adf6916905
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Synced QMetaObjectBuilder::MetaObjectFlag with the MetaObjectFlags enum
from qmetaobject_p.h. Also added a few comments for Qt 6.
Change-Id: Ieccd5cf8d512a6bf7256b2f4db88d45662774536
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This feature is needed to register complex types (e.g. Q_GADGETS) at
runtime, using a single constructor method and added type parameter.
Without having the type id available to the Constructor it is impossible
to specialize behavior, thus requiring separate constructors for each
type. Generating these separate constructors at compile time is easy,
but not at runtime.
[ChangeLog][QMetaType] QMetaType can now register constructor for a set
of dynamic types.
Change-Id: I6071271d0e157864594dd07b4bc3a0abbeb15a44
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
the test uses CoreFoundation api directly, so it must link it
explicitly.
amends 6c8f32388b.
Change-Id: I76b7d8ab41d6a66138eb45bd0f067cfee8e96cb8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The previous implementation wrongly calculated the necessary data type
to hold the offset indexes. It looked at the amount of elements,
but instead we should look at value for the last element in the offset
array
Change-Id: I84c6985dc3c329df3bbc5a14f9789170877b65bb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We were missing a few languages CLDR knew about; so add them to the
list in enumdata.py (and add trailing commas to lists to make future
additions not need to change the prior last line; python is perfectly
happy with this).
[ChangeLog][QtCore][QLocale] Added support for Western Balochi, Ido,
Lojban, Sicilian and Souther Kurdish.
Change-Id: I0d24cff46a0ae8db48ec1db8762088f877319982
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
This function allows to generate an array of offsets of substrings in
a string at compile time. This produces less verbose and easier to maintain
source code.
Change-Id: I5774b8b91906f6191f2b1244a676c07e7eb15b47
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The table and macros weren't extensible enough for non-Latin-based
languages.
Change-Id: I950f06de57aaf6bd0b24e0056e4acee2fb655f3d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We have #if-ery on Q_OS_DARWIN controlling an expectation of gettign
"GMT+1" and "GMT+2" instead of "CET" and "CEST" in two tests; this
turns out to not be a deficiency of macOS so much as of how we
configure Coin's VMs. While we fix that, we need to ignore failures
in these tests, so that we can pull the #if-ery out and clear the
blacklist once the VMs are set up properly.
Task-number: QTBUG-70149
Change-Id: If3577200cf980b3329161ab3eea7bd2e9d0124e0
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
This reverts commit fd38c97a6c.
Apparently our actual VMs for 10.13 don't get this right, although the
ones used in testing did (prompting the fix this reverts). We
probably have mis-configured VMs, but this is the quick-fix to get
development moving again.
Task-number: QTBUG-70149
Change-Id: Ib96755d8e21d9b226e22fc985f13f34fa04117b1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
CLDR up to somewhere between v29 (used by 5.9) and v31.0.1 (used by
5.10 and later) claimed Costa Ricans don't include fractions in their
currency; now it claims they expec two digits. Apparently one of them
does expect those digits, so this is the regression test I'll be
cherry-picking back to LTS, to accompany the CLDR updates they need.
Task-number: QTBUG-70093
Change-Id: I138772cc6013fa74de4f7c54b836cac83421eab2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Implemented the virtual method moveRows to allow row movement
[ChangeLog][QtCore][QStringListModel] Implemented moveRows
Task-number: QTBUG-69807
Change-Id: I518f48a321bd755ab56f2fe84883d27324cc42ec
Reviewed-by: David Faure <david.faure@kdab.com>
_q_interpolate<T> subtracts 2 arguments of type T,
for unsigned types this can cause wrapping around
Task-number: QTBUG-57925
Change-Id: Iffa59f413579a3d5de8cb728fe71443d8e8a04aa
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
We want to store the metadata size and get it from the plugin in Qt 6.
Change-Id: Ieb48f7c0dd0e4e0fb35efffd153bebc2914d9a3c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
After updating MinGW toolchain from 5.3.0 to 7.30 test starts to fail.
Task-number: QTBUG-69947
Change-Id: I850d854b27e1cb4e1dd2cb600e8e79bd18bff4a0
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Simo Fält <simo.falt@qt.io>
They have been blacklisted on windows and macOS previously. Now failing
on WinRT as well.
Task-number: QTBUG-69962
Change-Id: I30ca23005b082e820ee896fa36a8984a1536ad6b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Assume two MIME types A and B are registered, both with the same glob
pattern, A being parent of B, A with some magic rule, and B with another
magic rule. Given a file that matches the glob pattern and the magic rule
of A, the resulting MIME type depended on the order of registration of A
and B, because it would just check if some glob matching MIME type was
also a subclass of the magic matching MIME type.
The patch prefers the the MIME type that matches by magic if that
matches by glob pattern as well (i.e. A in our example).
The "recommended checking order" of the spec does handle that case.
Task-number: QTBUG-44846
Change-Id: I2af43f6199faf9a42cd9c35d3a045441afbd6217
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
This patch implements the support for QRegularExpression in
QSortFilterProxyModel.
[ChangeLog][QtCore][QSFPM] QSortFilterProxyModel now supports
QRegularExpression.
Task-number: QTBUG-46810
Change-Id: If932d55f98f9b8bcf3a72c03ffd51da52cb50ad1
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: David Faure <david.faure@kdab.com>
The match method still uses QRegExp. This patch updates the code to use
QRegularExpression and translates the wildcard patterns to a suitable
form for QRegularExpression.
[ChangeLog][Core][QDir] QDir now uses QRegularExpression internally for
wildcard matching. Note that QRegularExpression might not give the
exact same result as QRegExp as its implementation follows strictly the
glob patterns definition for wildcard expressions. Nevertheless, the
tests for QDir return the same results as before.
Change-Id: I095959443ac7362f7534e35454eff038061fca82
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This patch refactors the wildcardToRegularExpression method to generate
a simpler regular expression. It also fixes some shortcomings of the
previous implementation.
Tests have been updated to ensure all cases are properly supported.
Change-Id: I454e3fe8fe0bb663b2f319d6fa2fa8aec626c50d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Deep down in CoreFoundation, ICU is used, and this test triggers a
heap-buffer-overflow with AddressSanitizer. Disable this test for macOS
until Apple fixes it.
Task-number: QTBUG-69875
Change-Id: I43e4a69708be8cde3bde87c57db21f5b717f96b8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Before this change, if you try to insert a row at the bottom of QSortFilterProxyModel
the row will be inserted in the source model at position proxy->rowCount rather
than at the bottom. This causes insert at apparently random positions in the source.
[ChangeLog][QtCore][QSortFilterProxyModel]
QSortFilterProxyModel::insertRows(row,count,parent) with
row == QSortFilterProxyModel::rowCount will insert at the bottom of the source model
rather than at the row QSortFilterProxyModel::rowCount of the source model
Task-number: QTBUG-58499
Task-number: QTBUG-69158
Change-Id: Ie78416c8fbc429303b8c9c98375630e3e4d85f6d
Reviewed-by: David Faure <david.faure@kdab.com>
Add it to configure.json and replace all occurrences of QT_NO_THREAD
with QT_CONFIG(thread). Add conditions for other features that depend
on thread support. Remove conditions where we can use the QMutex and
QThreadStorage stubs.
Change-Id: I284e5d794fda9a4c6f4a1ab29e55aa686272a0eb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
qt_nameprep() already reset the string to its original length to
indicate failure, but we didn't handle that in qt_ACE_do(). So make it
have a return value whcih makes it easier to handle that case and do
handle it.
[ChangeLog][QtCore][QUrl] Fixed a bug that caused URLs whose hostnames
contained unassigned or prohibited Unicode codepoints to report
isValid() = true, despite clearing the hostname.
Change-Id: I41e7b3bced5944239f41fffd1545b7274c4b419d
Reviewed-by: David Faure <david.faure@kdab.com>
The API originally proposed was flawed in the sense that the setter
function would use a modified version of the parameter given which would
have make it a black box for the user. This patch fixes that by removing
that setter and providing a static method that will return the pattern
suitably modified to be used by QRegularExpression the same way the
escape method does.
[ChangeLog][Core][QRegularExpression] Implemented support for wildcard
patterns through a static method.
Change-Id: I0054bcaffd7525dac569f54fa81f73b7e4544b2e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
tst_QtEndian's transformRegion_template() was getting a
signed/unsigned comparison warning when T was unsigned in a
QCOMPARE(T-value, 0); so use T(0) instead.
Change-Id: I78cb2ab96f79393def65ed2c020aa3039017ab92
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
That way, we'll get told all the cases that fail, rather than only the
first. Provoked by investigation of failures that turned out to be
caused by QTBUG-69875.
Change-Id: I8fa2902cbbcb307cbe1fdec2e7d8d6b0c3eb998a
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
The CLDR data contains eight locales with numeric territory codes, 001
for World, 150 for Europe and 419 for Latin America. The last was
already known in our enumdata.py, but as "Latin America and The
Caribbean", which is not supported by the CLDR, so I've amended it
while adding the other two. This gives us support for Esperanto and
Yiddish (among others).
[ChangeLog][QtCore][QLocale] Added support for World and Europe as
(numeric) "country" codes ("territory" in CLDR terms), thereby
enabling support for Yiddish and Esperanto, among other locales using
such codes.
Task-number: QTBUG-57802
Change-Id: Ibb1180fb720743a3a0589527649d10f3c9cd123d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
These tests kludge round Apple's use of GMT+1 and GMT+2 as names for
CET and CEST on Darwin; but 10.13 actually gets the names right, so
side-step out of the kludge when on this version or later.
Change-Id: Icb8a2f3ac30f0f621a19042dc03e0d281782dd41
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
They have a separate type that we can't recognize directly, but we
can check if we can recognize the QFlags<T> form, though we have to
add a lot of template-conditions to avoid triggering QFlags static
asserts.
Change-Id: I00853682c5376dd3cc411ff151f47bce2389e277
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Adds an enumName to QMetaEnum to carry the name of the enum since for
flags that doesn't match the name of the Qt type, but is needed if the
flag is scoped.
Change-Id: I1c0f77eb9e40e6fd1eb6a59bea77caf0f33fcf43
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
We had 30s and 60s only, which isn'tenough for the Qt CI.
Task-number: QTBUG-69741
Change-Id: I00e04a465fcf4fc1a462fffd154782999e84ef8b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
[ChangeLog][QtCore][QObject] Fixed a bug in setProperty() that caused a
property change not to take effect if the old value compared equal using
QVariant's equality operator, but the values were not strictly equal.
Task-number: QTBUG-69744
Change-Id: I00e04a465fcf4fc1a462fffd1547885861a07a64
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The majority of tests use QPluginLoader::setFileName implicitly, which
refuses to do any work in static builds. Therefore the majority of tests
are skipped. But in the future we'll get tests here that for example use
QPluginLoader::staticPlugins() and for that we want to include the
sub-directory in the build and test run.
Change-Id: Ib8ec274e22ac8050feaca8967eb8626b53876b92
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
I'm intentionally not testing improperly-paired surrogates, since those
can't be encoded in CBOR.
Change-Id: I0d3cc366baaa49f3ad28fffd154240287ce34c22
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Do not overwrite stdout/stderr by default, but only if requested.
This restores the behavior of QProcess::startDetached of Qt 5.9.
Task-number: QTBUG-67905
Change-Id: Idccf7b0da7bd80f88a0624286ddf2851bc974fb1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
A default-constructed QJsonObject has no data payload, it is only a pair of null
pointers. So, when it becomes necessary to 'materialize' such an object, a
special global emptyObject constant is used as the substitute payload. There is
a small problem with this global constant though, namely that it's is_object
flag is unset. In other words, the emptyObject is not an object, but an array.
Fix by setting the is_object flag on emptyObject.
The example code in the bug report
QJsonObject parent;
QJsonObject child;
parent["child"] = child; // 1
child = parent["child"].toObject(); // 2
child["test"] = "test"; // 3
runs into this problem on line 1. Inserting the default-constructed child means
inserting a copy of emptyObject. On line 2 a pointer to this copy of emptyObject
is retrieved and cast to an object. But it's not an object, it's an array, so
things go wrong hereafter.
Specifically, on line 3, two inserts are performed, one from operator[] and one
from operator=. Each insert increments a compaction counter. The second insert
triggers compaction (QJsonObject::insert calls Value::requiredStorage calls
Data::compact) and compaction branches based on the is_object flag. Replacing
line 3 with
child.insert("test", "test");
causes the example to appear to work since compaction is not triggered and the
JSON serializer does not look at the is_object flag. Still, any further insert()
calls would trigger compaction and memory corruption.
Task-number: QTBUG-69626
Change-Id: I8bd5174dce95998bac479c4b4ffea70bca1a4d04
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
If we ever need to add QCborValue to the bootstrap library, it's
unlikely that we'll need this part. And by splitting it, I can make the
code handle more cases, that hadn't been properly handled before.
Change-Id: I2f630efbbce54f14bfa9fffd154160c0ad893695
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
There is no such file, if one of the "directory" components of its
path is not, in fact, a directory. Added a test for non-existent file
(specified to give empty canonical file path) as well as a test for a
file in a sub-directory of a known file. The former incidentally
tests for QTBUG-29402, fixed long ago.
Change-Id: I60b80acc0f99f0a88cdb1c4d191af7384f3a31c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use one QStringLiteral instead of repeating a QLatin1String(), that
was passed to a function that has to convert it to unicode; do the
conversion at compile-time.
Reducing i % 256 is fatuous when i ranges from 1 to 100.
A QFile will close() itself on destruction, no need to do it explicitly.
Especially when *not* close()ing the *other* QFile that was left open.
Change-Id: Idb39312d9c9beaf082b7cead574bc6bb9bb3a775
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
On Unix, we wouldn't even *try* to truncate if the file was open for
appending. The combination may be an eccentric choice but - at least
when it's combined with reading - I can imagine use-cases for it; and
we should (at least try to) deliver what we're asked for, even if we
can't think why anyone would want it. So actually enable truncation
when asked to.
Amended some tests to check this works and corrected the QIODevice
documentation of mode flags (which misdescribed the special case that
implies Truncate). Removed special-case code, to apply truncate when
writing but not reading, since it's been made redundant by the
pre-processing of mode done in QFSFileEngine::processOpenModeFlags().
[ChangeLog][QtCore][QFile] When opening a file, if Truncate is asked
for, or implied by other flags, it shall be attempted, regardless of
what other options are selected. We previously did this on Windows;
now we do so also on Unix (even when appending).
Task-number: QTBUG-13470
Change-Id: I1e08d02cfbae102725fccbbc3aab5c7bf8830687
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For keys, QSettings escapes all characters outside of [-a-zA-Z0-9_.]
by using percent encoding, and changes '/' to '\'. That is,
settings.setValue("qt.*", true)
will be written to an .ini file as
qt.%2A=true
This means that QSettings can not be used to write general-purpose
qtlogging.ini files. Fix this by applying the reverse transformation
method from QSettings when reading in the .ini file.
[ChangeLog][Logging] Qt will now accept qtlogging.ini files
written by QSettings.
Task-number: QTBUG-69548
Change-Id: I55b7a8b433291268dc6855901f72b1c04f8ee6d3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
I'm not sure why QSFPM purposefully emits dataChanged for a source
dataChanged that triggers a layoutChanged (i.e. due to sorting, multiple
rows are moving around). (This predates the git import in Qt 4.5.)
Surely whoever is listening will not gain much from the "small" dataChanged
after the "big" layoutChanged... anyhow, this documents the current behavior,
at least.
It also proves that the bug I saw long ago (changing a filtered-out
value used to emit dataChanged(invalid, invalid), IIRC) is no longer present.
Change-Id: I8975c549db88226b2b3393de9f8dca4f4109df15
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
When we have the named keys and not just integer values, we can output
something unambiously that closer match how the enums should be used.
Output of enums without proper metadata is left unchanged
Before:
QSurfaceFormat::ColorSpace(DefaultColorSpace)
QPainter::CompositionMode(3)
After:
QSurfaceFormat::DefaultColorSpace
QPainter::CompositionMode(3)
Change-Id: I537e879ba8b5c555b2aae9ba831facc88d430443
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The copy-assign operator tests against other.d being NULL but the
copy-constructor didn't. This can only matter if the value being
copied has been moved from, so we could probably replace with an
assertion in practice, but we should at least be consistent.
Amended test to check this case too; and verified new test crashes
without this fix.
Change-Id: I46872a677775944bbdf6a9112e719873e574ae60
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
All test cases use QPluginLoader which will not work for static builds of
Qt.
Change-Id: I7dcddcd5213681bd3ae4cd85e49ee0bb5748f687
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
The code I introduced in 4ee7425794 only
dealt with systems that reasonably used a 64-bit off_t parameter. Turns
out that we don't turn on largefile support on 32-bit Android, which
meant that the fix caused a regression.
[ChangeLog][QtCore][QFile] Fixed a regression that caused QFile::map()
to succeed or produce incorrect results when trying to map a file at an
offset beyond 4 GB on 32-bit Android systems and on some special Linux
configurations.
Task-number: QTBUG-69148
Change-Id: I2c133120577fa12a32d444488bac3e341966f8d7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The helper application is only needed for Unix platforms, so there is no
need to build it for other configurations.
Change-Id: I4ebb896c66d3ded016f72fdbe631ec2f1276db22
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Turned it into a data-driven test, with the old start-of-time as one
row, in order to add a regression test for an alleged MS API bug in
Windows XP.
Task-number: QTBUG-12006
Change-Id: I632ecc854f50f4183a990c8a27826ede9bd20e55
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QCommandLineParser::addOption returns false in case of an error.
Tests should check it.
Change-Id: I3507e1c236a15a7c0a77c0c80f8dba65b664a535
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This function can be used to create std::array without the need
to explicitly provide the size of array. It also has a specialization
that allow to generate sorted array at compile time. Sorted array can
be beneficial for example in binary search.
Change-Id: Ifc7e06e451812fce2ab94293959db5e9cc038793
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
To avoid (even more) duplicated code, "qt_test_helper" ensures the
policy of putting a test's helper application next to the test's
own executable.
The helper executable is suffixed with "_helper" to avoid name
clashes with its folder.
Change-Id: Ic50cb1daa257e7ffc75440c10a3b90fd39424683
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Using QFileSystemEntry::isAbsolute() broke handling of resource paths.
Extended QDir::absoluteFilePath() tests to cover absolute resource path
and some UNC variants also resolved in the same fix.
Amend existing filePath tests to use drives where needed.
Task-number: QTBUG-68337
Change-Id: I4f02cf67828ad93e562857118f8442037f18bab7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A RAII style class which calls a function at end of scope.
Example usage:
auto cleanup = qScopeGuard([] { <my cleanup code> ; });
[ChangeLog][QtCore] Introduced QScopeGuard.
Task-number: QTBUG-62894
Change-Id: Ife67f5c76255a1fafbae03367263da0bac9a0070
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The "boot2qt" platform needs to be blacklisted,
not "ubuntu-18.04".
This reverts commit 0d49ac0ffc.
Change-Id: I768a66c56f5fc7e0771473152579ed1c01bbbdb9
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Eight bytes into the Binary JSON header there's a 32-bit little-endian
size, which qJsonFromRawLibraryMetaData uses to determine the size of
the stored metadata. That value is passed as a size to QByteArray, which
means certain values could cause crashes due to being too big or via
sign-extension in 64-bit.
[ChangeLog][QtCore][QPluginLoader] Fixed an issue that could cause a
crash when certain damaged or corrupt plugin files were scanned.
Change-Id: I117816bf0f5e469b8d34fffd153dc5425cec39a7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Kept the intended word (rather than "number system" or "numeral
system" as might seem more natural) since CLDR's
common/supplemental/numberingSystems.xml uses numbering in its name
and in the XML tag-names in its contents. Thanks to Kari Oikarinen
for noticing, in review.
Change-Id: I85077611f9de8c4e812e1b5324fa2e99868b7b95
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This should improve reporting and ensure we know about each failing
case, not just the first, when one fails.
Change-Id: Ic00272201f69a2fd8508df23b1d746ea605aa539
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
Cleaned up some related #if-ery in the process.
Change-Id: I70f3152f2096ec34f36782fa1c3329f51c9b34f0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Routine update in preparation for 5.12
* omitting Chakma because QLocale can't represent the zero digit,
* de_DE no longer uses vorm./nachm. but AM/PM
[ChangeLog][Third-party code] Updated CLDR to version 33.1
Task-number: QTBUG-67654
Change-Id: If20c47bb030abc3700b4f5a592152e617e2767c2
Reviewed-by: Kai Koehne <kai.koehne@qt.io>