Commit Graph

48972 Commits

Author SHA1 Message Date
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
Edward Welbourne
4398836817 Make QDateTime's operators hidden friends
Update docs to match.

Change-Id: I0ece9bcdba69c5dca48743894fe3347d9666f4e4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-07 06:25:16 +01:00
Edward Welbourne
c81893907e Make QTime's operators hidden friends
Update docs to match.

Change-Id: Ibcaeaea04fa552c392d49e711201719f99733742
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-07 06:25:09 +01:00
Edward Welbourne
6206c6c189 Make QDate's operators hidden friends
Adjust the documentation to match and add missing \c before false in
two cases.

Change-Id: Ic287c4de0b131c3500ee72bf1201900dc3788756
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-07 06:25:02 +01:00
Edward Welbourne
cfac358fa3 Turn QLocale's operator==() and operator!=() into hidden friends
Update docs to match. Add note on the conditions for equality.

Change-Id: I973b7a5dae3fae2e62f8a0d1db1f3115d24bee8b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-07 06:24:52 +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
Volker Hilsheimer
bdec189ecb Move QEventPoint and QPointingDeviceUniqueId out of qevent
qevent.h/cpp are huge already, no need for more classes. Move QEventPoint
into new qeventpoint.h/cpp files, and QPointingDeviceUniqueId into
qpointingdevice.cpp; the class is already declared in qpointingdevice.h.

Move the documentation of QEventPoint APIs next to the implementation,
and document all APIs as properties. Add Q_PROPERTY macro where missing.

QEventPoint::device needs a workaround of qdoc due to the type being a
pointer-to-const; qdoc doesn't know how to tie a \property to it, but
documents it correctly.

While at it, move the logging category declarations to the header
matching the .cpp file where they are defined.

Change-Id: I096e609edbb760b5686d577e7fe47eea0807904e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-11-07 06:24:28 +01:00
Mårten Nordheim
1c6d6cbb62 QNAM: Work around QObject finicky orphan cleanup details
Details described in a comment.

Task-number: QTBUG-88063
Pick-to: 5.15
Change-Id: I763ecfedf518de97615e04a8eaae0fe1fd784f52
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-11-06 21:03:52 +00:00
Mårten Nordheim
7b2011bd14 QDecompressHelper: use the new readPointer function in QByteDataBuffer
Gets rid of moving strings back and forth, which was extra expensive
without QList's prepend optimization (which is returning, but getting
rid of the moves is even better).

Change-Id: I520fc140310a0e1f096dda97f2e999d0e7993e77
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-06 23:03:52 +02:00
Volker Hilsheimer
b284e01b0f Fix a few qdoc warnings
Change-Id: I7cc284ec56f02049d43a23c81659db94bfc3ff42
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-11-06 22:03:52 +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
Topi Reinio
b20779b192 Doc: Add a workaround for QUtf8StringView's missing docs
QUtf8StringView is a specialization of QBasicUtf8StringView but we only
want to document the former. Add a workaround when Q_CLANG_QDOC is
defined to rename the base type, so the documentation in the .qdoc file
is matched correctly.

Fixes: QTBUG-88030
Task-number: QTBUG-86295
Change-Id: Id6e3d6fd5c28603bebf30771b7a47c3f76ca709d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-11-06 21:03:51 +00:00
Shawn Rutledge
604adc01c0 Fix mouse velocity calculation
The mouse event that is sent to QPlatformCursor is in native pixels,
but the QSinglePointEvent constructor sets QEventPoint::globalLastPosition
every time, and velocity is calculated by delta from globalLastPosition
to globalPosition.  We plan to rely on this velocity being correct
in Qt Quick, in Flickable for example.  So globalLastPosition and
globalPosition need to be in the same coordinate system at the time
QPointerEvent::setTimestamp() is called.

Change-Id: I39f97a43f55f47a70cbd574861e920f3106e2125
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-06 22:03:51 +01:00
Joerg Bornemann
832e44b232 CMake: Heave configure's help screen into the age of CMake
Remove the portion about variable assignments. Technically, we handle
them but not in a useful way.

Remove options that are not applicable or not yet ported.

Mention the double dash option.

Change-Id: Ie2a27e3a145b2cead60adc75961d5deb086526ca
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-06 22:03:51 +01:00
Joerg Bornemann
3e37984a4f CMake: Add possibility to opt-out of file(ARCHIVE_CREATE) usage
If CMake 3.18 was built with insufficient library dependencies then Qt's
build will fail when file(ARCHIVE_CREATE) is called.

Configure with -DQT_AVOID_CMAKE_ARCHIVING_API=ON to choose code paths
were file(ARCHIVE_*) is not used.

Change-Id: I30c390498337ab0fa78b88b66d2f8feaa1f3f10b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-06 22:03:51 +01:00
Joerg Bornemann
2746051522 CMake: Disconnect docs installation targets from generation targets
"ninja install_docs" should not run the "docs" target, because with
the usual workflow
    ninja docs
    ninja install_docs
the documentation would be built twice.

That of course means that "ninja install_docs" will fail if "ninja
docs" wasn't run before.

Analogous for html_docs, qch_docs, the repository-level and
module-level documentation targets.

Change-Id: I8ad83602dd393b5afc79a19ab3d395987c889d0d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-06 22:03:51 +01:00
Joerg Bornemann
db939d8f33 CMake: Fix top-level documentation install targets
The following targets did not do any actual installation:
install_docs, install_html_docs, install_qch_docs,
plus their repository-level counterparts.

Add the following dependencies:

install_html_docs
    --> install_html_docs_<repo>
        --> install_html_docs_<module>

Analogous for qch.

The install_docs target already triggers install_html_docs and
install_qch_docs. Analogous for install_docs_<repo>.

Fixes: QTBUG-86738
Change-Id: I3468e000e050e2787a859e61d40161f5459cb351
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-06 22:03:51 +01:00
Joerg Bornemann
e559da3c6a CMake: Fix detection of the ltcg feature
When checking the value of CMAKE_INTERPROCEDURAL_OPTIMIZATION_<CONFIG>,
then <CONFIG> must be the upper case configuration name.

Also, we must not unset __qt_ltcg_detected, because the feature
condition evaluation happens way after the feature definition, and
__qt_ltcg_detected was not available anymore there.

This commit amends 96bdcdacbc.

Fixes: QTBUG-87874
Change-Id: I2b555bd1d7fbc8973e1d9493045c27d61b0d2c1b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-06 22:03:50 +01:00
Joerg Bornemann
e31c6c7337 CMake: Add version information to Qt plugin DLLs
Tools and library DLLs already have version information embedded.
Add the missing _qt_internal_generate_win32_rc_file call for plugins.

Fixes: QTBUG-87747
Change-Id: I619948f4066ce229d41e8b93f125751e1d28e26c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-06 22:03:50 +01: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
Alexey Edelev
aa6ad15424 CMake: Rework INPUT_ variables handling
INPUT_ variables enable FEATURE_ variable only in case if valid
"true"-like value is assigned from command line.

Amends dc43061e9a

Fixes: QTBUG-87755
Task-number: QTBUG-88142
Change-Id: I65e85c7548981fdec94366b531f6df6396be71b7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-06 10:16:31 +01:00
Kai Koehne
501f27b5c6 Normalize dir separators in CMAKE_TOOLCHAIN_FILE when forwarded to CTest
This fixes an issue where, on Windows, 'ninja test' will error out:

[0/1] Running tests...
Test project C:/dev/qt/dev/cmake-msvc-2019-amd64/qttools
CMake Warning (dev) at C:/dev/qt/dev/cmake-msvc-2019-amd64/qttools/tests/auto/cmake/CTestTestfile.cmake:7 (add_test):
  Syntax error in cmake code at

    C:/dev/qt/dev/cmake-msvc-2019-amd64/qttools/tests/auto/cmake/CTestTestfile.cmake:7

  when parsing string

    -DCMAKE_TOOLCHAIN_FILE=C:\dev\qt\dev\cmake-msvc-2019-amd64\qtbase\bin\/../lib/cmake/Qt6/qt.toolchain.cmake

  Invalid escape sequence \d

Change-Id: Ifc727e44b20b899b44c7c1398d4273d73b7519ca
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-06 10:16:31 +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
Volker Hilsheimer
dfec79f5d8 Unexport QTextFrame/Block::iterator classes
Inline private constructors, use class initialization consistently.
Export only non-inline'd members.

Change-Id: I18f38214bbd03af711fe7ee1314d59e06733a0ec
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-11-06 10:16:31 +01:00
Volker Hilsheimer
4a66fb9d76 Fix a bunch of qdoc warnings
Remove or fix references to removed APIs, and some qdoc syntax fixes.

Change-Id: I67d71062cd7a29f4eb74b02199b1482af5e59fc0
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-11-06 10:16:31 +01:00
Volker Hilsheimer
6c8f3a7f8a Fix compile warning
QInputDevice data types changed from 16 bit to int in
742de50c5e

Change-Id: Id2760b5b685e5efc14ee6f9e36e2b30a5b188cdd
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-11-06 10:16:31 +01:00
Andrei Golubev
504972f838 Refine {QString, QBA}::reallocData() logic
Fixed misleading naming of "slowReallocatePath". It's no longer "slow",
it's downright dangerous now to reallocate under certain conditions

While at it, added extra assert to QArrayData::reallocateUnaligned()
and cleaned up that function a bit

Change-Id: I05921fb5058eb563997e66107566c87fb4ea5599
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-06 10:16:31 +01:00
Assam Boudjelthia
42f8afc2dc CMake: add --apk to androiddeployqt to copy resulting apk to build dir
Task-number: QTQAINFRA-3867
Change-Id: If036aa88d8e9db3ddc9d27811ccfafa1152a9f2a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-06 11:16:30 +02: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
Fabian Kosmale
83982ac1c5 pro2cmake: Support QML_PAST_MAJOR_VERSIONS
Change-Id: I47504d6c032c9a6ace7440580f0081cc5f254038
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-06 10:16:30 +01:00
Joerg Bornemann
ca59c20939 CMake: Fix usage of cache variables in qt.toolchain.cmake
We have some cache variables that are used in our qt.toolchain.cmake
toolchain file, for example QT_CHAINLOAD_TOOLCHAIN_FILE. When CMake
runs a configure test with try_compile, our toolchain file is included
again, but only a restricted set of variables is available.

Add the variables that are used in our internal toolchain file to
CMAKE_TRY_COMPILE_PLATFORM_VARIABLES. This makes them visible for
try_compile calls operating on source files.

Also pass the variables via the environment to support try_compile
calls that operate on whole projects.

Fixes: QTBUG-87873
Change-Id: Iebca9e23686bec5072194b15482e1782b9367a0e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-05 13:04:56 +01:00
Martin Storsjö
48faa8ed5a Add _MSC_VER check to MSVC ARM compiler workaround
While _M_ARM is a MSVC specific builtin define, mingw headers do
also define it (in code, as opposed to a compiler built in
define), just as the same headers do for e.g. _M_IX86 and _M_X64.

This avoids warnings about unrecognized pragmas, when compiling
for armv7 mingw.

The original compiler bug (from QTBUG-42038) probably already is
fixed and/or no longer in scope.

Change-Id: I98722e2a7ee1de4f1937a866555ec460f5d898d1
Pick-to: 5.15
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-11-05 14:04:55 +02:00
Volker Hilsheimer
66d2bf7659 Give batch files CRLF line endings
Batch files should be CRLF, otherwise they may end up triggering an
"The system cannot find the batch label specified" error.

Relying on core.autocrlf to ensure this runs the risk of the user not
having the config set correctly, and also doesn't cover the use of
the same source checkouts across platforms.

Change-Id: I3166b99ce38e4ba9a0674336d69aa915e27860d1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2020-11-04 15:02:29 +00:00
Joni Poikelin
8d5b7df0b6 Mark changed regions dirty instead of bounding box of changes
This helps a bit with LinuxFB on low end devices.

Change-Id: I16fcce23e7073272d1d1c6bc660c255163b96c30
Fixes: QTBUG-88174
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-11-04 13:38:19 +02: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
Andrei Golubev
a7b6f0391b Always use fast path in QString::append(QLatin1String)
This must be possible with a new set of changes and the way QString
reallocates

Task-number: QTBUG-86583
Change-Id: I513f51d7c6e984ae4e81fc344138687c791037c4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-11-04 11:22:20 +01: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
Lars Knoll
edd1e931d1 Fix performance issue with QList::insert() for complex T
When storing complex types in the list and inserting in the middle,
we ended up in some cases moving the items in the list onto itself,
to make space for 0 new items.

Obviously that's not a very good idea. It was not a huge deal for
POD or relocatable types as we'd use memmove in that case which would
return quickly. But for complex types, we actually did copy around
half of the items stored in the list onto themselves.

Change-Id: I54467dccf2e17ba4a604bded755242197dd96b06
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:22:11 +01:00
Lars Knoll
4d49459e4b Properly implement emplaceBack/Front() in QArrayDataOps
This improves the performance of QList<QString>::append/prepend()
and we now beat QVector in Qt 5. QList from Qt 5 is still a bit
better for QString, but this might be related to the fact that
QString in Qt 6 is larger than in Qt 5.

Appending 20M integers to the list gives:

Qt 6:             35ms
Qt 5.15/QVector:  99ms
Qt 5.15/QList:    78ms

Appending 20M QStrings to the list gives:

Qt 6:            172ms
Qt 5.15/QVector: 194ms
Qt 5.15/QList:   136ms

Appending 20M structs of three pointers gives (100M will
crash in Qt5 as 100M*24bytes overflows):

Qt 6:            109ms
Qt 5.15/QVector: 272ms
Qt 5.15/QList:   469ms

Prepending 20M integers to the list gives:

Qt 6:             58ms
Qt 5.15/QList:    90ms

Prepending 20M QStrings to the list gives:

Qt 6:            448ms
Qt 5.15/QList:   147ms

Prepending 20M structs of three pointers gives (100M will
crash in Qt5 as 100M*24bytes overflows):

Qt 6:            267ms
Qt 5.15/QList:   435ms

No numbers for prepending to a QVector in 5.15 as the operation
was O(n) there. The difference in time between append and prepend
comes from the fact that our growth policy favors appending to
some extent.

Change-Id: Ice4598df5ca408413bfb00f5fe05e0b8d512623d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2020-11-04 11:22:07 +01:00
Andrei Golubev
2e8656779a Introduce QADP::reallocateGrow()
Added realloc() code path to QMovableArrayOps

Implemented fast realloc() based growing for QADP and used it in
QList::emplaceBack. This gives quite a bit of speedup and shows better
results than 5.15 at 100k+ iterations of "list.append(elem)", meanwhile
also closing a gap between movable types

Task-number: QTBUG-87330
Change-Id: I42fc182ecd93c85600dac622385152fc57735da8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-04 11:22:03 +01: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
9ee50a14b7 Move insert() operation into QArrayDataOps
This allows us to unify and simplify the code base between QList,
QString and QByteArray.

Change-Id: Idc8f360d78f508a68f38eb3ef0ed6e5d37f90574
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-11-04 11:21:50 +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
Lars Knoll
32a703e277 Don't move data in QArrayDataOps::reallocate()
reallocate() should only ever call realloc(), and only be used to
create more space at the end of the data.

Change-Id: I2ac4dbc90d2afaa571bb620108d7984356712cb2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2020-11-04 11:21:37 +01:00
Lars Knoll
50ec3252ac Do not move data around on insert neither
The while insertion logic will need further work to make it
more efficient. Currently it does use copy construction and
assignment for internal moving instead of move operations.

Change-Id: I7ae3094daa43a44629d8fa89ab6562c2a21b6cbd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-04 11:21:32 +01:00
Lars Knoll
90fadbb365 Remove the prepare call in QArrayData::appendInitialize()
It's causing a performance bottleneck and is not required anymore
after changing the allocation strategy.

Take the opportunity to change the signature from using size_t to
qsizetype.

Change-Id: I74ff1637007cf7072de80e7383a23fdfe1ccd986
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-04 11:21:27 +01:00
Lars Knoll
b99271caa6 Avoid expensive iterator calculations in append()
Avoid moving data inside the array to create free
space at one end. This is a performance bottleneck,
as it required quite a lot of calculations for every
insert. Rather reallocate and grow in this case,
so we only need to do expensive work when we reallocate
the array.

Change-Id: Ifc955fbcf9967c3b66aa2600e0627aac15f0c917
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2020-11-04 11:21:22 +01:00