The test was previously tracking all Change events,
which made it fragile.
Change-Id: I17872341237009a9a0a2ad2fd5482f917991d7b2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@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>
Previously, there was only a Python compile test which triggers
only when PySide2 is found. Rename it to pythonCompile().
Extend the TestEntry structure by adding the base line file
and flags, which represent all special cases found in the code.
Check for the presence of a Python base line file in addition
to the C++ one.
Prototypically add one form. Further forms can be added
on the go.
Task-number: PYSIDE-797
Change-Id: Ic2983fa3cab2399a6809e244f93c663e0212f675
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
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>
This amends a1f4321bbb as the font
families should take precedence over the font family set. If the font
family is already included in the families then it should keep its
placement. Otherwise it should be appended.
Task-number: QTBUG-80475
Change-Id: I0049189c88b6879e57619815ec780960e9c0a300
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
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>
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>
If the singular fontFamily() is given, then this is obviously the one to
be preferred over any plural fontFamilies(). Make sure it always ends up
first in the list of emitted font families.
Change-Id: I1e3b1ba29721c8298b1a0d4a1e1da49ba5b4e7ac
Fixes: QTBUG-80475
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>
Add 2 methods to set/ask if a tab is hidden.
[ChangeLog][QtWidgets][QTabWidget/QTabBar] Tabs can now be
hidden with setTabVisible
Fixes: QTBUG-63038
Change-Id: I7b07ecdb485e1f6c085d03515ef2b73baae889de
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Added new API setDocumentXmpMetadata/documentXmpMetadata and
addFileAttachment
[ChangeLog][QtGui][QPdfWriter] New API to provide external document XMP
metadata and attach files to PDF.
Fixes: QTBUG-78651
Fixes: QTBUG-78764
Change-Id: Ic0b37e8d12899f907001db469080594c14c87655
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
It wasn't tested and behaves in a very particular way.
Change-Id: I60a31681e5b221cf9a86df77e410a76ee4c10864
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This method should not ignore accessibility objects without
corresponding widget. The widget may have parts with their own
QAccessibilityInterface and these can be also focused.
VoiceOver ignores them if they are not returned by focusChild().
QAccessibleTabBar::focusChild() has been implemented to demonstrate
the concept and make tab titles of QTabBar readable by VoiceOver.
Task-number: QTBUG-78284
Change-Id: Id7c62d86154bbd5d47d6bbee8cb7d05268c2e151
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
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>
QListModel::moveRows() had an issue when the destination was before the
source row.
Change-Id: I4ce8b425451f2f53c7eb3b211e9590753dec618a
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: David Faure <david.faure@kdab.com>
This is not to be taken as supported and is still undefined behavior,
but I prefer we do not crash.
Change-Id: Icf4f3398bfd57fcbdc611a5a821a1f2de0838330
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The previous implementation was *extremely* expensive. It
relied on loading a binary JSON file from resources (which
involved decompressing it), then extracting information out of
it to build a gradient. Already-loaded gradients were kept in
a local cache, which had to be mutex protected.
Instead, this patch extends the gradient generator to build
static arrays filled with the web gradient data, sitting in
.rodata.
These arrays are used when building QGradient objects with a
web gradient. No explicit mutex protection is necessary, since
accesses will just read from the arrays.
As benefits, this patch removes:
* the binary json representation from QtGui's resources (~4KB
compressed, ~50KB uncompressed)
* the overhead of reading from the JSON for each used web
gradient;
* the startup costs of registering the webgradients in the
resources;
* all the overhead of mutex locking when building such
gradients;
* all the runtime memory allocations to load, parse and cache
the web gradients (including the memory + CPU spike on first
load due to the uncompression of the JSON data, as well as a
couple of deep copies).
Change-Id: If5c3d704430df76ce8faf55ee75ebd4639ba09c4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@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>
When an existing item is replaced with a new one in
QStandardItemModel::setItem() then the persitent index is invalidated
which leads to some unexpected behaviors (like e.g the header size and
resize mode are reset).
Therefore we have to make sure that the invalidation does not happen.
This can be achieved by delaying the call to QStandardItem::setModel()
for the old item until the new is properly added. After this, the old
item no longer gets a valid QModelIndex from the model and therefore
can't invalidate the persistent index anymore.
Fixes: QTBUG-13605
Fixes: QTBUG-73000
Fixes: QTBUG-80586
Change-Id: I4e45e6feb81b7287c0859f638d7ab1a576fc2f0f
Reviewed-by: David Faure <david.faure@kdab.com>
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 patch fixes the QMetaObject::superClass hierarchy for Q_GADGETs
that inherit from a template which in turn inherits another Q_GADGET.
One common scenario where this is applied is for the CRTP. Without this
patch, moc would stop at the template and then sets the superClass
QMetaObject to a nullptr. For QObjects this works, since there moc knows
that every child must by definition inherit QObject. In order to support
this for Q_GADGETs too, we defer the judgment about the availability
of a staticMetaObject in the base class to compile time through the
existing QtPrivate::MetaObjectForType<Base>::value() helper.
[ChangeLog][QtCore][moc] Moc now correctly sets a non-null
QMetaObject::superClass for Q_GADGETs that inherit from a template which
inherits another Q_GADGET.
Change-Id: I103b5efd74ed24172dffce477ca2ed6d0f374d44
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
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>
The implementation for the X mask would accept any printable
character. Since that includes the blank character, there was no
difference in behavior between the requiring X and optional x: both
would allow the input to be unset, i.e. blank.
This change should be seen in conjunction with the doc improvement
da0af1e.
[ChangeLog][QtWidgets][QLineEdit] Inputmask X character now requires non-blank input.
Fixes: QTBUG-76320
Change-Id: I3e0363e9be5c13373a157cce69c99379615b5829
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Fix some tests in tst_QSqlQuery:
- make sure to use QSql::HighPrecision in tst_QSqlQuery::precision()
(needed for psql)
- remove outdated stuff for mysql 3.x
- psql_bindWithDoubleColonCastOperator: the placeholder are stored as
named placeholders in psql
- avoid some useless old-style casts
Change-Id: I54d29a7e24f17d853cce6baa09a67d9278098810
Reviewed-by: Robert Szefner <robertsz27@interia.pl>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>