Commit Graph

11914 Commits

Author SHA1 Message Date
Assam Boudjelthia
76f866c40a Android: move blocked tests of qapplication to test folder
Android packages the test instead of qapplication folder, thus the
BLACKLIST file for Android tests needs to be in "test" folder
instead.

Task-number: QTBUG-87666
Task-number: QTBUG-87025
Change-Id: I065072fa8a030cf9d15e057869e74a8c736c80ab
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-16 13:35:49 +02:00
Assam Boudjelthia
8904c50d6f Android: exclude failing test tst_android:assetsRead
Task-number: QTBUG-87025
Task-number: QTBUG-88506
Change-Id: I11137fadd1455ae782af5ada1c6d88d65050440d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-16 13:35:48 +02:00
Assam Boudjelthia
87fdad35ca Android: exclude failing tests of tst_qhighdpi
Tests in tst_qhighdpi are crashing on Android.

Task-number: QTBUG-88505
Task-number: QTBUG-87025
Change-Id: Ie1350e06fb30d90f20c550f91555f4023eee56b6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-16 13:35:46 +02:00
Assam Boudjelthia
ac1cbc752f Android: exclude tests crashing at start
These tests are failing with "java.lang.UnsatisfiedLinkError: dlopen
failed: invalid ELF file" at the start, excluding them now to enable
Android testing until they're fixed later.

Task-number: QTBUG-87671
Task-number: QTBUG-87025
Change-Id: Ida7d7158fccdc31df1f9689f77fde832964d732f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-16 13:35:44 +02:00
Friedemann Kleint
c8ae8ddb3a Manual shortcut test: Fix deprecation warnings about key combinations
Change-Id: Ifd85dad8042c98ea3c1402588cd50169dee1f685
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-11-16 12:35:42 +01:00
Assam Boudjelthia
4f0ee5fb37 Android: exclude host tools tests for android and ios
Task-number: QTBUG-87025
Task-number: QTBUG-88538
Change-Id: Id691c8463e9bf83c4538dce93300fb4fd5a99849
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-16 11:35:33 +00:00
Giuseppe D'Angelo
784a290c4b QFileInfo: mark constructors as explicit
These look like leftovers (API flaws).

Construction of QFileInfo from QString (or similar) should be not
implicit, as QFileInfo construction is expensive (might hit the file
system), and this may have users overlook APIs (for instance build a
QFileInfo out of QDirIterator::next(), instead of using ::fileInfo();
using QDir::entryList instead of entryInfoList; etc.).

Leave an opt-out mechanism to ease porting.

Fix a handful of usages around qtbase, with at least a couple of them
likely to be actual "sloppy" code.

[ChangeLog][Potentially Source-Incompatible Changes][QFileInfo] Most
QFileInfo constructors are now explicit. The
QT_IMPLICIT_QFILEINFO_CONSTRUCTION macro is provided to keep old code
working.

Change-Id: Ic580e6316e67edbc840aa0c60d98c7aaabaf1af6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-15 18:30:16 +01:00
Giuseppe D'Angelo
1869615fc9 QChar: make construction from integral explicit
QChar should not be convertible from any integral type except from
char16_t, short and possibly char (since it's a direct superset).

David provided the perfect example:

  if (str == 123) { ~~~ }

compiles, with 123 implicitly converted to QChar (str == "123"
was meant instead). But similarly one can construct other
scenarios where QString(123) gets accidentally used (instead of
QString::number(123)), like QString s; s += 123;.

Add a macro to revert to the implicit constructors, for backwards
compatibility.

The breaks are mostly in tests that "abuse" of integers (arithmetic,
etc.). Maybe it's time for user-defined literals for QChar/QString,
but that is left for another commit.

[ChangeLog][Potentially Source-Incompatible Changes][QChar] QChar
constructors from integral types are now by default explicit.
It is recommended to use explicit conversions, QLatin1Char,
QChar::fromUcs4 instead of implicit conversions. The old behavior
can be restored by defining the QT_IMPLICIT_QCHAR_CONSTRUCTION
macro.

Change-Id: I6175f6ab9bcf1956f6f97ab0c9d9d5aaf777296d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-11-15 14:41:05 +01:00
Andreas Buhr
2b49b01aa3 Blacklist authenticationCacheAfterCancel on Ubuntu 20.04
The test authenticationCacheAfterCancel was the only one to fail
in recent COIN runs. This patch blacklists it on Ubuntu 20.04.

Task-number: QTBUG-88417
Change-Id: Idc85499da82336d291d9a90ecb941810a0e6c935
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-11-13 20:56:45 +01:00
Sona Kurazyan
2bce62a318 Conditionally disable code snippets that depend on cxx11_future
Fixes: QTBUG-88392
Change-Id: Ida215253fdcad66a5a67084d3ff6781583101859
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2020-11-13 20:31:22 +01:00
Timur Pocheptsov
9662ff67ce tst_qsslkey - handle QT_NO_SSL properly
The recent change handling missing elliptic curves introduced a problem
for '-no-ssl' configuration/build. The first version had some protection,
but it was openssl-specific and required a private feature, thus was
removed. Now the real ifdef must be with QT_NO_SSL

Fixes: QTBUG-88238
Pick-to: 5.15
Change-Id: I6fba26d6ab63850e1468e76f8b234703255a026c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-11-13 18:05:08 +01:00
Alexey Edelev
558f5a2d7b CMake: Add support for -binary option for generated resources
Add handling of -binary flag in qt6_add_resources for generated
resource file variant.

If -binary argument is provided in OPTIONS section of
qt6_add_resources function, it will be passed to rcc as argument.
File path to output .rcc could be additionally specified by
DESTINATION argument. Extra target generated_<resource_filename>
will be added to project's 'all' set.

Implement tests for new functionality.

Fixes: QTBUG-87644
Change-Id: Id1313da499d86f82859d1757c3cfae2d84e894d4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-12 22:11:37 +01:00
Sona Kurazyan
1e9784e6a2 Conditionally disable tests that depend on cxx11_future flag
Fixes: QTBUG-88392
Change-Id: I33b8ffd72be8a653e0923ef1e57305ffaf6b0428
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-11-12 15:25:07 +01:00
Volker Hilsheimer
e796857abb Stop copying events in tests
It's unnecessary, and copying QEvents is a bad practice since it's a
polymorphic class.

Change-Id: Ieb6de106084f838c5e6c8a0643c54fd3c7f4a7a8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-11-12 15:25:06 +01:00
Allan Sandfeld Jensen
94dd2cebdc Remove Qt4Compatible painting
Change-Id: Ie54206ca9b509875568f2158e229fca9cb1860a2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-11-12 08:31:18 +01:00
Eirik Aavitsland
7aa68ee6f2 Fix misidentification of some shearing QTransforms as only rotating
The dot product used rows instead of columns.

Pick-to: 5.15 5.12
Fixes: QTBUG-87984
Change-Id: I922f67ed0fa9a4f88aa4e9fc6d3c09f8dda21688
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-11-11 12:48:21 +01:00
Mårten Nordheim
bbadd1b5c1 Add QByteArray::insert(qsizetype, const QByteArray &)
For consistency with append and prepend we should have an overload for
insert() as well. This also enables insert() to be used with
QStringBuilder, i.e. qba.insert(2, qba2 + "abc").

Because simply adding a const QByteArray & overload causes ambiguity
with QByteArrayView we also add a const char * overload.

Add some extra test-cases. Two for QByteArrayView since it's not
directly tested anymore. One for inserting self directly.

Change-Id: Ieb43a6a7d1afbb498bc89c690908d7f0faa94687
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-11-11 01:00:39 +01:00
Volker Hilsheimer
ee025760cf Use QTRY_COMPARE in an attempt to make the test less flaky
The test function only runs on X11, and this might help with the
asynchronous nature of the client/server architecture, also for
drag'n'drop.

Change-Id: I38db9104e304e57c36f84932d13f8dfae7452883
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-11-10 23:05:23 +01:00
Alex Trotsenko
aefd414ce2 QWinEventNotifier: unlink from event dispatcher
Instead of multiplexing all notifications into a single Qt event for
the event dispatcher, we can send 'WinEventAct' event directly for each
notifier which activated. This trick improves the performance (esp.
on a large number of events) and allows us to remove notifiers handling
from the event dispatcher completely.

As an alternative to sending Qt events, use of Windows' APC queue in
conjunction with waking up the Qt event loop from within the Windows
thread pool has been considered. However, that would lead to signal
emission asynchronous to the Qt event loop's operation, which is not
acceptable.

Thanks to Oswald Buddenhagen for the proposed idea.

[ChangeLog][QtCore][QAbstractEventDispatcher] The
{un}registerEventNotifier() member functions have been removed.
QWinEventNotifier is no longer needed to be registered in the
event dispatcher.

Change-Id: I140892fb909eaae0eabf2e07ebabcab78c43841c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2020-11-10 17:56:51 +02:00
Alexandru Croitor
fbf11e86ef CMake: Fix cmake tests for no-widgets and no-gui configurations
Task-number: QTBUG-86053
Change-Id: I108977546304f203f6e2b7e983bb909b76626a9f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-11-10 16:53:31 +01:00
Fabian Kosmale
16d412da4c QSignalSpy: Use QMetaType instead of metatype id in initArgs
The RegisterMethodArgumentMetaType had been changed to take a QMetaType
instead of a type id in 0161f00e50.
Unfortunately, the usage of it in QSignalSpy was missed. This patch
adjusts the metacall to correctly use a QMetaType.
Moreover, use parameterMetaType instead of parameterType to benefit from
metatypes which are already resolved at compile time.

Task-number: QTBUG-88260
Fixes: QTBUG-88356
Change-Id: Id8fa46581a005d62818971ea24d8aa2e39dcd6d0
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-11-10 11:23:55 +01:00
Andrei Golubev
250b69ace4 Fix QArrayDataOps generic and relocatable emplace()
Emplace() implemented with std::rotate is just awful on my system
(Ubuntu 18.04 GCC 7.5.0). Custom code is much faster, so go for
it. Cannot really use insert() code, which is also fast, because
it doesn't forward-reference values but copies them always

Changes in performance (approximately) for emplacing 100k elements
into the middle:
Complex 7600ms -> 1700ms
Movable 7600ms -> 200ms

Task-number: QTBUG-86583
Change-Id: If883c9b8498a89e757f3806aea11f8fd3aa3c709
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-09 17:36:31 +01:00
Mårten Nordheim
d281f5cc35 QMultiHash: add a QHash&& constructor and unite() overload
Reaches into the internals to avoid erasing one entry at a time from the
QHash.

Change-Id: I47079592d130d2ecd844998dfa31e633e049d4c1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-09 16:01:33 +01:00
Ivan Solovev
85a9f5420f Add tests for QOperatingSystemVersion
Task-number: QTBUG-88183
Change-Id: I7083dae5bf9ef8cc5eb18e68052706cc3f7c66ab
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2020-11-09 16:01:33 +01:00
Andreas Buhr
223e409efb Automatically generate unit tests for QtConcurrent
There are many different ways to to call map and filter functions
in QtConcurrent. This patch adds a python script to generate
all possible combinations.

Change-Id: I61ed1758601e219c5852e8cc939c5feebb23d2f6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-11-09 16:01:33 +01:00
Allan Sandfeld Jensen
04413b9dd8 Allow painting above INT16_MAX on 64-bit architectures
The logic in qgrayraster was ready for it except for an intermediate
format. qrasterizer.cpp and qcosmeticstroker.cpp uses a dot-16 fixed
point format, and had to be changed to handle higher coordinates on
64-bit architectures.

Fixes: QTBUG-84428
Change-Id: I85ab7a04e38bd0dbcefa9f16c16ccc84785a33cf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-11-09 14:04:13 +01:00
Volker Hilsheimer
f9058a7534 moc: output errors and warnings in a way that matches compilers
gcc, clang, and MSVC all use lowercase "warning:", "error:" and
"note:". Follow that standard.
Also, include a column number; just print 1, as the Symbol doesn't
give us a column number, and searching backwards for a newline seems
overkill.

This fixes IDE integrations that parse compiler output using regular
expressions.

The test checks for moc output, but most tests were so far only
running on Linux systems. Expand this to Unix for most tests, which
then includes macOS.

Change-Id: I0a6151cc0dc50e52ca72ff8048a45213aebdb3a8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-11-09 12:50:10 +00:00
Morten Johan Sørvig
46a552583f Teach QPixmapIconEngine how to handle @Nx pixmaps
Bring QPixmapIconEngine on par with QIconLoaderEngine
when it comes to @Nx pixmap handling: Make the scale
factor a test parameter during icon lookup.

This allows storing e.g 16x16@1, 16x16@2, 16x16@3 versions
of a pixmap in the icon, and then having QIcon select
the correct one based on the target devicePixelRatio.

Extend the qiconhighdpi test to also cover QPixmapIconEngine,
via the addPixmap() API.

The corner cases of pixmap lookup can be much complicated.
QIconLoaderEngine and QPixmapIconEngine should ideally
have identical behavior in order to avoid surprises.

Change-Id: I17552cc61755bff9553c4a462e3983ac6759c13b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-11-08 19:49:53 +01:00
Edward Welbourne
b867daf6fa Update public suffix list header to latest version
The former *.platform.sh entry has been replaced by more specific
entries, replacing the wildcard with only selected second levels.

Task-number: QTBUG-87925
Change-Id: Ie4ba7c66ba9aa40eafe23f02faa12f19d791cff2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-08 13:02:30 +01:00
Edward Welbourne
246ba8ca61 Update CLDR to v38
Fresh on the heels of our update to v37, they've released a new version.
No new languages to complicate life, fortunately.

Updated license (year range) and attribution. One test also needed an
update: Catalan's long time format now parenthesizes the zone.

Task-number: QTBUG-87925
Pick-to: 5.15
Change-Id: I54fb9b7f084b5cd019c983c1e3862dc03865a272
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-11-08 13:01:29 +01:00
Volker Hilsheimer
b14b1c99f8 Rename QRangeCollection to QPageRanges, make it a proper value type
The type is specific about printing, so give it a name in line with
QPageLayout and QPageSize.

As per API review comment, it's not clear why this type should not be a
regular, copyable and movable value type. It stores a list of intervals.
Give it value-type semantics, as an implicitly shared class.

Convert the parse method into a static factory function.

Add a Range type and use it instead of the semantic-free QPair.
Move QPrinter getter into QPagedPainteDevice, make it return a copy
rather than a pointer, and add a setter.

Extend test case to cover all members and more merge cases. Fix bugs
found that way.

Fixes: QTBUG-88113
Change-Id: If17ea4d410d49f16b097e88b7979db5d72add820
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-08 11:49:54 +01:00
Giuseppe D'Angelo
d0a4084cbf QSharedMemory: do not abuse QChar in a test
The set() function sets a given byte in shared memory. Thus,
just take a char, not a QChar.

Change-Id: I6f3d148eb730573070832ddce6f63363408790cf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-08 02:13:22 +00:00
Alexandru Croitor
f5b214130a tests: Blacklist tst_qwindow failing test on Windows
Amends b13bad3ab0

Task-number: QTBUG-35109
Task-number: QTBUG-88250
Change-Id: I0b37369bb7cfc58e6968ca20969725e2f4143200
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-07 19:33:37 +01:00
Giuseppe D'Angelo
6702614c97 QStringView test: avoid narrowing
Use '\0' (char) instead of 0 (int).

Change-Id: I866d08e7b07ae555fcf0244a8614e3e04a0bc567
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-07 19:33:36 +01:00
Shawn Rutledge
f5c7799f59 Support the markdown underline extension
MarkdownDialectGitHub now includes this feature, so *emph* is italicized
and _emph_ is underlined. This is a better fit for QTextDocument capabilities;
until now, _underlined_ markdown could be read, but would be rendered with
italics, because in CommonMark, *emphasis* and _emphasis_ are the same.
But QTextMarkdownWriter already writes underlining and italics distinctly
in this way.

[ChangeLog][QtGui][Text] By default (with MarkdownDialectGitHub), markdown
_underline_ and *italic* text styles are now distinct.

Fixes: QTBUG-84429
Change-Id: Ifc6defa4852abe831949baa4ce28bae5f1a82265
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-07 09:35:11 +01:00
Karsten Heimrich
e9b92c926d QDebug: add op<<(QUtf8StringView)
[ChangeLog][QtCore][QDebug] Added streaming of QUtf8StringViews.

Task-number: QTBUG-88029
Change-Id: Ifcb001cfebddd79ce1cdbfef5bcc19f7c56679ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-07 09:35:11 +01:00
Karsten Heimrich
7cad91a7df QDebug: add op<<(QByteArrayView)
[ChangeLog][QtCore][QDebug] Added streaming of QByteArrayViews.

Task-number: QTBUG-88029
Change-Id: I66f5cc45a0438dbaacb1754cb3c669b3717f528b
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-07 09:35:11 +01:00
Giuseppe D'Angelo
a6903f3da8 Fix a mistake when using QLatin1String::arg
QLatin1String::arg (and QStringView::arg) only support string-like
arguments, and QLatin1String("%1").arg(123) does *not* produce
the string "123" -- 123 gets routed through the QChar(int) constructor
instead. Fix by using QString.

Change-Id: I96371a15e1af957ef8133e30e79eb3e22b3e9d32
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-07 06:25:36 +01:00
Shawn Rutledge
9a1a15b42f Introduce QEvent::isSinglePointEvent()
This makes high-level event dispatching easier: for example we often
need to cast an event to access getters like button() and buttons().
We can so far assume that any QPointerEvent that is not a QTouchEvent
is a QSinglePointEvent; but more explicit type-checking looks safer.

Implemented in a similar way as c7f7279969.

Change-Id: I980d759e2a7538b6b30fd3bdc3be0c351ec6c246
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-07 06:24:38 +01:00
Alexandru Croitor
b13bad3ab0 tests: Blacklist failing tests on MinGW
Also move redudant Android entries to already existing sections.

Task-number: QTBUG-35109
Task-number: QTBUG-88250
Change-Id: I9d5eaa5a3f11b55566a7c74f84a972a0c272cfea
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-11-06 21:03:51 +00:00
Giuseppe D'Angelo
c9b8c2cddb QLineEdit: check a int->QChar conversion, and make it explicit
QStyle::styleHint returns int, and that int was simply used to
build a QChar representing the "password mask" character.
Enforce that it actually fits and then do an explicit cast.

(In general, of course, this is an API flaw; styleHint should
somehow return a QString for this use case).

Change-Id: Ifb6181b229b91cc84859cb9b9d57e21d6748c31a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2020-11-06 10:16:32 +01:00
Giuseppe D'Angelo
ff55b6ed48 qmakelib test: build with qmake
A dependency was missing, causing qduplicatetracker_p not to be found.

Change-Id: I4076d6cf82d804354731c357bcdbfd03c3d42142
Reviewed-by: David Faure <david.faure@kdab.com>
2020-11-06 10:16:31 +01:00
David Skoland
28f7c95e3b Use built-in C++ foreach iteration in tests
Change-Id: I1e4bf9249ce26c034c676d78cfa16231226da05b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-06 10:16:31 +01:00
Morten Johan Sørvig
52ce0c177e Set the url to have the AtNx filename if one is found
There’s no need to convert the file name/path to QUrl,
and then back again to QString before calling qt_findAtNxFile().

Call qt_findAtNxFile first, and then convert to QUrl.
This makes sure the url-name and string-name stays
in sync.

Change-Id: I8b8939eabbdaff473945ebe31faafd408e9c4295
Pick-to: 5.15
Fixes: QTBUG-60793
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-11-06 09:16:30 +00:00
Assam Boudjelthia
039d3fe4e8 Android: blacklist a list of failing tests for android
We want to re-enable Android tests in QTQAINFRA-3867. However,
many tests are failing already preventing that from happening.
QTBUG-87025 is currently keeping track (links) to all of those
failing tests.

The current proposal is to hide those failing tests, and enable
Android test running in COIN for other tests. After, that try
to fix them one by one, and at the same time we can make sure
no more failing tests go unnoticed.

Task-number: QTBUG-87025
Change-Id: Ic1fe9fdd167cbcfd99efce9a09c69c344a36bbe4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-04 12:27:49 +02:00
Lars Knoll
1282c05cdc Rename AllocationPosition enum and its members
Use GrowsAt* and GrowthPosition as that is clearer.

Change-Id: I3c173797dec3620f508156efc0c51b4d2cd3e142
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-04 10:22:16 +00:00
Andrei Golubev
8f7016252a Implement QList::emplaceBack as a proper function
My endeavours figuring out why QList::append(elem) gives worst
performance compared to 5.15 ended up into this commit. After some
straightforward fixes, what was left is "everything is uniformly worse"
and takes more CPU cycles

Introduce emplaceBack implementation as append is quite a special case
that could be greatly simplified. This is a "straightforward" part of
the optimizations

While at it, change append(t) to use emplaceBack(t)

For workloads like:
QList<int> list;
forever {
  list.append(0);
}
this gives huge improvement (roughly 30% for 10k+ elements),
movable and complex types also get a tiny speedup

Task-number: QTBUG-87330
Change-Id: I9261084e545c24e5473234220d2a3f2cd26c2b7f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-11-04 11:21:59 +01:00
Lars Knoll
4deb0d1737 Remove the old insert methods in QArrayDataOps
Inline them into the one place they are called from
and remove duplicated code.

Change-Id: Ica88485e98625905083b16c24ee9eaf223a89ae0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2020-11-04 11:21:54 +01:00
Lars Knoll
b76fbb48fb Clean up out allocation handling
Get rid of the allocation options inside the flags
field of QArrayData, they are really a completely
separate thing.

Change-Id: I823750ab9e4ca85642a0bd0e471ee79c9cde43fb
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-04 11:21:46 +01:00
Lars Knoll
419eaa0679 Cleanup QArrayDataOps::reallocate() and related
Don't use QArrayData::GrowsForward/Backward anymore and replace
it with a simple 'bool grow'.

Change-Id: Ifddfef3ae860b11dda4c40854c71ef2aeb29df34
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-04 11:21:41 +01:00