Commit Graph

51452 Commits

Author SHA1 Message Date
Sérgio Martins
868a9c1658 Fix typo in a comment, PE_PanelViewItemRow doesn't exist
Change-Id: I25897ec093aca38081745eff329ec3d042bc02c5
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-04-27 13:45:03 +01:00
David Skoland
1ccf1ec99b Declare loop arg in benchmark unused
Since these tests do not actually use the filename in the loops, add
macros to declare them unused.

Change-Id: I3362e0478ac6802b37f54f90ca377aa462570d8c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-04-27 14:12:35 +02:00
Edward Welbourne
828f533b32 Check POSIX rules during QTzTimeZone creation
Previously, an apparent POSIX rule would be saved and any defects in
it would only be discovered when trying to use it to generate
transitions. Instead, check that it has the right form during the
initial parsing of its data.

In the process, since checking for DST in the process is trivial,
implement a long-standing TODO to cache hasDaylightTime()'s
answer. The array it scanned was in any case being scanned during
construction, so detecting DST in init()'s scan is trivial; and its
failure to check the POSIX rule mean it failed to notice when zones
entirely specified by a POSIX rule have DST.

Adapt a test using a POSIX-only rule to verify it does know the zone
has DST; it did not, before this change.

Change-Id: I690c013d3331600f7348dae61c35d41e5599da70
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-27 14:12:35 +02:00
Edward Welbourne
7fa8315eb1 Fix handling of a POSIX zone rule describing permanent DST
The description necessarily has fake transitions at start and end of
the year, potentially outside the year. These transitions should not
be reported by QTzTimeZonePrivate as transitions, although its data()
must find a "transition" whose data it can use (as in the permanent
standard time case, which could potentially be represented the same
way, although there's a saner way to do so, that the code already
handles) to report the zone's properties.

In the process, fix (and make more straightforward) the convoluted
decision-making code that was deciding which transitions to include in
the returned list. It was assuming invalidMSecs() would be set as the
atMSecsSinceEpoch of a transition, although this is computed in a way
that makes that value most unlikely, even when the result is invalid.
It also rather confusingly mixed < 0 tests as tests for overflow with
the one < 0 test that's about ignoring DST before 1970. Also added
comments to clarify some of what's going on there.

Expanded a recently-added test of a permanent DST zone to verify this
now works correctly.

Change-Id: Ia8d98f433fb1e479dba5479220a62196c30f0244
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-27 14:12:35 +02:00
Edward Welbourne
2383e82bcf Correct the parsing of POSIX rule day-of-year fields
There are two formats for such fields: one with a J prefix on a number
in the range 1 to 365, the other with no prefix and a range from 0 to
365. The code mistakenly treated the latter as if its range were from
1 to 366. The J-form doesn't count Feb 29th, so March always starts on
day 60; the code tried to take that into account, but adjusted in the
wrong direction (and this mislead me, in a recent partial fix, into a
fence-post error).

Add a test-case based on the Africa/Casablanca POSIX rule seen on RHEL
8.2, which tripped over the off-by-one error without a J prefix. This
incidentally also tests the J case.

Change-Id: I692ca511e5c960f91a6c21073d3b2f037f5e445f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-27 14:12:35 +02:00
Eskil Abrahamsen Blomfeldt
678cbaebcf doc: Warn about kerning in QRawFont::advancesForGlyphIndexes()
The fact that KernedAdvances does not work correctly on a majority
of fonts is confusing. So we warn users that this is the case and
point them to the correct function to use instead.

Task-number: QTBUG-92930
Change-Id: I70f4b09ea1050fceabbff25a9c91008d1754f772
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-04-27 12:12:35 +00:00
Morten Sørvig
f6c8798001 WASM: Don’t set “-g4” by default for qmake builds
This increases link time significantly; instead set
"-g4" or the new "-gsource-map" only if source maps
are enabled.

Change-Id: Ibe2d438d48e9ae2fce5f79d4e8a9f17c01cf2485
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-04-27 12:12:35 +00:00
Volker Hilsheimer
f3719c66f4 Remove links to QRegularExpression#Wildcard matching
The topic existed for QRegExp but is not relevant in QRegularExpression.

Pick-to: 6.1
Change-Id: Ife9d42b5b03163cfefff19725409a3feac1cddb2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-04-27 14:12:34 +02:00
Andrei Golubev
c3d16e2126 Skip tst_QUrl::testThreading() under QEMU
It usually fails the test with "corrupted size vs. prev_size" message
coming from malloc() or some other memory allocation routine (which
signals about memory corruption probably)

Task-number: QTBUG-93176
Change-Id: I5e34971267c52c63cda2489bef5b09bed739f532
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 6d52d86b999088ec07e58c14197bddda043ef0aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-27 14:12:34 +02:00
Andrei Golubev
e6f7202e34 Add more tests for QList/QString/QBA
The major part is stability tests for QList operations,
Also added std::shared_ptr to the Custom type. shared_ptr
accesses the memory which does not directly belong to
QList, so using it inside a passed-to-qlist type is
beneficial (e.g. ASan could catch extra issues)

Basic prepend-aware cases added to QString/QBA tests

Task-number: QTBUG-93019
Change-Id: I50e742bdf10ea9de2de66539a7dbb9abc4352f82
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit adb41bbe00b2b853d4dd26cd9ee77ae5ed541576)
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-27 14:12:34 +02:00
Andrei Golubev
dbb001eb1b Change QList's insert() and emplace() to always invalidate [pos, end())
Drop the "move left if pos <= size / 2" path in favor of reference
stability of insert and emplace operations

Leave the insert(0, ...) and emplace(0, ...) as special cases for
prepend optimization as invalidating [begin, end()) practically means
that we can reallocate behind the scenes

Doing this also simplifies the code a bit

Task-number: QTBUG-93019
Change-Id: I7c248f96d687e94a6a38f81ade901619ff2b4733
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 5e76c2acff2c70f2893306b16aeba230f3d6114a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-27 14:12:34 +02:00
Andrei Golubev
15a1ec2152 Do not shift the data pointer when removing all elements from QList
Because leaving the pointer untouched is a much more expected behavior

The tests for this (and not only) logic can be found in the following commit

Change-Id: Iec9eec9bbce04c9fd90cb6be9627c135cd989b7f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 38bba2a87c6c5c2b8100870add6d0d7ad559e669)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-27 14:12:34 +02:00
Andrei Golubev
e31a0d06d8 Add tests for QtPrivate::q_relocate_overlap_n
Test the relocation logic through the QADP::relocate() method which
basically calls q_relocate_overlap_n inside and then ensures that
the data pointers are in good state

Running these locally in fact revealed a bug in the implementation,
so these tests are definitely good to have

Task-number: QTBUG-93019
Change-Id: I353ed46a31c5c77cd0c5fcacd3dfce46e5cf3e67
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 65d0f6829cc124f6d0d4003a17bedcb74dddf33b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-27 14:12:34 +02:00
Andrei Golubev
1f2d0cd983 Resurrect data moves in QList
Use the data moves to readjust the free space in the QList,
which ultimately fixes the out-of-memory issues caused by
cases like:
forever {
  list.prepend(list.back());
  list.removeLast();
}

Task-number: QTBUG-91801
Task-number: QTBUG-91360
Task-number: QTBUG-93019
Change-Id: Iacff69cbf36b8b5b176bb2663df635ec972c875c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit a0253f5f0249024580050e4ec22d50cb139ef8d9)
2021-04-27 14:12:34 +02:00
Andrei Golubev
4b518d878a Add q_points_into_range to container utilities
We already used it in QString and QBA. And implicitly in QADP (see
parent commit). Might as well move to a common location and reuse

Change-Id: I694f0f1dbd109f17c134f64b3f3dc28d19556c88
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 10b46e7f0faecc42a94cc2e25ad3edd08ae28083)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-27 12:12:34 +00:00
Bartlomiej Moskal
96a1bfd06a Android: Remove NoSuchMethodException error
CleanUp NoSuchMethodException error appears on application start up.

Error appears after commit:
e402e1103b

Fixes: QTBUG-92885
Change-Id: Idd4d09e51c8c721ad18f9bd396c990b51cd730e7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-04-27 12:12:34 +00:00
Jukka Passi
34dc76c851 Android: Fix build error issue in examples
Added branching to plugandpaint example to get correct library
architecture to the build

Fixes: QTBUG-56322
Pick-to: 5.15
Change-Id: I4d0eb4e24681642991d08c3dd2bad73d10caf962
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-04-27 07:36:40 +00:00
Lorn Potter
cdad78a4a4 wasm: do not set autodetect wasm true until we actually detect
Change-Id: Ib6bdd3d5ed7dab108b636284ee564d14dbc2d5c8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-04-27 09:49:34 +10:00
Ville Voutilainen
e439fab4be Resurrect tests for QSharedPointer
Task-number: QTBUG-93093
Change-Id: I030c18db1ab9e48cbd3339bc2040ba0b46cd1370
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-27 01:33:42 +03:00
Joerg Bornemann
52077d4f01 Inhibit CMake generator detection for qt-configure-module
When configuring a Qt module with qt-configure-module, we want to use
the same CMake generator that was used for building qtbase.
That generator is encoded in qt-cmake-private. But qt-configure-module
overrides the generator after trying to detect what generator should be
used. That auto-detection is only useful for qtbase-builds and top-level
builds. Turn it off for repo builds other than qtbase.

Pick-to: 6.1
Fixes: QTBUG-91405
Change-Id: I07efb4afb51ba69d2f5467d272118fa51637ab54
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-26 23:11:28 +02:00
Joerg Bornemann
7d48b64f41 Add QT_ANDROID_TARGET_SDK_VERSION target property
This is the counterpart of the qmake variable
ANDROID_TARGET_SDK_VERSION.

Pick-to: 6.1
Task-number: QTBUG-86033
Change-Id: Idd64ee06eb94826430e6be5d9d878631db67c949
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-04-26 23:11:28 +02:00
Joerg Bornemann
d1eeef2625 Add QT_ANDROID_MIN_SDK_VERSION target property
This is the counterpart to the qmake variable ANDROID_MIN_SDK_VERSION.

Pick-to: 6.1
Task-number: QTBUG-86033
Change-Id: I4e1434a794f3a8345f9b4e045ab4366d486221af
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-04-26 23:11:28 +02:00
Joerg Bornemann
8fdaa081fd Add QT_ANDROID_VERSION_{NAME|CODE} target properties
Those are the CMake counterparts of the qmake variables
ANDROID_VERSION_{NAME|CODE}.

Pick-to: 6.1
Task-number: QTBUG-86033
Change-Id: I57534ff04db0c78871fe7ba81bedaf377422054b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-04-26 23:11:28 +02:00
Alexandru Croitor
adf29329ea CMake: Make qt-internal-configure-tests relocatable
It's important for conan CI builds where the correct installation
location of Qt should be used when configuring standalone tests.

Task-number: QTBUG-93037
Change-Id: I2465a439aea6826dedfb3217d1c909ad639d4ac0
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-04-26 23:11:28 +02:00
Lars Schmertmann
d81a9206ac Fix build error on iOS with the configure option -qtnamespace
qtbase/src/corelib/kernel/qsharedmemory_p.h:62:33: error:
    unknown type name 'QString'; did you mean 'XXXX::QString'?
    int createUnixKeyFile(const QString &fileName);
                                ^~~~~~~
                                XXXX::QString

Pick-to: 5.15 6.0 6.1
Change-Id: I455526503f059efc2f496b159b4cb098385dda00
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-04-26 21:16:05 +02:00
Liang Qi
6a91ad7b5b xcb: Add more debug info for XCB_INPUT event
Pick-to: 6.1 6.0 5.15
Change-Id: I99bba80659a103aa79426ae94cd04db2c5d851d6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-04-26 17:35:55 +00:00
Niclas Rosenvik
96f493f3b8 Add override to addPaths and removePaths in kqueue filesystem watcher
Add override to addPaths and removePaths in kqueue filesystem watcher
Fixes build break in developer-build with gcc 10 on *BSD

Pick-to: 6.1
Change-Id: I7d91251d6bcb1614bb9f21c319abc9c2df681cda
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-04-26 17:35:55 +00:00
Alexandru Croitor
2fccea3b70 CMake: Fix tst_qaddpreroutine to work with static builds
DEFAULT_IF needs to be true so that in a static build the
built plugin is automatically linked into the test executable
using the special static plugin per-repo behavior in
qt_internal_add_executable.

The QtPostProcess routines are not executed for this test project
because we don't use qt_build_repo. This means that no
QtFooPluginCMakeConfig.cmake file is generated and thus there's no
point in using qt6_import_plugins because the pulic plugin genexes
won't know about this target anyway.

Explicitly set the CLASS_NAME so that the name expected by the
Q_IMPORT_PLUGIN macro matches the name of the plugin instance that moc
generates in QT_MOC_EXPORT_PLUGIN.

Amends 22e967c304

Task-number: QTBUG-87580
Task-number: QTBUG-90341
Pick-to: 6.1 6.0
Change-Id: I5ef361e7e2cebc46b35310c679f15c84cd61b4a5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-04-26 19:35:55 +02:00
Alexandru Croitor
31ee3c84a7 CMake: Install prl files from all repo build dirs in a top-level build
Previously, in a top-level build we always generated the final prl
file somewhere under QT_BUILD_DIR (which is qtbase_build_dir). After
each repo was processed by QtPostProcess.cmake, we installed the prl
files found in PROJECT_BINARY_DIR.

For qtquickcontrols2 this meant that qml plugin prl files were placed
under qtbase/qml, but we tried installing the prl files from
qtquickcontrols2/qml, which didn't have any prl files.

In a static Qt build, qmake's qt.prf calls qmlimportscanner to
identify which plugins should be linked to the executable. This worked
fine because the plugin .pri files were installed correctly.

None of the qml plugin library dependencies were linked in though.
This is supposed to happen in qmake's C++ code where it tries to
find the associated prl file of a linked library in order to extract
all its dependencies. Because no prl file was found, linking failed
with multiple undefined symbols.

Fix this by installing the prl files from QT_BUILD_DIR rather than
PROJECT_BINARY_DIR.

Note that this will create multiple install rules for certain files,
but it's harmless. An example is imageformats.

We process qtbase plugins, see qjpeg, issue an install rule from under
the qtbase/plugins/imageformats folder. We then process
qtimageformats plugins, see webp, issue another install rule from
under qtbase/plugins/imageformats.
The first install rule will install both qjpeg and qwebp, the second
install rule will merely say all plugins are up-to-date.

Pick-to: 6.1 6.0
Change-Id: I8a4bb67bfafc1d016eab62f4fe66b6ba378ceeb2
Fixes: QTBUG-93021
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-04-26 19:35:55 +02:00
Robert Löhning
7acce0c525 Fuzzing: Test different calendar systems
Change-Id: I61be9f09d4299674e9cf9daf1d4dbbf90f3d2d2d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-04-26 17:51:38 +02:00
Andreas Buhr
6a3cc36e4a Port of QTimeLine to new property system
The six properties duration, updateInterval, currentTime,
direction, loopCount and easingCurve have been ported to the
new property system and are now bindable.
Drive-by renamed a local variable to avoid shadowing.

Task-number: QTBUG-85520
Change-Id: Ibabf106f5200d2dd4329a1e1f96112eccc29d6b1
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-04-26 16:44:54 +02:00
Luca Beldi
6ec3fa2842 Fix QTreeModel calling beginRemoveRows twice
For items that are children of other items, removeRows calls
beginRemoveRows directly and then once again inside takeChild()
The signal blocker that dates back to the monolitic import from Nokia
prevents the model from emitting extra signals
but the persistent indexes are corrupted nonetheless.

Fixes: QTBUG-90030
Pick-to: 6.1 6.0 5.15
Change-Id: I5bc4b2598bf13247683b113faeec22471f1f04a4
Reviewed-by: David Faure <david.faure@kdab.com>
2021-04-26 13:44:51 +01:00
Luca Beldi
fcea8e7aa8 Fix QAbstractItemModelTester false positive
When inserting rows to a branch with no columns
the tester should not complain about indexes being invalid

Pick-to: 6.1 6.0 5.15
Change-Id: I466f4e5140b10f6dcf65a71f109c2d3be7336507
Reviewed-by: David Faure <david.faure@kdab.com>
2021-04-26 13:44:51 +01:00
Volker Hilsheimer
3f98ff474f Fix linking on Windows when SSL is not configured
The qt_ForceTlsSecurityLevel symbol is not defined if SSL is not configured,
so don't use it in the QNetworkReply test if it's not.

Change-Id: Id3110a1997fea1648b48bfc411e90e7efe306678
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-04-26 14:44:51 +02:00
Joerg Bornemann
63a812b851 Fix "qmake -spec foo" call for cross builds
In a cross built Qt, for example Qt for Android, calling "qmake -spec
android-clang" led to an error message:
    "Could not find qmake spec '-qtconf'."

This happened, because:
- the qmake in Qt for Android is a wrapper script that calls
  "qmake -qtconf qt_target.conf -spec android-clang"
- the first stage of command line argument handling in qmake garbled the
  call to "qmake -spec -qtconf qt_target.conf android-clang"

We do not modify the order of arguments anymore.

Instead, we skip the "-qtconf <file>" arguments in the first argument
handling stage that is supposed to determine qmake's modus
operandi (like -project or -query).

In addition, we need to fix the assignment of
QLibraryInfoPrivate::qtconfManualPath which was only done if
QMakeGlobals::addCommandLineArguments returned ArgumentsOk. However,
this function returns ArgumentUnknown, if it encounters an argument it
cannot handle - like the project name.
Now, we assign QLibraryInfoPrivate::qtconfManualPath if there was no
error detected.

Document the return values of addCommandLineArguments.

This amends commit 661b586a69.

Pick-to: 6.1 6.0
Fixes: QTBUG-93079
Task-number: QTBUG-85136
Change-Id: I12ec25b17d64c00be2a3904b7c4a975b781500a0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-26 10:59:32 +02:00
Edward Welbourne
6235893d54 Update CLDR-derived data to newly-released v39
Routine update with minor changes to locale data, no new languages,
territories or scripts. Various Spanish locales change m_grouping_top
from 1 to 2, reversing a change to a test of Costa Rica's currency
formatting made in commit bb6a73260e.
Includes updates to time-zone IDs.

Fixes: QTBUG-91478
Pick-to: 6.1 6.0 5.15
Change-Id: I78ee161275b3c456c5800a7317a96947c932cf8e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-26 10:59:32 +02:00
Volker Hilsheimer
5f5fc9bf6f Fix QMetaType API deprecation warning in benchmark
Slipped through 1d3fe418e2.

Change-Id: I7ff39852a878ce76d48d5a1798a49f9137e00a13
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-26 10:59:32 +02:00
Kai Köhne
89f51a0680 zlib: Disable MSVC warning C4267
Pick-to: 6.1
Change-Id: Ifc51c1847841bb7172f79067facf0c7e425a042b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-04-26 10:59:30 +02:00
Thiago Macieira
c58be606dd QLockFile/Unix: remove the " (deleted)" suffix from kernel-supplied names
The kernel appends that to the symlink targets in /proc for files that
have been deleted.

Change-Id: I7a386ad4f0cb4e2ba629fffd16789b5a52491627
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-04-26 04:42:32 +00:00
Thiago Macieira
615972b74f QLockFile: don't use the local timezone to compare file times
There's no need to find the local time zone and do expensive conversions
to compare regular, old seconds-since-1970 to the time now.

Task-number: QTBUG-93069
Change-Id: I6cdea00671e8479b9c50fffd167897b91a04ce03
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-04-26 04:42:30 +00:00
Giuseppe D'Angelo
37edc6ab49 PRI* datatypes: fix typos in documentation
A c&p mistake manage to slip through in 5fabad9a61, amend it.

Change-Id: I706a6643d0745f336afca7bda0d8b0359354a0d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-25 20:57:56 +02:00
Giuseppe D'Angelo
5fabad9a61 Long live PRI*Qdatatypes
Qt defines some integral datatypes (qsizetype, qintptr, quintptr,
qptrdiff) not in terms of the corresponding language datatypes (resp.
make_signed_t<size_t>, intptr_t, uintptr_t, ptrdiff_t) but as "integer
types with the same bit size of the corresponding language type" (and of
course the corret correct signedness for the target type).

This makes the Qt datatypes not printable via printf-like formatted
output, incl. qDebug, qWarning, QString::asprintf and so on; that's
because there isn't a format modifier that would universally work
with the Qt definitions.

For instance, on a 32 bit platform, ptrdiff_t may be a typedef for long,
while qptrdiff is a typedef for _int_ instead. Both long and int would
indeed be 32 bits, but they still are different types, and this means
that the ptrdiff_t-specific 't' length modifier would be wrong for
qptrdiff:

  qptrdiff p;
  printf("%td", p); // WARNING: -Wformat: wanted long, got int

Similarly, not using 't' breaks on 64 bits, and so on and so forth.
There isn't a way out, short of inserting casts on every print
statement.

So, let's adopt the same solution C/C++ use for their own integer
typedefs: the PRIx macros. This allows one to always use the correct
formatting specifier without the need of a cast.

I'm not adding the macros for the qintXX datatypes, as they already
exist in the Standard Library.

[ChangeLog][QtCore][QtGlobal] A series of PRIxQTDATATYPE macros have
been added. They make it possible to print some Qt type aliases
(qsizetype, qintptr, etc.) via a formatted output facility such as
printf() or qDebug() without raising formatting warnings and without
the need of a type cast.

Change-Id: I473226a661868aed9514d793c8e6e4d391ab5055
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-04-25 15:24:45 +02:00
Igor Kushnir
7c9597ef56 Add QSortFilterProxyModel clear-filter benchmark
Use QBENCHMARK_ONCE rather than QBENCHMARK to avoid skewing the results:
when the QBENCHMARK block is repeated multiple times after the setup
code above runs once, only the first setFilterRegularExpression() call
unfilters some rows, while the subsequent calls simply check that there
is nothing to do.

The added benchmark is sensitive to the inefficiency - quadratic rather
than linear time complexity - fixed by
7d92ef63d7. The following two tables
contain the benchmark results on my GNU/Linux system. The numbers denote
milliseconds per iteration.

1. Qt 5.15.2 without the performance fix:
                    10K 25K 50K     100K    250K    500K
       no match     0    1    2       5       14       28
            all     0    0    0       1        3        7
          first     0    1    2       5       14       28
         1000th     2    6   12      25       68      302
         middle     3   34  132     518     3300    13665
1000th from end     1    4    9      19       50      103
           last     0    1    2       5       14       30
  each 10'000th     0   39  211     937     6326    41050
 each 100'000th     0    1    2       5     4226    34780

Without the fix the benchmark times out and aborts at 1000K and 2000K
data rows.

2. Qt 5.15.2 with the performance fix:
                    10K 25K 50K 100K    250K    500K    1000K   2000K
       no match     0   1   2   4       12      26       56      136
            all     0   0   0   1        3       7       14       28
          first     0   1   2   4       12      26       56      136
         1000th     0   1   2   4       13      28       62      145
         middle     0   1   2   4       13      27       59      142
1000th from end     0   1   2   4       13      28       60      145
           last     0   1   2   4       13      27       59      141
  each 10'000th     0   1   2   6       22      69      290     1413
 each 100'000th     0   1   2   4       13      30       81      261

Change-Id: I419a5521dd0be7676fbb09b34b4069d4a76423b1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-04-25 13:25:01 +03:00
Giuseppe D'Angelo
49609f58a5 Fixed type integers: streamline the definitions
On all the platforms we support, we require these sizes in bits:

* char: 8
* short: 16
* int: 32
* long long: 64

We can get rid of the MSVC-specific type aliases (MSVC guarantees
__intXX to be aliases anyhow, not extended integer types) and just
use the builtin types.

Also, we require C++11 and C99, so "LL" and "ULL" are the correct
standard suffixes for (unsigned) long long. Remove the non-standard
suffixes from the Q_(U)INT64_C macros.

Change-Id: If007cd88d74064a163b5e910ca1983acd1dd1d10
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-24 17:22:24 +02:00
Igor Kushnir
7d92ef63d7 Optimize quadratic-time insertion in QSortFilterProxyModel
Let N = proxy_to_source.size() before the code modified in this commit.
Let M = (N - proxy_start). Let K = source_items.size(). The algorithmic
complexity of the removed loop is O(N+K+K*M), assuming the number of
O(N+K) reallocations is a constant. The complexity of the QList::insert
and std::copy implementation is O(N+K). This is much faster in practice
when K and M are of the same order of magnitude as N.

For example, this quadratic complexity issue results in noticeable
slowdown in the following scenario:
  * a QSortFilterProxyModel is used only for filtering, not sorting;
  * first set a filter that matches a single item in the middle of a
    huge number of items (about one million) - this is reasonably fast
    (takes about a second);
  * then clear the filter (i.e. set an empty filter so that no item is
    filtered out) and watch your application's UI freeze for a minute.

The "Add QSortFilterProxyModel clear-filter benchmark" commit (with
Change-Id I419a5521dd0be7676fbb09b34b4069d4a76423b1) adds a benchmark
that runs much faster with this performance fix.

Pick-to: 6.0 6.1
Change-Id: Ieaec173e6910f5d21eaee49402087f7711abbedf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-04-24 15:37:08 +03:00
Thiago Macieira
885eff0537 QThreadPool: obey the docs that say we always use at least 1 thread
Even if the user (usually accidentally) sets a thread count of zero or
negative. The reporter in the bug report did
QThread::idealThreadCount() - 1 on a 1 CPU system...

Drive-by add to the documentation and the missing #include.

Pick-to: 6.1 6.0
Fixes: QTBUG-93007
Change-Id: I6cdea00671e8479b9c50fffd167807d14e030154
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-04-24 00:37:14 +00:00
Alexey Edelev
ddaa7150d8 Switch to target_sources approach for the static library resources
Linking the object resource library to the static library still
causes an issue if the static library contains symbols that are
used in the resource library. The proposed approach creates the
following linker chain:
    executable <- resource objects <- static library <- Qt::Core

For the static qml plugins this means that the qmlcache_loader
object file will state in the linker command line before the
plugin library that implements '::qmlData' and
'::aotBuiltFunctions' functions.

We also need to keep the INTERFACE linking of the resource library
to the targets that it belongs too, to collect all the dependencies
that resouce library supposed to propagate to top-level targets.

Pick-to: 6.1
Fixes: QTBUG-93002
Change-Id: Ice0aabb6817317724abeb3db3bb8a954905cfad1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-23 21:31:57 +02:00
Giuseppe D'Angelo
b5e9130c44 QtGlobal: check the Qt fixed size integers
"Just in case", together with all the others platform checks we
have in qglobal.cpp, check that we're not accidentally breaking
our type aliases for fixed size integers.

Change-Id: Iaa9438741b3a7e89f3c458763c7d222ef2abe961
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-04-23 20:59:45 +02:00
JiDe Zhang
22e967c304 fix: The QtStartUpFunction function may be called repeatedly
Don't call pre routine function in qAddPreRoutine if
the qt_call_pre_routines is not called

Pick-to: 6.1 6.0
Task-number: QTBUG-90341
Change-Id: I0ee70561dc57b857f8b3b1cf42c9dfe0cf45bd49
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-23 18:51:30 +02:00
Joerg Bornemann
f1c37ead59 Error out if requesting Android build without toolchain file
Passing Android-related variables to the initial CMake call would have
no effect if no (or an empty) value of CMAKE_TOOLCHAIN_FILE was
specified. To alleviate user confusion, yield an error if an Android
build was apparantly requested, but the toolchain file is missing.

Change-Id: I28ec94eabe436d4b9b410b48c7cad1b48d3e1bec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-23 16:50:55 +02:00