Commit Graph

11994 Commits

Author SHA1 Message Date
Marc Mutz
16f695f8a8 tst_qsettings: reliably remove the empty.ini file
... using QScopeGuard.

Change-Id: I3693ca5e5ef32aa7ccabaa7e05a94bee69e0910b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-11 20:25:05 +02:00
Edward Welbourne
f6f6d06028 Remove pure-virtual-signals.h include from tst_moc.cpp
The relevant test is conducted by tst_Moc::warnOnVirtualSignal(),
added in 2009, <quote>

    Fix Warning saying that signal cannot be made virtual

    The test for virtual signal did not work.
    But we cannot make an error right now or it might break existing code
    (exemple in task 210879)

</quote> but without removing the #include, so we do still get a
warning about that when building tst_moc.

Pick-to: 6.2 6.1 5.15
Change-Id: I5ea18058f22bbd483d1ff18b0ca7b360f6674ed9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-11 17:12:12 +02:00
Edward Welbourne
063b421251 Correct handling of last second of 1969 (again)
In my prior attempt to handle the last second of 1969, I forgot that
the QTime we're describing is a local time, so whether *it* thinks
we're at the last second of the day is beside the point. Fortunately,
preceding second should get -2 as return if mktime()'s initial -1
actually meant the last second of 1969, so we can test via that, after
a cheap pre-test to save doing this too often (albeit we only even
attempt the check if mktime() returned -1 in any case).

Restructured qt_mktime() in the process to deal with the error case's
early return promptly instead of doing it in an else clause. Also
repackage the calls to mktime to isolate various quirks and simplify
the logic in qt_mktime(). This also prepares for setting tm_isdst as a
hint when we know when we came from, in massageAdjustedDateTime().

Refined one test, added two more test cases. These didn't fail before
this fix, but a judiciously-placed qDebug() in testing revealed that
localMSecsToEpochMSecs() resorted to its fall-back handling - as if
the date-time were outside the time_t range - due to qt_mktime()
failing, for these test-cases (and several others). This fix evades
that fall-back behavior; a judiciously-placed qDebug() shows none of
our test-cases now fail callMkTime().

Change-Id: I11aa5015191dc4a565c28482307f7bc341c207e7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-11 17:12:12 +02:00
Edward Welbourne
e069f06da7 Clean up tst_QDateTime's conditions on zoneIsCET
In setMSecsSinceEpoch(), the CET end-of-time is invalid anyway, so a
whole block (rather than just one sub-test of it) was irrelevant for
the max-qint64 test case (aside from verifying cet *is* invalid).

Split out to a separate test the part of a data-driven test that was
the same for all data rows. Reworked several ill-advised ways to use
QSKIP().

Change-Id: If757d3e722c81fc42a87256125ceef605b6bfb64
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-11 17:12:12 +02:00
Edward Welbourne
182afbe335 Hangul composition: use < base + count checks, not <= checks
Before Unicode 4.1.0 there was an error in the example code for Hangul
normalization that used <= on the ends of some ranges of values, where
they should have used < tests. This was faithfully copied but the need
for correction has only lately come to light.

Thanks to Ma Lin for pointing this out and providing the fix and
test-cases.

Fixes: QTBUG-71894
Pick-to:  6.2 6.1 5.15
Change-Id: I5c7fec1f9fac1f7a25b2d5e9c3109a90a7ff49e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-11 13:57:19 +02:00
Peng Wenhao
9c32e7dc60 remove cmake compatibility functions for old API
QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS has been removed

Change-Id: Ic77cdae4e5151e3b0fe05cc6dd5b43bffc24768c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-11 01:05:28 +08:00
Zhang Hao
0242be9060 Check scrollbar ScrollBarOverlap when computing QListView margins
When the listview setWordWrap is true and ScrollBarPolicy is
ScrollBarAsNeeded, if QStyle::PM_ScrollView_ScrollBarOverlap
returns true, the text displayed an empty line.

Fix this by not reserving the width of the vertical scrollbar
if the flow is TopToBottom and the vertical scrollbar, and QStyle
returns true for PM_ScrollView_ScrollBarOverlap. Amends
aeef92c3c3

Pick-to: 6.1 6.2
Fixes: QTBUG-94248
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: I4d47c7e86bbb86474cb1a99bb26d8b67f0e8a7e2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-06-10 14:02:11 +00:00
Alexey Edelev
4e901a2f99 Add the check for linker capabilities to resolve circular dependencies
'ld' only capable to resolve circular dependencies by wrapping the
suspected static libraries and objects using --start/end-group
arguments. We want to detect if linker is 'ld' at configure time to
decide how to link the resource objects if finalizers are not enabled.

The qt_config_compile_test function is extended with an extra argument
since it's required to pass custom cmake flags to the ld-related test.

Pick-to: 6.2
Change-Id: I484fcc99e2886952d8b0232f37e4e6a35d072931
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-10 15:17:55 +02:00
Timur Pocheptsov
6998ed4c96 Introduce a mini-version of qsslsocket_openssl_symbols_p.h/.cpp
For auto-tests that were temporarily disabled. Similar to
network-settings.h, header-only stuff.

Fixes: QTBUG-92866
Fixes: QTBUG-92877
Change-Id: I15b5c0b41f0d8bfe59b09c844884ff6d99e6d41a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-09 20:55:49 +02:00
Volker Hilsheimer
b1fdcc8c0f QAbstractItemView: block autoScroll from interfering with QScroller
When pressing an index in order to start a flick gesture, QAIV sets
the current index. When QScroller changes state to Dragging, then
QAIV restores the current index to what it was before the press, as
the user is clearly scrolling the view. With autoScroll enabled, this
will produce an ugly jump if the old current index is no longer in
the viewport.

To prevent this, disable autoScroll before restoring the currentIndex.

Fixes: QTBUG-64543
Pick-to: 6.2 6.1 5.15
Change-Id: I3e0a18a6a179d80b9d810fce5aa658f0cfff9a29
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-06-09 18:19:15 +02:00
Volker Hilsheimer
06b1e404c9 Fix scrolling of tab bar when the visible tab is wider than the visible space
When finding the index we need to scroll to, use the one where both start
and end of the tab rect are outside the currently visible section.
Otherwise we wouldn't scroll when the left-most index ends outside the
visible section.

Add test, which requires that the scroll buttons have object names.

Fixes: QTBUG-70498
Pick-to: 6.2 6.1 5.15
Change-Id: Id153c77dd5fca146612375e0ff39bd1f3e0536b1
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-06-09 18:19:15 +02:00
Timur Pocheptsov
096b186004 tst_QNetworkReply::ignoreSslErrorsList, use the right error
The error that the actual runtime will encounter, and not the one that compile-time
ifdefs will (potentially) erroneously select.

Change-Id: I8ef4c34bcb8b3e568bc39f8c8ea6bfb7732f9e27
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-08 16:17:23 +02:00
Fabian Kosmale
c76a2d7c9c normalizeTypeFromSignature: Beware of anonymous struct/union
Do a quick check whether the type name contains an anonymous type. If
so, do not try to use optimized version. The simple check should still
be faster than calling normalizeType unconditionally.

Also only apply the faster version for clang and gcc, instead of all
non-MSVC compilers. Applying it to other compilers would require further
testing to handle anonymous structs.

Moreover, remove space before '(', which is necessary for function
pointers.

Fixes: QTBUG-94213
Change-Id: I795d1964f7a68daa6f9a5f262816d51ee7728788
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-06-08 15:37:38 +02:00
Mårten Nordheim
14b74af060 QNetworkInformation: Adjustments to captive portal API
Make it return bool since the TriState was really only used signify that
the property was unsupported but there is already a separate way to
check if it's supported. More importantly there is no different set of
actions available to a user if they're in the Unknown or False state.

Because of the change to bool, we also rename the property to have an
'is'-prefix.

Change-Id: Iaaaad5ac31e663c36e00223bf5b0e719f412fc69
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-06-08 14:54:16 +02:00
Volker Hilsheimer
14e09ada69 Fix rearranging of icons in listview via drag'n'drop
Since 0f1008a593, views record if they
moved the item in the model, and prevent the deletion of the source item
in QAbstractItemView by setting the dropEventMoved private data member.

However, QListView in icon mode is special: it doesn't rearrange the
model, it repositions the icons in the view. While the dropEventMoved
logic was applied to the drag event filter to prevent deletion, the
variable was never set in the filterDropEvent handler. The drop event got
ignored, breaking rearranging of icons.

Fix this by setting the dropEventMoved member in filterDropEvent.

Fixes: QTBUG-94226
Pick-to: 5.15 6.1
Change-Id: I963f5db0f81bcd0d25eef05d9a265be00a5871f6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2021-06-08 00:10:42 +02:00
Volker Hilsheimer
efdaba37d6 QAItemView: in MultiSelection, press deselects only if no drag can start
In MultiSelection mode, items are by default toggled on press, which
follows the example of standard Windows controls. However, when dragging
is enabled, then the press might be the beginning of a drag'n'drop
operation, and deselecting the item on press breaks the selection and user
experience.

Don't toggle the selection for presses on an already selected item that
might get dragged; instead, wait for the release event.

Extend the test case slightly to cover the special case. Dragging a
selection in a drag-enabled and MultiSelection item view wasn't possible
before either.

Fixes: QTBUG-59888
Change-Id: Ibd3e95a71ea63dd1e9bc3c8a723eafa9a1c21afa
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>
2021-06-08 00:10:42 +02:00
Volker Hilsheimer
dc5e8aa81c QAbstractItemView: don't toggle extended selection on Ctrl+Press
In ExtendedSelection mode, a Ctrl+Press might be both the start of
a selection toggle, or the start of a Ctrl+Drag operation.

If we already toggle on the press, then it's impossible to drag the
existing selection while the Control key is pressed. Ignore Ctrl+Press
events and let the corresponding release event toggle the selection.

Adjust the relevant test cases accordingly. The QItemDelegate test
case used a click+control event incorrectly, such an event doesn't
change the clicked state and should not be eaten, and now it does
change the selection, so fix the test.

Task-number: QTBUG-59888
Change-Id: Ia76126e31c28bc97d3e93e54965bdb1d0b8ac6a4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-07 20:23:17 +02:00
Edward Welbourne
cce3445e70 Always include standard name in QLocale::uiLanguages()
Previously, for locales other than the system locale, no entry was
added to the list for the actual locale whose variants - with and
without likely sub-tags - were being appended. In most cases the
standard name will in fact coincide with the variant without likely
sub-tags, so this was unlikely to cause a problem, but it should be
present regardless.

At the same time, turn tst_QLocale::uiLanguages() into a data-driven
test and add another row to its table.

Change-Id: I5cb2d805d78fc3415d82b169caa6154b0f284708
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-07 17:14:14 +02:00
Edward Welbourne
b2871765ce Fix augmentation of UI language list
Previously, the augmentation wasn't being applied to the system
locale, due to a mistaken test claiming the locale's name didn't
resemble the string from which it was constructed. The test dates from
before various fixes to likely sub-tag processing that should make it
redundant now. This makes QLocalePrivate::rawName() also redundant
(and its conversion of QLatin1String to QByteArray relied on '\0'
termination which wasn't actually present in the various codes).

Expanded the test of systemLocale() to also test uiLanguages() turns a
single entry into the list we expect; and add two new test-cases.
(The test uses a mock system locale class, making this independent of
the platform backend.)

Fixes: QTBUG-92234
Pick-to: 6.1 5.15
Change-Id: I0cdf6eae152a42dc377f4ea3e62c282ff4be1764
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-07 17:14:14 +02:00
Fabian Kosmale
f6fb118c94 QProperty: Do not involve semi-destroyed QObjects in bindings
Once we're in ~QObject, only methods of QObject are still valid.
Notably, no setter of any derived class is still valid. Thus, to be safe
we must no longer react to binding changes of those properties. To
ensure that this happens for QObjectCompatProperty properties, we
explicitly clear the binding storage.
Fixes a particles3d example crash.

Change-Id: I10d2bfa5e96621ce039d751cffaf3ac41893623e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-06-07 13:14:00 +02:00
Karsten Heimrich
ded82d1b07 Implement QFileInfo::junctionTarget(), adjust auto-test
The change in 004e3e0dc2 introduces
Windows junction awareness, though users were still unable to resolve
the junction target. This change adds the ability to solve this.

Fixes: QTBUG-93869
Change-Id: I9f4d4ed87b92e757f7b6d8739e2a61b58c096f63
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-06-05 01:16:06 +02:00
Karsten Heimrich
0564ebdb36 Unify behavior for long path or UNC prefix removal
Split the code out of QDir::fromNativeSeparator into a separate
reusable function to remove the above-mentioned prefixes. Fixes
and unifies behavior if the prefix was given with slashes instead
of backslashes. Add a couple more test cases.

Fixes: QTBUG-93868
Pick-to: 5.15 6.0 6.1
Change-Id: Ibd94ae283e2fb113f9c2db97475fbc7d89522bbf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-06-05 01:16:06 +02:00
Joerg Bornemann
6d82d0c532 Remove CMake compatibility functions for old API
All repositories define QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS by now,
and we can remove QtCompatibilityHelpers.cmake altogether.

Change-Id: I4d8104246e96a4514d5651c104607d651d208d95
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-04 14:27:20 +02:00
Assam Boudjelthia
965fc1148d JNI: Add calls to get field IDs
Task-number: QTBUG-92952
Change-Id: Ie68ede4b00a411064a29925b28b1f60a84d2d678
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-06-04 10:46:57 +03:00
Timur Pocheptsov
fd217e7f00 QDtls(Cookie) autotests - use the proper API to detect DTLS support
Instead of relying on some string comparisons and the current knowledge
of which backend supports DTLS, use the proper API we already have in
place to test if a particular class is supported by the active backend.

Change-Id: I58ca0f7b7fcef68ec375cd64b83e51d4335817da
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-03 20:08:32 +02:00
Volker Hilsheimer
5174f979a3 QAbstractItemView: add test for mouse selection
Covers all selection modes and various combinations of mouse press, click,
drag, with or without modifiers.

Task-number: QTBUG-59888
Change-Id: Ib8ddc319a89649338d55fbc47e5a7ccfed338af9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-06-03 19:37:46 +02:00
Volker Hilsheimer
17c1ebf8bf QAbstractItemView: don't block dragging after double click
After d6551fe125 it was no longer possible to start a drag with a
double click (where the first click selects an item, and the second
press+move starts the drag). Resetting the pressedItem variable to block
the emission of the clicked() signal had this unwanted side effect.

Instead, use an explicit boolean to store that the next release event
will be the result of a double click, so that the clicked() signal is not
emitted again (preventing the double-emission was the purpose of change
d6551fe125).

Task-number: QTBUG-77771
Fixes: QTBUG-94087
Pick-to: 6.1 5.15
Change-Id: I082c5169d89eb980dcd7985ef3d302b6ff060fb9
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Olivier BARTHELEMY <perso.olivier.barthelemy@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-03 19:37:46 +02:00
Timur Pocheptsov
eab0bb73a5 tst_QSslSocket::readBufferMaxSize() - workaround the flaky test
Task-number: QTBUG-94186
Change-Id: I8c82f1fede8f9512f531f4ff17508b9e71ebf0b7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-03 17:05:44 +02:00
Laszlo Agocs
64089b900f rhi: Enable reading back slices of 3D textures
Change-Id: I0c687677b7e86b7284130c775718b29aca2cca40
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-06-03 17:05:44 +02:00
Edward Welbourne
4652da536a tst_QDateTimeEdit::editingRanged(): use QScopedPointer
Test would previously have leaked on failure.
While checking for other uses of delete-after-checks, simplify one
place that tested deleting a calendar widget lead to recreation.

Pick-to: 5.15 6.1
Change-Id: I9524902a02dd42793bcf71113c6799dc925ac4a0
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2021-06-03 16:14:00 +02:00
David Faure
4ec5622e62 QSortFilterProxyModel: create mappings on demand again
Calling create_mapping in setSourceModel as introduced by 8455bfee76
can lead to an early call to filterAcceptsRow, and some existing applications may crash.
It is also an incomplete solution since it was only done for the
toplevel index but not for child indexes.

Instead, go back to creating mappings on demand.
This means coming up with a different fix for QTBUG-87781 (dataChanged
not emitted for indexes that haven't been mapped yet, i.e. not queried
or shown anywhere).

When this happens, we can't know if the index was previously filtered
out or not (for lack of a dataAboutToBeChanged signal...). Creating
the mapping with the new data only gives us the new state of affairs,
there's no reference state to compare to. Therefore, when the mapping
is missing (during dataChanged handling), create it, but skip all the
logic about row insertion/removal, just forward the dataChanged signal
if the row isn't filtered out.

Creating the mapping might require creating first mappings for parents,
recursively, which wasn't done anywhere in QSFPM yet, hence the new
create_mapping_recursive() method.

In addition to all this, the handling of removed items was incorrect,
remove_source_items did nothing if the parent was gone, and then
source_items_removed was trying to adjust indexes in an incorrect list.
If the parent is gone, clear the proxy_to_source list, so there's
nothing to adjust afterwards. This bug actually doesn't happen anymore
in this version of the patch, but the change still seems right and might
prevent repeating a long debugging session in the future.

Thanks to ChunLin Wang for the unittest in this commit.

Done-with: ChunLin Wang
Pick-to: 6.1 6.0 5.15
Change-Id: Id543d0cc98f1a03b5852bda01d2f49b980e06be7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-06-03 00:53:08 +02:00
Eirik Aavitsland
2b52452843 Add load/fromdata() overloads taking QByteArrayView to QImage
Handy when one has the data buffer to be read in a QBAV.

This also fixes an issue and compiler warning about passing a
qsizetype data length value as an int, and makes it possible to pass
a qsizetype-size length without going through QByteArray.

Makes the QByteArray overload redundant.

Change-Id: Iba8825cf0fd8003fb2eac5b1d30a61ec91b85ceb
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-06-02 23:02:45 +02:00
Karsten Heimrich
5b6f5c6fc2 Make bool isSymLink, isJunction inferred from resource.type
Change-Id: I90574b62c8d21e3559fb219543f564454b4335e1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-02 23:02:45 +02:00
Karsten Heimrich
01f003f0aa Refactor createSymbolicLink() and createNtfsJunction()
Both functions now return a result object. Eliminates the need
to pass the errorMessage out-parameter. Adapt auto-tests.

Change-Id: I110b68fedc67b01f76796c44fa55383b2cc03460
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-02 23:02:45 +02:00
Karsten Heimrich
ebacf42561 Move createSymbolicLink() to the shared header
Change-Id: I737f521791faf07d704e15d36d57444b3187ba9d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-02 23:02:45 +02:00
Andrei Golubev
e6a2892772 moc: Add relative property index to JSON output of PropertyDef
Needed for QML compiler to know property index of C++ type at
compile time without going through QMetaObject::indexOfProperty

Change-Id: I404e71d6071d36812661df17d12b879a8dcbd146
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-02 19:03:45 +02:00
Fabian Kosmale
d5ab0101ff Avoid use after free in tst_qsequentialanimationgroup
The test connects finished to the groups clear method, which in turn
deletes the animation instance. Thus, no member must be accessed after
calling stop, unless we use a (costly) QPointer to guard against
deletion.
Notify earlier that totalCurrentTime changed to avoid the issue.
As a drive-by, modernize the connect in the test.

Fixes: QTBUG-94143
Change-Id: I923101107b7f79115be69a58c8e8d5177a98d48f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-06-02 16:45:23 +02:00
Assam Boudjelthia
78ed8034d2 Add a const JNINativeMethod[] overload for registerNativeMethods()
The JNI interface expects a const JNINativeMethod[] and our wrapper
takes a non-const. Also, this was causing refactoring of exisisting code
with a const JNINativeMethod[] to fail because the call expects a
non-const.

Change-Id: If790c401650cb33fe31f93bafe41aab7714488e9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-02 08:20:17 +00:00
Lars Knoll
6c1a9f2b4d Simplify storing of notification objects
QPropertyChangeHandler is a templated class and it's argument is
a functor. That makes it inherently cumbersome to use the class
in any context where the change handler needs to be stored.

Introduce a QPropertyNotifier class that stores the functor
in a std::function<void()>, and add a QProperty::addNotifier()
method that can be used instead of onValueChanged().

Also make QPropertyNotifier default constructible.

This significantly simplifies the code that needs to be written
and makes it possible to store notifications as class members
without major hassle.

Fixes: QTBUG-92980
Change-Id: Id5b7baec093b9ac0467946cded943d92ad21030b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-01 16:29:15 +02:00
Friedemann Kleint
de15836dbf uic: No longer generate star imports in Python
Use class WriteIncludesBase and store classes encountered in a
per-module hash (Qt/custom widgets). Write out only the required
classes.

Add --star-import as a fallback should the change cause issues.

Task-number: PYSIDE-1404
Change-Id: Ic50e26758ddd0f2f8aebbce470d32a36fb09a2c4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2021-06-01 16:29:15 +02:00
Inho Lee
7ea2fbddcf QtGui/math3d : Fix QQuaternion::getEulerAngles
When rotating M_PI_2 based on x-axis, quaternion to euler conversion
makes NaN for the x-rotation value.  This patch fixes this corner case.

Fixes: QTBUG-93600
Pick-to: 6.1 6.0 5.15
Change-Id: Ice321a80ad90dba9cf3ee3a14ec7d3d047c21bd3
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-06-01 09:01:23 +02:00
Mårten Nordheim
da955aadf5 QNetworkInformation: Behind captive portal
This patch adds the API, with no supporting backends

Task-number: QTBUG-93848
Change-Id: I50454717f928819e1b990df91872675e842f9987
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-05-31 17:25:22 +02:00
Mårten Nordheim
69982182a3 QNetworkRequest: Add API to set a minimum archive bomb size
Fixes: QTBUG-91870
Change-Id: Ia23e8b8bcfdf65a91fe57e739242a355c681c9e6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-05-31 17:25:20 +02:00
Laszlo Agocs
51c22a1f51 rhi: Add support for 3D textures
Supported on OpenGL (and ES) 3.0+ and everywhere else.

Can also be a render target, targeting a single slice at a time.

Can be mipmapped, cannot be multisample.

Reading back a given slice from a 3D texture is left as a future
exercise, for now it is documented to be not supported.

Upload is going to be limited to one slice in one upload entry,
just like we specify one face or one miplevel for cubemap and
mipmapped textures.

This also involves some welcome hardening of how texture subresources
are described internally: as we no longer can count on a layer index
between 0..5 (as is the case with cubemaps), simply arrays with
MAX_LAYER==6 are no longer sufficient. Switch to sufficiently dynamic
data structures where applicable.

On Vulkan rendering to a slice needs Vulkan 1.1 (and 1.1 enabled on the
VkInstance).

Task-number: QTBUG-89703
Change-Id: Ide6c20124ec9201d94ffc339dd479cd1ece777b0
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-05-31 17:16:57 +02:00
Laszlo Agocs
5eab5d6253 rhi: vk: Switch to the modern validation layer internally
Task-number: QTBUG-88388
Change-Id: Ia30af6c4554594f094af7866ad6e10ed7929de27
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-05-31 17:16:53 +02:00
Laszlo Agocs
bbc6b5c3a7 vulkan: Update legacy tests and examples to the modern validation layer
Fixes: QTBUG-88388
Change-Id: Ib072f203ada5d692dea8d35da2b24db0deac0297
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-05-31 17:16:49 +02:00
Tang Haixiang
c77840d734 Fix PageDown behavior and PageUP
When the PageDown is pressed, the current's rect cannot be
used to match the item, because we don't know the size of
the rect. Move the rect by the height of the viewport, and
then move the rect upwards until it matches the
button <= viewport's bottom of the item

Fixes: QTBUG-92583
Pick-to: 6.1
Change-Id: I210edc0e8b942984f3fc20e7752c6e1315152ea1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-05-31 03:27:12 +00:00
Volker Hilsheimer
d36ef40d18 QComboBox: propagate style change on widget to internal container
When changing the style of the combobox, the change will not propagate
to the internal container widget, so the changeEvent handler won't be
called. This is correct (as per QWidget::setStyle documentation).
QComboBoxPrivateContainer asks the combobox style for relevant settings,
such as the frame style, which is then used for sizing and positioning.
If the combobox's and container's settings become inconsistent, then the
combobox popup will not get the correct size and/or position.

Move some of the style-dependent changes into a separate function and
call it when the QComboBox::changeEvent handles the style change so that
both widgets have a consistent set of settings.

Add a test case that verifies that the style is asked for the relevant
setting when the style changes.

Note: QComboBox does a lot of style-dependent setup work in different
places, which is quite messy and complex. Trying to consolidate that
further breaks tests though, so this change is doing the minimum
necessary to fix the reported issue.

Pick-to: 6.1 5.15
Fixes: QTBUG-92488
Change-Id: Ia957d504b2d800add26fc0565be727b5c08a5358
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-05-31 01:06:00 +02:00
Assam Boudjelthia
cbaff13701 Block flaky rhi and OpenGL tests on Android
Task-number: QTBUG-87429
Change-Id: I5a09a82b5fd27d9a36563e5270703a32c067d4b6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-05-30 23:02:53 +02:00
Alexey Edelev
19e789bace Implement propagation of object files to the end-point executable
This proposal collects all the resource objects to the qt-specific
property of the static libraries. This is done to avoid littering
of other static libraries and put resource object files to the
source part of the linker line when linking the end-point
executable.
The way we link object resource libraries is changed back to the
target_link_libraries approach as we may omit using finalizers
with linkers other than ld. Users may enforce finalizers by calling
the qt6_enable_resource_objects_finalizer_mode function if need.

Refactor tests related to the static resources.

Amends ddaa7150d8

Task-number: QTBUG-93002
Change-Id: I74135e291cd82fb54d1b284b4b4a1e002b1fef98
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-27 14:28:17 +02:00
Alexandru Croitor
a3c430f390 CMake: Revise plugin finalizer mode usage
Only use plugin finalizer mode if qt_finalize_target is called at the
end of the user project (which we can't really check, the user has to
ensure that) or when qt_finalize_target is automatically defer-called
by CMake 3.19+ (which is done by qt_add_executable).

This removes the previous behavior of using the finalizer mode if
qt_import_plugins is called. Instead the old regular mode is used
if the above preconditions are not met.

The removed behavior had ordering issues if qt_import_plugins was called
before target_link_libraries. The dependency walking would be done
before Qt dependencies were added and thus no plugins would be
linked.

Amends 6fcc272ac9

Task-number: QTBUG-80863
Task-number: QTBUG-92933
Task-number: QTBUG-94030
Change-Id: I78702b653a35596f5581c2f4282b2336f0124e60
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-05-27 14:28:17 +02:00
Timur Pocheptsov
810e755c18 Fix auto-tests that are fooled by the presence of more than one plugin
It's possible that Qt is built with OpenSSL and some other backend.
The ifdefs generated are not mutually exclusive anymore, as it was
in the past. So tests should rely on the actual backend they have
working at runtime.

In the process of fixing the auto-tests, modernized feature #if-ery and
some associated compilation issues.

Fixes: QTBUG-92875
Change-Id: I2be1b924d506fd36dc4e2c6c9158b5023ff87f32
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-05-27 06:41:26 +02:00
Assam Boudjelthia
478ed8b71f Android: Add runOnMainAndroidThread() under QNativeInterface
This replaces QtAndroidPrivate::runOnAndroidThread{Sync} calls.
This also now allows passing std::function<> that can return values,
and not only an std::function<void()>.

This adds some tests for this calls as well.

Fixes: QTBUG-90501
Change-Id: I138d2aae64be17347f7ff712d8a86edb49ea8350
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-05-26 23:24:11 +00:00
Allan Sandfeld Jensen
da30e402f3 Add SIMD optimizations for color-transform writes
Add NEON for RGB32 and RGBA64 writeback, and SSE2 for
RGBA64 writeback.

Change-Id: Id9ee803267a78f5bdff5beaa719e7a59c1dbb9fb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-05-27 00:18:04 +02:00
Tor Arne Vestbø
7f4ec4ed88 Blacklist tst_QTcpServer::linkLocal on macOS ARM
Amends d790e9fda9.

Change-Id: If17a9e2f3f9858c0850006f48242248c4b812e27
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-26 21:24:40 +02:00
Allan Sandfeld Jensen
93cd9130d6 Introduce float QImage formats and rendering
Useful for some HDR representations and HDR rendering.

Change-Id: If6e8a661faa3d2afdf17b6ed4d8ff5c5b2aeb30e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-05-26 18:00:01 +02:00
Edward Welbourne
451500f8f8 Check for overflow in QDateTime::setMSecsSinceEpoch()
When adding an offset from UTC, arithmetic may overflow.  Likewise
when combining a date and time (that have been offset for UTC).  Also
check the return from epochMSecsToLocalTime(), as it can fail; and pay
attention to the status stored by setDateTime(), to notice when it
hits an overflow. Fixed some tests that only passed because we
neglected these checks. Extended a test to check we detect overflow in
a couple of cases close to the extremes.

Change-Id: I127a670302f94a07bb9b087b1b9c608b7c08785c
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-26 18:00:01 +02:00
Edward Welbourne
35412acd88 Use time-zone transition data before 1970 as well as after
QDateTime has long followed a convention of ignoring what it knows
about time-zone transitions before the epoch. This produces unhelpful
artefacts (such as an ahistorical spring-forward skipping the first
hour of 1970 in Europe/London, which was in permanent DST at the time)
and complicates the code. It documented that DST transitions were
ignored, but in fact ignored all transitions prior to 1970 and simply
assumed that the current time-zone properties (half a century later)
applied to all times before 1970.

This appears to be based on the fact that the MS APIs using time_t all
limit their range to after 1970. Given that we have to resort to
"other means" to deal with times after the end of time_t, when it's
only 32-bit (and after year 3000, on MS systems), we have the means in
place to handle times outside the range supported by the system APIs,
so have no need to mimic this restriction. (Those means are not as
robust as we might want, but they are less bad than assuming that the
present zone properites were always in effect prior to 1970.) On
macOS, the time_t functions only reach back to the start of 1900; it
reaches to the end of its time_t range and Linux covers the whole
range. Given this variety, the range is now auto-detected the first
time it is needed (based on some quick and dirty heuristics).

Various CET-specific tests now need adjustments in tests of times
before the introduction of time-zones (when they are in fact on LMT,
not CET). The systemZone() test of QTimeZone can now restore its
pre-zone test cases. Various comments on tests needed updates.

[ChangeLog][QtCore][QDateTime] Available time-zone information is now
used to its full extent, where previously QDateTime used LocalTime's
current standard time for all dates before 1970. Where we have
time-zone information, it is considered reliable, so we use it.  This
changes the "best efforts" used for times outside the range supported
by the system APIs, in most cases giving less misleading results.

Fixes: QTBUG-80421
Change-Id: I7b1df7622dd9be244b0238ed9c08845fb5b32215
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-26 18:00:01 +02:00
Friedemann Kleint
ae02188233 QTestlib: Add formatting for QObject * in QCOMPARE
Output object name and class in QCOMPARE(). This should help
to debug flaky QWidget tests that for example check on focusWidget().

[ChangeLog][QtTestLib] QCOMPARE() now reports QObject * values by class and objectName().

Task-number: QTBUG-64446
Change-Id: Ife04e89bba04fc78d077c8f0f07af17a17c9cf8c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-05-26 11:02:48 +00:00
Tor Arne Vestbø
d790e9fda9 Blacklist problematic network auto-tests on macOS ARM
QNetworkInterface reports as up and running an interface,
seemingly having a valid IP address which actually has
not IPv4/IPv6 configured at all (this is what getifaddrs
gives us).

Change-Id: I5808d5dfdbc54004a1e02b791917e9b2ba62905f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-05-26 12:49:56 +02:00
Tor Arne Vestbø
d4cff8c537 Fix wrong variable initialization in tst_QScrollBar::task_209492
Change-Id: Icf1f6da46caa7fb7f3bd308eaaf4e037af814d17
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-26 03:14:52 +02:00
Thiago Macieira
64bfc927b0 QHash: fix qHash(std::pair)
There were two problems here: first, qHash(std::pair) must be declared
before qHashMulti that might call back to qHash(std::pair) (i.e., a pair
with one element that is also a pair). But moving the declaration above
causes the second problem: the noexcept expression can't refer to qHash
functions that aren't declared yet. So we forward-declare a constexpr
function for that result, but implement it far below.

Fixes: QTBUG-92910
Change-Id: Ia8e48103a54446509e3bfffd16767ed2e29b026c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-23 12:08:43 -07:00
Thiago Macieira
7ac0621ad1 Introduce QHashSeed and switch to size_t seeds
Commit 37e0953613 added a to-do, but we
can actually change the type, since we've documented since Qt 5.10 that
setting a non-zero value (aside from -1) with qSetGlobalQHashSeed was
not allowed. Storing a value to be reset later is simply not supported.

Change-Id: Id2983978ad544ff79911fffd1671f7b5de284bab
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-05-23 12:08:42 -07:00
Joerg Bornemann
895edcd7cd Support multiple equally named .qrc files in qt_add_big_resources
It is now possible to call qt_add_big_resources with multiple .qrc files
that are in different directories but have the same file name.
Before, this resulted in target name conflict errors.

Pick-to: 6.1
Fixes: QTBUG-93230
Change-Id: Ic3d9d6974a107163aeb7ada0b6f1fa113fb18de0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-22 22:32:27 +02:00
Mårten Nordheim
4da22d6534 tst_QDecompressHelper: Move pointer size check inside the test
For some reason the test case was (no longer?) detected by moc

Change-Id: I20f20de76479f7d9db43fae985cefe0869a7e203
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-05-21 21:13:47 +02:00
Allan Sandfeld Jensen
f1983dcdf6 Correct RGB to Grayscale conversion
The existing conversions weren't handling gamma correctly and used
an ad-hoc definition of gray instead of based on true luminance.

[ChangeLog][QtGui] RGB conversions to grayscale formats are now
gamma-corrected and produce color-space luminance values

Change-Id: I88ab870c8f5e502ddb053e6a14a75102239a26f2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-05-21 15:37:32 +02:00
Giuseppe D'Angelo
bf22f91441 QFuture/QPromise: don't check for is_copy_constructible
The check is over-arching. is_move_constructible is sufficient;
we don't have to support "ridiculous" types that are copiable but
have deleted move operations (such types are fundamentally broken).
This is in line with the Move* (legacy) named requirements.

Change-Id: Idc7116b39013501b9be39628a4e7afd35fe15530
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-05-21 11:08:11 +02:00
Mårten Nordheim
5a701f5a7e Add function to QAuthenticatorPrivate to check method support
To see if a certain method is supported. To be used in an upcoming patch.

Change-Id: I1a5c2f655585331820701bb54f6991b4aba38273
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-05-20 20:31:05 +02:00
Joerg Bornemann
9e8f43e5ac Fix qt6_add_big_resources
The qt6_add_big_resources command was dysfunctional whenever AUTOMOC was
enabled for a target.

We passed multiple object files with the --temp argument of the second
pass of rcc. We must pass exactly one. The spurious object file was the
one that's created by AUTOMOC. Turn off all of AUTOGEN for the C++
source file that's generated in the first pass of rcc.

Enable AUTOMOC for tests/auto/cmake/test_add_big_resource to cover this
situation.

Pick-to: 6.1
Fixes: QTBUG-85051
Change-Id: I6d2ce4953297db0751913456db0a4a126fe33f14
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-20 19:40:46 +02:00
Alexandru Croitor
c4df673dd9 CMake: Replace qt_finalize_executable with qt_finalize_target
It's very likely that we'll have to run certain finalizer code for
targets other than executables.

Rename qt_finalize_executable to _qt_internal_finalize_executable so
it's internal.

Introduce a new function qt_finalize_target which will call the above
internal one when the target is an executable.

This should future proof the API so we have a hook to call code for
any user CMake project that intends to use Qt CMake API.

Change-Id: I03f6f4dcba22461351c247a20241ca7de1a59c1d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-05-20 19:40:45 +02:00
Dongmei Wang
e253a30238 QFileSystemModel fails to locate a host from root's visible children
In QFileSystemModel, in some cases the hostname in a UNC path is
converted to lower case and stored in the root node's visibleChildren.
When QFileSystemModel sets the UNC path as the root path, it tries to
get the row number for the host, but it didn't convert the hostname to
lower case before getting the row number, which resulted in the host
not found in the root node's visible children. As a result, it returns
-1, an invalid row number. Change the behavior to find the node for the
host using the host name case-insensitive and then get the row number.

Fixes: QTBUG-71701
Pick-to: 5.15 6.0 6.1
Change-Id: Ib95c7b6d2bc22fd82f2789b7004b6fc82dfcb13b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-05-20 15:02:38 +00:00
Mårten Nordheim
a5dc381b4c QByteArrayView: add compare
There was previously no way to compare QByteArrayView to with another
QByteArrayView case-insensitively without allocating memory.

[ChangeLog][QtCore][QByteArrayView] Added compare(), enabling case
sensitive and insensitive comparison with other QByteArrayViews.

Change-Id: I7582cc414563ddbde26da35a568421edcc649f93
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-20 17:02:38 +02:00
Alexandru Croitor
6fcc272ac9 CMake: Introduce finalizer mode handling of static plugins
Allow linking all plugin initializer object libraries directly
into the final target (executable or shared library).

The finalizer mode is triggered when the project adds a call
to qt_import_plugins, as well when the project has an explicit
call to qt_finalize_executable or when it is defer called by
CMake 3.19+.

Otherwise the old non-finalizer mode is used, where each plugin
initializer object library is propagated via the usage
requirements of its associated module.

A user can explicitly opt in or out of the new mode by calling
qt_enable_import_plugins_finalizer_mode(target TRUE/FALSE)

The implementation, at configure time, recursively collects all
dependencies of the target to extract a list of used Qt modules.

From each module we extract its list of associated plugins and
their genex conditions. These genexes are used to conditionally
link the plugins and the initializers.

Renamed QT_PLUGINS property to _qt_plugins, so we can safely query the
property even on INTERFACE libraries with lower CMake versions.
QT_PLUGINS is kept for backwards compatibility with projects already
using it, but should be removed in Qt 7.

The upside of the finalizer mode is that it avoids creating link
cycles (e.g. Gui -> SvgPlugin -> Gui case) which causes CMake to
duplicate the library on the link line, slowing down link time as well
as possibly breaking link order dependencies.

The downside is that finalizer mode can't cope with generator
expressions at the moment. So if a Qt module target is wrapped in a
generator expression, it's plugins will not be detected and thus
linked.

Task-number: QTBUG-80863
Task-number: QTBUG-92933
Change-Id: Ic40c8ae5807a154ed18fcac18b25f00864c8f143
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-05-20 00:55:46 +02:00
Karsten Heimrich
06689a2d7a Fix QUrl::fromLocalFile with long path prefix
After commit 3966b571 the function was kinda broken already, though
this got unnoticed since it was not covered by an the auto-test.
This commit adds another test case with Windows native separators
and removes the use of QDir::fromNativeSeparators. Instead use the
original code from QDir::fromNativeSeparators to replace the backslashes.

Pick-to: 5.15 6.0 6.1
Change-Id: I190560d0e75cb8c177d63b142aa4be5b01498da2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-05-19 21:38:38 +02:00
Laszlo Agocs
8827cd657d rhi: gl: Add support for importing an existing renderbuffer object
Normally we only allow creating wrappers for texture objects. These
can then be used with a QRhiTextureRenderTarget to allow rendering into
an externally created texture.

With OpenGL (ES), there are additional, special cases, especially on
embedded. Consider EGLImages for example. An EGLImageKHR can be bound to
a renderbuffer object (glEGLImageTargetRenderbufferStorageOES), which
can then be associated with a framebuffer object to allow rendering into
the external buffer represented by the EGLImage. To implement the same
via QRhi one needs a way to create a wrapping QRhiRenderBuffer for the
native OpenGL renderbuffer object.

Here we add a createFrom() to QRhiRenderBuffer, while providing a dummy,
default implementation. The only real implementation is in the OpenGL
backend, which simply takes a renderbuffer id, without taking ownership.

Task-number: QTBUG-92116
Change-Id: I4e68e665fb35a7d7803b7780db901c8bed5740e2
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-05-19 17:35:35 +02:00
Thiago Macieira
80cf3053f4 tst_QFile: confirm behavior is the same on pipes and socketpairs
Whether we're using stdio or not.

Task-number: QTBUG-92905
Change-Id: Ia8e48103a54446509e3bfffd167682828c6bd190
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-05-18 21:15:49 -07:00
Tor Arne Vestbø
d0b0db0d6d tst_QSharedPointer: Fix Clang warnings about self assignment
Change-Id: I32feb86eee5f15e6ec0f0e6fb6811648b172fe7e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-05-19 02:48:47 +02:00
Joerg Bornemann
92185d417d Fix BASE argument of qt_add_resources
The BASE argument of qt_add_resources now denotes the root point of the
alias of the file.  Before, BASE was merely prepended to every file that
got passed to qt_add_resources.

Old behavior:
    qt_add_resources(app "images"
        PREFIX "/"
        BASE "../shared"
        FILES "images/button.png")

Alias is "../shared/images/button.png", and pro2cmake generated
QT_RESOURCE_ALIAS assignments to fix this.

New behavior:
    qt_add_resources(app "images"
        PREFIX "/"
        BASE "../shared"
        FILES "../shared/images/button.png")

The alias is "images/button.png".  No extra QT_RESOURCE_ALIAS assignment
is needed.

The new behavior is in effect for user projects and for Qt repositories
that define QT_USE_FIXED_QT_ADD_RESOURCE_BASE.  Qt repositories will be
ported one by one to this new behavior.  Then the old code path can be
removed.

Pick-to: 6.1
Task-number: QTBUG-86726
Change-Id: Ib895edd4df8e97b54badadd9a1c34408beff131f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-18 16:02:52 +02:00
Allan Sandfeld Jensen
86bf3a4ddb Blacklist tst_QWidget::multipleToplevelFocusCheck() on SLES 15
Pick-to: 6.1 5.15
Task-number: QTBUG-64446
Change-Id: Ic1f7a1e7b89a9802e4d3103a6755d7df85b1fd81
Reviewed-by: Tarja Sundqvist <tarja.sundqvist@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-05-18 11:56:06 +02:00
Andreas Buhr
8278879c19 Fix QItemSelectionModel::selectionChanged emission
QItemSelectionModel has the property selectedIndexes with
the notification signal selectionChanged. When a row is deleted
or inserted above the current selection, the row number of the
current selection changes and thus the return value of
selectedIndexes changes. This should trigger its notification
signal.
This signal was not emitted. This patch fixes this and
adds a unit test to verify this.

[ChangeLog][Important Behavior Changes][QtCore]
QItemSelectionModel now emits the selectionChanged signal
if only the indexes of the selected items change.

Fixes: QTBUG-93305
Change-Id: Ia5fb5ca32d658c9c0e1d7093c57cc08a966b9402
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2021-05-18 08:49:56 +02:00
Giuseppe D'Angelo
9a94c4a415 Long live qToUnderlying
"Cherry-pick" of C++2b's std::to_underlying.

[ChangeLog][QtCore][QtGlobal] The qToUnderlying function has been
added, to convert an value of enumeration type to its underlying
value.

Change-Id: Ia46bd8e4496e55174171ac2f0799eacbcca02cf9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-18 02:09:11 +02:00
Giuseppe D'Angelo
8b8ff64be2 PRIx macros: add some actual testing
Not just a compile-time one (that the macros compile and don't
raise warnings).

Change-Id: I5642bf242a6c26a33730708f3c1710237fc107a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-18 02:09:06 +02:00
Giuseppe D'Angelo
5ea50054a1 QArrayData: store the right flag type, not an int
There's no reason to be storing `int` in the array data header and
then using it as a QFlags. Just store the QFlags.

Change-Id: I78f489550d74d15a560dacf338110d80a7ddfdd2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-17 00:11:12 +02:00
Giuseppe D'Angelo
c4947c1c4c QFlags: add test(Any)Flag(s)
QFlags was lacking a named function for testing whether a QFlags object
contains _any_ of the bits set by a given enumerator/other QFlags.

Drive-by, add testFlags taking a QFlags, not just an object of the
enumeration; and simplify the implementation of testFlags to more
closely follow what its documentation says it does.

[ChangeLog][QtCore][QFlags] The testFlags, testAnyFlag and
testAnyFlags functions have been added.

Change-Id: Ie8688c8b0dd393d34d32bc7786cdcee3eba24d1c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-15 17:34:01 +02:00
Assam Boudjelthia
23780891a5 Add tests for QAndroidApplication's sdkVersion and activity
While at it, move tst_android under corelib/platform/android.

Change-Id: Icf91cd75cb5e04d03fe6a81d52fba52a485ca41f
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-05-13 01:41:36 +03:00
Fabian Kosmale
5b681bea90 QPropertyBinding: Do not reevaluate if not installed on property
Since we changed binding evaluation to be always eager, we notify and
evaluate all bindings as soon as any dependency changes. This includes
bindings which have been initially installed on a property, but which
were later removed.
With lazy evaluation, we would only notify those bindings and mark them
as dirty, which is unproblematic. With eager evalution, we attempt to
evaluate the binding, though. While that part is still fine, afterwards
we would attempt to write the new value into the property. However,
there is no property at that point, as the binding is not installed.
Instead of adding a check whether the propertydataptr is null, we skip
the reevaluation completely by removing the bindings observers - and
thus the cause for the binding function's reevaluation. As soon as the
binding is set, we reevaluate the function anyway, at which point we
also capture the observers again.

Task-number: QTBUG-89505
Change-Id: Ie1885ccd8be519fb96f6fde658275810b54f445a
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-05-12 14:49:46 +02:00
Allan Sandfeld Jensen
e381977b21 Blacklist tst_qnetworkreply::ioHttpRedirectMultipartPost on Linux
Already blacklisted on the other linux versions, but is failing on
SLES now in 5.15

Pick-to: 6.1 5.15
Change-Id: I267908adf94ede51e5520aa2cb806b394fb0438e
Reviewed-by: Tarja Sundqvist <tarja.sundqvist@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-05-12 14:49:45 +02:00
Fabian Kosmale
524c187af3 QProperty: Cleanup QPropertyAlias leftovers
This removes traces of QPropertyAlias which is internal API which is
a) not really working even before this change (no compatibility with
   QBindableInterface due to QPropertyAlias not being derived from
   QUntypedPropertyData)
b) not used anywhere

For BIC reasons, we need to keep some methods still around until Qt 7,
though.

Change-Id: I5bb4735a4c88cba275dc2cc6e29a46ca09622059
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-05-11 22:22:08 +02:00
Ivan Solovev
bdaaf99228 QSFPM: make filterRegularExpression and filterCaseSensitivity bindable
This takes care of the last two QSFPM properties. They were postponed
because of the tricky relation between them and some bugs in handling
the changes.
The bug was fixed in bcbbbdb2d6 and
now the behavior is well-determined: updating filter regexp does
trigger case sensitivity change and vice versa. However updating
only regexp pattern (via QString overload or setFilterFixedString
or setFilterWildcard) does not change case sensitivity.

Task-number: QTBUG-85520
Change-Id: Idc41cf817de9e6263ed65a80fa40fc8415c8c856
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-05-11 21:05:09 +02:00
Ivan Solovev
9134113c4f QSortFilterProxyModel: port to new property system
filterRegularExpression and filterCaseSensitivity
will be handled in a separate commit

Task-number: QTBUG-85520
Change-Id: I848c5c6cbe8642efa156f4f5d33467976bbf0351
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-05-11 21:05:09 +02:00
Luca Beldi
811a6c6b77 Fix QStandardItemModel signals on takeChild
takeItem and takeChild do not signal the change correctly to the
external world, this change fixes the problem

Fixes: QTBUG-89145
Pick-to: 6.1 5.15
Change-Id: Ib4844ace53007068a2cd62eba64df99e6e45fdc0
Reviewed-by: David Faure <david.faure@kdab.com>
2021-05-11 18:55:09 +01:00
Piotr Srebrny
867c0b8d8a Do not remove non-widget items when removeWidget() called with nullptr
child->widget() returns null if the layout item is not a widget.
Thus, calling removeWidget(nullptr) will remove all non-widget items
such as layouts or strechers.

Change-Id: I772c1158d0f7e8e2850b6e571b0405a2896f09b8
Pick-to: 6.0 6.1 5.15
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2021-05-11 16:57:17 +00:00
Alexandru Croitor
3a62f9e0c9 CMake: Resurrect test_import_plugins cmake build tests
Now that we run tests for static Qt builds in the CI, it makes sense
to restore the CMake build tests that check that static plugin
importing works correctly.

Resurrect the previously commented out test_import_plugins project and
port the mockplugins qmake projects to CMake.

mockplugins is a CMake project that uses the internal Qt CMake API to
build and install some Qt modules and plugins.

test_import_plugins depends on that test (via a CMake fixture) to
build public projects that use those plugins.

The installation of the mockplugins modules pollutes the Qt install
prefix, but in the CI that only happens on the test VM, which means
the release packages are not affected.

Locally on a developer machine the Qt install path will be polluted,
but it's not that much of a big deal. We could try and address that in
a future change by using the QT_ADDITIONAL_PACKAGES_PREFIX_PATH
functionality added for Conan to allow the installation of Qt packages
into a non-standard prefix.

Task-number: QTBUG-87580
Task-number: QTBUG-92933
Change-Id: I0841064a60a5ffba5118640d3197527a38ba6c30
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-05-11 14:35:30 +02:00
Alexandru Croitor
22a992cb12 CMake: Skip building CMake build tests in a prefix in-tree config
The Qt CMake packages are not installed yet, so the CMake build
projects can't find Qt and fail to configure.

Skip the CMake build tests in a prefix in-tree configuration and issue
a warning for informational purposes.

Change-Id: Ie5cb5b9f6f1d8ec258b70528680e31c711c20f85
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-05-11 14:35:30 +02:00
Chen Bin
aeef92c3c3 Check scrollbar visibility when computing QListView margins
When the listview setWordWrap is true and ScrollBarPolicy is
ScrollBarAsNeeded, if the text needs a newline display and the
vbar is not shown, the width of the item was subtracted from
the width of the scrollbar.

In most cases, the listview needs to reserve the size of the scrollbar.
But if the flow is TopToBottom and the vertical scrollbar is not
visible, the width of the vertical scrollbar cannot be reserved.

Fixes: QTBUG-92366
Pick-to: 5.15 6.0 6.1
Change-Id: I73cce691099a253d409019dbb3fe9a16e1830bb1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-05-11 20:35:30 +08:00
Karsten Heimrich
ec9e856563 Fix QSaveFile and QTemporaryFile issues with windows network shares
The commit amends commit 3966b571 to take UNC prefix into account as
well. Fixes the weird file name output as reported in QTBUG-74291 and
QTBUG-83365. Replace manual separator normalizing in qt_cleanPath(),
this is another spot where UNC prefix handling needs to be applied.

Also make QTemporaryFile operate on '/' as file separators to fix
creating both file types with native path separators on network shares.

Fixes: QTBUG-74291
Fixes: QTBUG-76228
Fixes: QTBUG-83365
Pick-to: 5.15 6.0 6.1
Change-Id: Iff8d26b994bf4194c074cd5c996cda3934297fa5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-11 13:22:44 +02:00
Tor Arne Vestbø
edceff30b4 Move QtX11Extras into QtGui as private API
from qt/qtx11extras 0e67fb41cfc4b4bfbaa7dc75f8ddebdf5a08e836.

The plan is to expose these as native interfaces, so this is a first
step.

Task-number: QTBUG-83251
Change-Id: Iecba8db9a4f616a08a3750ddaae08cc30ec66f89
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-05-10 21:19:46 +00:00
Allan Sandfeld Jensen
f94b0e1dd9 Allow background inheritance between non-body block elements
Most nested block elements are merged together, so while we shouldn't
do real inheritance we need to do it when block elements are combined.

Pick-to: 6.1
Fixes: QTBUG-91236
Change-Id: I9e37b15f705db92c79a620d0d772f25d0ee72b8d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-05-08 09:28:02 +02:00
Fabian Kosmale
300dec66ce QMetaMethod: Store method constness in metaobject system
[ChangeLog][QtCore][QMetaMethod] It is now possible to query the
constness of a method with QMetaMethod::isConst.

Change-Id: I8a94480b8074ef5b30555aeccd64937c4c6d97d4
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-05-07 21:50:58 +02:00
Samuli Piippo
57ede9217e tst_qlibrary: don't use absolute paths for symlinks
The libs and symlinks are in the same directory, no need
to have absolute paths.

Change-Id: I22dab933b1f3bdf244b0953c6bb7caaeedef5697
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-07 11:11:51 +03:00
Volker Hilsheimer
e3b2b12a91 QTabBar: take a style sheet's font into account when laying out tabs
If a tab has a font assigned to it through a style sheet, then take the
font size into account when calculating the contents rectangle.

Add a test, which hardcodes the windows style to avoid flaky behavior
when e.g. macOS lays tabs out in the center.

Fixes: QTBUG-92988
Pick-to: 6.1
Change-Id: Ifb0ac97db7647cc25367972737be8878e50f6040
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-05-06 20:06:44 +02:00
Friedemann Kleint
8886462872 QMdiArea: Fix top level window title when using DontMaximizeSubWindowOnActivation
When trying to find the original window title, check for another
maximized sub window and use its title. Protect the calls to
setWindowTitle to prevent the original title from being cleared.

Pick-to: 6.1 5.15
Fixes: QTBUG-92240
Change-Id: I55175382ab261b4cf8b5528304adaaec4fbe2c31
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-05-06 13:08:14 +02:00
Fabian Kosmale
f8c1d339ec tst_moc: Use qtpaths instead of qmake
We only need to the location of certain paths for the test. For that,
qtpaths is sufficient.

Change-Id: I5af0d56b548629edc48949150ed8fbd408b617a6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-05 23:43:45 +02:00
Allan Sandfeld Jensen
50b9a4b357 Remove Qt6 switches from QtGui
Removing now dead code

Change-Id: I021539da6517fdb8443f8ae9431fc172b7910cfc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-05-05 19:26:56 +02:00
Andy Shaw
72a5151403 Write out the HTML correctly for nested lists
When we are having nested lists then we need to ensure that the HTML is
outputted correctly so that the closing list and item tags are placed
in the right order.

[ChangeLog][QtGui][QTextDocument] The output of toHtml() now handles
nested lists correctly.

Fixes: QTBUG-88374
Pick-to: 6.1 5.15
Change-Id: I88afba0f897aeef78d4835a3124097fe6fd4d55e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-05-05 15:14:12 +00:00
Oliver Eftevaag
38f4e1f3e7 Unit test for checking text-decoration in html export
This unit test is related to the parent commit.
Html export used to omit the text-decoration for the default font,
this unit test ensures that this property is added to the exported
html.

Fixes: QTBUG-91171
Change-Id: Ib68bec27f9963cdcac5c553b2c07557717b1c22e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-05-05 16:28:54 +02:00
Allan Sandfeld Jensen
720defd2ca Export text-decoration
It used to be ignored because we couldn't disable it, but that works
fine now. So re-enable it.

Fixes: QTBUG-91171
Change-Id: I4cf966211bb200b73326e90fc7e4c4d3d4090511
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-05-05 16:28:54 +02:00
Edward Welbourne
358df462a0 Fix assertion on matchingLocales(Abhkazian, Any, Any)
CLDR v39 has no locales for Abkhazian, so the locale_index[] entry for
it actually indexes the last entry before the next language up the
enum. This has m_language_id less than Abkhazian.

Change-Id: If8b88f30476a981b3ee00ff8760a46ede0b7aab7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-05-05 16:28:53 +02:00
Assam Boudjelthia
45daea19c3 Fix set*Field JNI template calls
The calls were trying to pass a JNIEnv* from a QJniEnvironment using
conversion operator which was removed, and weren't detected since they
are templates and were missing tests. This fix that and add test cases
for setField() and setStaticField() calls.

Pick-to: 6.1
Change-Id: I6e1e6b7f557bbc664248ad364c48d63f58b70756
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-05-05 16:28:27 +03:00
Assam Boudjelthia
afd7460aff Add new app permissions API under QCoreApplication
The API allows users to request and check the status of various
permissions. A predefined enum class of the common permission types
on different platforms is used to allow requesting permission with
a common code. Platform specific permissions are defined only on their
relevant platform. For permissions that are not predefined, they can
be requested via a string variant of this API.

This adds the Android implementation only.

[ChangeLog][QtCore] Add new API for handling app permissions with an
initial implementation for Android.

Task-number: QTBUG-90498
Change-Id: I3bc98c6ab2dceeea3ee8edec20a332ed8f56ad4f
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-05-05 16:28:27 +03:00
Ivan Solovev
8161a9e5c0 QAbstractProxyModel: port to new property system
The biggest trick here is the getter (QAbstractProxyModel::sourceModel),
which is returning nullptr, while internally using a global
staticEmptyModel() instance.
This lead to inconsistency while binding to a proxy model without
source model. The bound object would point to staticEmptyModel()
instance, while sourceModel() getter returns nullptr.
To solve this issue a custom QBindableInterface is implemented.

Task-number: QTBUG-85520
Change-Id: I597df891c7e425d51b55f50ccbacabdfe935cbac
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-05-04 22:58:59 +02:00
Tor Arne Vestbø
0fb77f80b8 Blacklist and skip failing tests on macOS ARM
Task-number: QTQAINFRA-4431
Change-Id: I4ae47bb461634d524995077501b54322f6beccf3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-04 22:58:59 +02:00
Mårten Nordheim
48931167fb tst_moc: fix returning-reference-to-local warning
Although the code is never executed compilers still throw a warning
because it's compiled.

Amends 12b8283f89

Pick-to: 5.15 6.1
Change-Id: Ib790d4bcb33c4b9f2a55a784b852275b59debde9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-05-04 16:21:50 +02:00
Morten Johan Sørvig
07516c0811 Test at some Android DPIs in addition
Currently, we test at 1x, 2x, and mixed typical desktop
DPI values. Add android DPI values, with scale factors
in the 2.5 - 3.75 range.

This test currently uses 96 as the base DPI (and so
does the Android platform plugin), so we normalize
the values to use that base DPI.

Change-Id: I25b66f5e16d37c01758d5623b805e4141247a74a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-05-04 16:21:48 +02:00
Morten Johan Sørvig
5882131592 Remove setting of Qt 5 high-dpi attributes
This test is for Qt 6 now.

Change-Id: I839c2733d505cb4119b1fe3ad85d3c8d94a6c964
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-05-04 16:21:48 +02:00
Edward Welbourne
517745fc9d Ensure setDateTime clears status also when short
Previously, if multiplication overflowed when trying to set the date
and time of a formerly short-form QDateTime, its status didn't get set
to reflect the failed validity check. Added a test that now correctly
detects that it's produced an invalid date-time on overflow, where
previously it produced a wrong valid date-time.

Change-Id: Id46ca34d1e32e9b9b0630f3723cefd1c13b5761e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-04 15:21:48 +01:00
Mårten Nordheim
12b8283f89 Moc: parse trailing return type
Pick-to: 5.15 6.1
Fixes: QTBUG-71123
Change-Id: I1c3749f0892fddcc433c9afcb1d6d7c30c97c9d9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-05-04 01:39:48 +02:00
Thiago Macieira
f95d6bb09d tst_QProcess: increase wait time and remove ill-advised QCOMPARE
The QCOMPARE made dead code of a more verbose QVERIFY2 below

Change-Id: I26b8286f61534f88b649fffd166b67d8603280a7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-05-03 20:43:01 +00:00
Fabian Kosmale
98b4f4bc4d Q(Untyped)Bindable: Print warnings when operations fail
Instead of silently failing, we now print an explanatory warning to aid
with debugging.

Task-number: QTBUG-89512
Change-Id: I36dd2ce452af12d0523c19286919095e366bd390
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-05-03 20:32:42 +02:00
Ivan Solovev
d225c6afe7 QJniObject: add callStatic[Object]Method overloads for jmethodID
This patch extends the QJniObject::callStatic[Object]Method functions
with the overload which accepts a jmethodID parameter. This can be
convenient when the method id is already cached and you do not want
to query the method by its name and signature.

Task-number: QTBUG-92952
Change-Id: Ib0852a5a27da2a244ac63112784751ef9e32cfa5
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-05-03 18:09:23 +02:00
Ivan Solovev
34f72ca52e QJniEnvironment: extend API
This patch adds some convenience methods to QJniEnvironment API:
* an overload of registerNativeMethods() that accepts jclass instead
  of const char *className.
* a findMethod() function is added to query a methodID of a static
  or nonstatic method by its name and signature.

Task-number: QTBUG-92952
Change-Id: Ib1bc892decea97e625c4822888b6183af6edd6dc
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-05-03 18:09:23 +02:00
Friedemann Kleint
21b3b54193 QSqlTableModel::orderByClause(): Quote the table name
This ensures correct handling of names with special characters.

Pick-to: 5.15 6.1
Fixes: QTBUG-92584
Change-Id: I95c7c54d9c7ee00b221a55f3d07ef1ec3a3bd217
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-05-03 14:10:36 +00:00
Morten Johan Sørvig
b5ceba0128 Extend QT_SCREEN_SCALE_FACTORS test
Test the name=factor format and various incorrect spec
strings. We expect that the screen DPI is used if the
scale factor specification is incorrect.

Change-Id: Ia990e70cf71e370dd2bb4b1047a101dfe9e59cb0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-05-03 13:33:43 +02:00
Sona Kurazyan
7a1fdcedfc Port QVariantAnimation to the new property system
Skipped startValue/endValue properties, since they are computed and
writable, which is not supported at the moment.

Skipped currentValue, since its setter might be called inside the
getter, which is not recommended.

Task-number: QTBUG-85520
Change-Id: I1f872b4fcc7227ed91b6915891bbc66019151826
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-04-30 18:59:50 +02:00
Ivan Solovev
0d76a5cd2c QSFPM: fix filterCaseSensitivityChanged signal emission logic
This patch amends bcbbbdb2d6.
It fixes the logic of filterCaseSensitivityChanged signal emission.
The call to QRegularExpression overload of setFilterRegularExpression
could change the filterCaseSensitivity, but the signal was never
emitted.

[ChangeLog][QtCore][QSortFilterProxyModel] A call to QRegularExpression
overload of setFilterRegularExpression now emits a
filterCaseSensitivityChanged signal, if required.

Pick-to: 6.0
Pick-to: 6.1
Change-Id: Id4ef04227c1f8ed98153fa5107ec3fbe4c0c77fb
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-30 14:57:28 +02:00
Mårten Nordheim
deda40b859 Let the h2 test server both send and receive DATA frames
And use this in the authenticationRequired test.

Pick-to: 6.1 6.0 5.15
Change-Id: I18e991eb67168214c2c4f829afaca5018568e989
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-04-30 14:43:24 +02:00
Friedemann Kleint
ac95326ad4 uic/Python: Add comments for mypy to ignore star imports
Amends 2f975b39a9.

Pick-to: 6.1 5.15
Fixes: PYSIDE-1404
Change-Id: I534d78bdf44eb02bf80831a3d6c1d080a4e08698
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2021-04-29 21:12:12 +02:00
Shawn Rutledge
2ecd0f4194 Revert "Add grabber context pointers"
This reverts commit 40330b8f0a.
It was a bad idea to use QFlatMap here, because it is a sorted map, but
we need to keep the passive grabbers in the same order as the grabs happened.
So need to go back to an earlier version of the patch that uses two parallel QLists.

Pick-to: 6.1
Change-Id: I9e6013c2565986fe1eb9fd754f8259766f83bee5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-29 16:49:57 +02:00
Edward Welbourne
9bad096c09 Use a more forgiving threshold for qFuzzyIsNull(qfloat16)
Analysis of problems with the new test for qFuzzyIsNull() revealed
that, where its version for double uses approximately 4500 * epsilon
and for float used 84 * epsilon as threshold, the qfloat16 version's
value was barely more than epsilon, with the result that the test had
to use a different value than the threshold to pass. (Converting the
threshold from float to qfloat16 and back made it bigger; in effect,
the threshold value was not <= itself.)

Furthermore, comparison with qFuzzyCompare() implied a value of
1/102.5 should be used, roughly 10 * epsilon, for consistency.  When
1/102.5 is rounded to three significant digits (the precision we use
in QTest::toString(), for example), to give 0.00976f as threshold, we
get a value that, after conversion to qfloat16 and back to float, does
give a result <= what we started with. So change qFuzzyIsNull() and
its test to use this as qfloat16's threshold value.

[ChangeLog][QtCore][QFloat16] The qfloat16 threshold value for
qFuzzyIsNull() has changed from 1e-3 to 9.76e-3, almost a factor of
ten increase, for consistency with qFuzzyCompare()'s tolerance. Values
between these would previously have had qFuzzyIsNull(f) false despite
qFuzzyCompre(f, 1+f) being true.

Change-Id: I35816dce78da34a3e2339c8bc42d5bd03714a3f6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-29 14:13:23 +02:00
Edward Welbourne
6dfec83051 Add tests for qFuzzyIsNull() to tst_QNumeric and tst_QFloat16
They were missing.
I also wanted to verify that it's true for sub-normal values.

At the same time, relocate qfloat16's implementation of qFuzzyIsNull()
to between those of qFuzzyCompare() and qIsNull(), since its apparent
absence initially confused me.

Change-Id: I9637c0070e754d16744c76fc9f846596257c6a63
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-29 14:13:23 +02:00
Edward Welbourne
16c9683718 Revert early return from QTimeZone on invalid ID
This reverts commit ec8808c302 but
retains its test, as the problem it fixed is now solved by having the
TZ backend validate the ID it's passed, so that it now only accepts
valid POSIX zone-descriptions and valid IANA IDs. The former were
being excluded by this check.

Amended a POSIX test to fail with the check in place; it passes now.

Change-Id: I0d5e8c6e0a315ac2509f3d23bebb52aede8f79d0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
2021-04-29 14:13:23 +02:00
Mårten Nordheim
52a0eb4791 HTTP/2 authentication required
With Qt 6 we made HTTP/2 default, which exposed missing handling of
401 Unauthorized (and 407 Proxy Authentication Required).

In HTTP/1.* we would handle this after the response had finished, while
handling the status code. For h2 this path isn't used since it is
heavily reliant on the structure we have for HTTP/1.* (one request per
channel). So we must handle the status code and header directly.

Having that part fixed exposed another issue - when resetting/rewinding
uploaded data we were not resetting the 'totallyUploadedData' counter in
the reply (this, in turn, exposed another small issue). Because of that
we did not actually send any data on the retry, only sending the
content-length followed by no data.

Finally, the small issue mentioned in the previous paragraph was how we
check if we have uploaded all our data. It was only checking if the
byte-device was atEnd(), which it was. But only because it had not yet
prepared any data for us.

Fixes: QTBUG-91284
Pick-to: 6.1 6.0 5.15
Change-Id: I798d105b02688b18a02897cc476f19f57a47f98f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-04-29 13:05:16 +02:00
Zhang Xiang
675a4b0cc7 Fix namespace error of std::source_location under C++20
With C++20 standard, src/corelib/kernel/qproperty.h of Qt Base cannot be
compiled at line 100:

QPropertyBindingSourceLocation(
	const std::experimental::source_location &cppLocation
	)

The reason is that source_location has been merged into namespace std
since C++20, and the header file has also been change from
<experimental/source_location> to <source_location>.

The problem can be avoided by define a constant.

Fixes: QTBUG-93270
Change-Id: I46b4daac6ea20f9623b43746880500d41396afb2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-29 09:12:47 +00:00
Volker Hilsheimer
627542c841 Fix compiler warning from int size mismatch
Cast consistently to quint8, which is the type we are streaming out
in the test.

Change-Id: I44d360ca6b75f14e7a2b80962ad249a6f6b1cb31
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-29 06:32:17 +02:00
Ville Voutilainen
0e4cc15da3 Fix comparison between nullptr and QWeakPointer
The comparison between nullptr and QWeakPointer was just bogus
and ill-formed. The INTEGRITY compiler catches that even if
nothing tries to use the comparison. It is an ill-formed, no
diagnostic required case of a function template never being
able to produce a valid specialization. And while we're at
it, this patch makes the result of comparing a nullptr to
a QWeakPointer or vice versa the same as asking .isNull() from
the weak pointer, because it seems mind-boggling if those
are not the same operation.

Task-number: QTBUG-93093
Change-Id: I0cc80e795c9af2be1b76de05157aa458ef260f2e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-28 23:33:06 +03:00
Morten Johan Sørvig
776734576c Call updateHighDpiScaling() on screenAdded()
QHighDpiScaling has two init/update functions:
 - initHighDpiScaling(): called once during QGuiApplication construction
 - updateHighDpiScaling(): called whenever (relevant) screen configuration changes

Currently the calls to updateHighDpiScaling() are made from
multiple places including platform code. Simplify by calling
it from two locations:
	- QWindowSystemInterface::handleScreenAdded()
	- QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange()

Replace comment about early calls to qt_defaultDpi with a
test which calls qt_defaultDpiX/Y with no screens attached.
(Looking at the qt_defaultDpiX() implementation, it is unlikely
that there will be a problem as long as updateHighDpiScaling()
is called before QGuiApplication::primaryScreen() starts returning
a non-null value.)

Change-Id: I447db42894617495843a5cb531a1322b000fed62
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-04-28 18:23:39 +02:00
Andreas Buhr
dd24b61d35 Port QDBusServiceWatcher::watchedServices to bindable properties
Fixes: QTBUG-92993
Change-Id: I379c67c75bc536e387889de5303b01aef9399fcd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-04-28 16:59:53 +02:00
Shawn Rutledge
40330b8f0a Add grabber context pointers
In Qt Quick we now need to keep track of which QQDeliveryAgent is
responsible when a point is grabbed, either passively or exclusively.
When we re-deliver to that grabber, we need to do it via the same agent,
so that the same scene transform is used, and the grabber will see the
event in the correct coordinate system.  It's easier to track this
mapping here instead of in a separate map in Qt Quick.

Pick-to: 6.1
Task-number: QTBUG-92944
Change-Id: I69f769c694d0da24885cdf4087e5032022bff629
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-04-28 13:00:45 +02:00
Andreas Buhr
bb5d2af767 Port QPropertyAnimation::targetObject to bindable properties
This is one of the more complicated ports. The target object
was represented by two variables in the past: A raw pointer and a
QPointer. The QPointer is checked in some cases to check whether
the target object still exists.
This patch introduces a targetObjectDestroyed() slot and connects
it to the destroyed(QObject*) signal of the target object.
In this slot, the animation is stopped. The checks become
obsolete thereby and it is sufficient to represent the target
Object in one raw pointer.
This raw pointer becomes a bindable property.

Fixes: QTBUG-92992
Change-Id: I7e2ddb5d8aed007400fe74bea1becf7bdfbf2563
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-04-28 12:38:57 +02:00
Volker Hilsheimer
ab43506910 Fix wrong C-style cast, use correct QTest::keyClick overload
Change-Id: Ic1e170a5f63da76067a48c3775c47e202948b616
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-04-28 10:15:29 +02:00
Volker Hilsheimer
c3b01fe6a0 Fix warnings from ignored [[nodiscard]] returns
Change-Id: I1c7506c81f0d4d43a875c64120e93660de619610
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-28 06:48:58 +02:00
Volker Hilsheimer
0a1c0accf0 Fix compiler warnings from int/size_t mismatches
Cast size_t return from std::vector explicitly to int to silence compiler
warnings.

Change-Id: I0c425b3cec7feec0712e1173ab7e60b28695d6d7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-04-28 06:48:43 +02:00
Volker Hilsheimer
bbc385150f Fix warnings from deprecated posix functions
Windows wants ISO C++ _fileno and _unlink instead of posix fileno and
unlink. For fileno we have the QT_FILENO macro in qplatformdefs.h, so use
it. For unlink we don't have a macro in Qt, so declare one in the test.

Change-Id: I56c5c3fb4e500769c744132c46107816f89bb2c3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-28 06:48:33 +02:00
Sona Kurazyan
a67002dc5b Port QAbstractAnimation to the new property system
Task-number: QTBUG-85520
Change-Id: I2710c314b8c32b03fccb826fd78482ee7095fdda
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-27 21:33:48 +02:00
Andreas Buhr
62f5a6ca42 Port of QItemSelectionModel::model to new property system
The property 'model' is ported to a bindable property.
The properties hasSelection, selection, selectedIndexes,
and currentIndex are left for later patches.

Task-number: QTBUG-85520
Change-Id: Ia424ce99fc80c3d807c634c21d161a3ad94b27d2
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-04-27 20:12:50 +02:00
Assam Boudjelthia
001e9c6a19 Android: unblock passing tests
Those tests don't fail anymore and show in CI as BPASS, so we
can safely, hopefully, unblock them

Task-number: QTBUG-87429
Fixes: QTBUG-68974
Fixes: QTBUG-69166
Fixes: QTBUG-87403
Fixes: QTBUG-87411
Fixes: QTBUG-69083
Fixes: QTBUG-69084
Fixes: QTBUG-87426
Pick-to: 6.1
Change-Id: I831b955116c0f465319b9c5fc726dd98804d1c00
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-04-27 21:12:50 +03: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
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
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
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
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
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
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
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
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
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
Assam Boudjelthia
f4e23bf3de Fix QJniObject templates implementations
Define the template calls in the header to allow for better type
handling and checking with constexpr and avoid overuse of macros.
Depending on the type provided in the QJniObject's call, the
signatures and the correct JNI function variant is used.
If a type is not supported a static_assert throws a compiler error.

Pick-to: 6.1 6.1.0
Change-Id: I8a4d3ce85e1ff76ef385633f2a68511fffd12e55
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-04-23 15:43:28 +03:00
Andy Shaw
66acee69a1 SQLite: Handle tables and fields with a dot in the name correctly
Fixes: QTBUG-91885
Pick-to: 6.1 6.0 5.15
Change-Id: Iba76bb50266dd4fb5f50e4ea1549d1d2bb6e3431
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-04-23 10:46:58 +02:00
Volker Hilsheimer
83eca9a087 Mark obsolete QMessageBox members as deprecated
Those overloads have been documented as obsolete, but never been deprecated.
Add the deprecation macros to trigger warnings as of Qt 6.2.

The overloads taking a single StandardButton should not be deprecated until
Qt 7, as otherwise porting from old to new API will require an unnecessary
cast to StandardButtons for calls with only a single enum value.

The unit test explicitly tests the deprecated members, so disable warnings
there.

Fixes: QTBUG-92483
Change-Id: I283ddce4681eafda2378607f999946e56bbb777e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-04-23 08:52:01 +02:00
Timur Pocheptsov
d385158d52 Move plugin code from QtNetwork to qtbase/plugins
All TLS (and non-TLS) backends that QSsl classes rely
on are now in plugins/tls (as openssl, securetransport,
schannel and certonly plugins).

For now, I have to disable some tests that were using OpenSSL
calls - this to be refactored/re-thought. These include:
qsslsocket auto-test (test-case where we work with private keys),
qsslkey auto-test (similar to qsslsocket - test-case working with
keys using OpenSSL calls).
qasn1element moved to plugins too, so its auto-test have to
be re-thought.
Since now we can have more than one working TLS-backend on a given
platform, the presence of OpenSSL also means I force this backend
as active before running tests, to make sure features implemented
only in OpenSSL-backend are tested.
OCSP auto test is disabled for now, since it heavily relies on
OpenSSL symbols (to be refactored).

[ChangeLog][QtNetwork][QSslSocket] QSslSocket by default prefers 'openssl' backend
if it is available.

[ChangeLog][QtNetwork][QSslSocket] TLS-backends are not mutually exclusive anymore,
depending on a platform, more than one TLS backend can be built. E.g., configuring
Qt with -openssl does not prevent SecureTransport or Schannel plugin from being
built.

Fixes: QTBUG-91928
Change-Id: I4c05e32f10179066bee3a518bdfdd6c4b15320c3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-04-22 22:51:54 +02:00
Fabian Kosmale
cdabe1d64c QObjectBindableProperty: Allow signals taking a value
If the signal takes a value, we pass the current value of the property
to it.
As we now use eager evaluation, accessing the current value is now
possible.

Change-Id: I5e6947a6575bfa8ca5143f56620c645d4750a686
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-04-22 16:15:41 +02:00
Fabian Kosmale
d558ebf79b Add QObjectBindableProperyt::notify
This mirrors the functionality of QObjectCompatProperty::notify, and can
be useful to delay notifications until a class invariant has been
restored.

Change-Id: I1c16a0b1537a1b53d144c8abe48e546553edf877
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-04-22 16:15:41 +02:00
Samuel Gaist
bcbbbdb2d6 Fix case sensitivity handling QSFPM
This patch fixes the breaking of case sensitivity handling. The removal
of QRegExp killed the wrong code paths which leads to inconsistencies
when changing the regular expression throuh methods like
setFilterWildCard or setFilterFixedString. Changing the case sensitivity
also nukes the original options that were set on the regular expression
if it was set through setFilterRegularExpression.

[ChangeLog][QtCore][QSortFilterProxyModel] Case sensitivity as well as
regular expression options handling have been fixed. The original value
is properly kept when using setFilterWildCard and setFilterFixedString.
The regular expression options are now also properly kept when changing
the case senstitivity through setFilterCaseSensitivity.

Fixes: QTBUG-92260
Pick-to: 6.1
Pick-to: 6.0
Change-Id: Ifb4732306f0c7d79ad0b18d3f5437c4523bb40e5
Reviewed-by: Igor Kushnir <igorkuo@gmail.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-04-22 08:21:41 +02:00
Giuseppe D'Angelo
284d4e7125 QLayout: mark unsetContentsMargins as the RESET function
contentsMargins is a Q_PROPERTY on a QLayout. Qt 6.1 introduced
QLayout::unsetContentsMargins() to reset the contents margins to the
"default" ones (that the user can't know); that's the textbook
description of a RESET function for the property.

Add some tests also for unsetContentsMargins.

[ChangeLog][QtWidgets][QLayout] The unsetContentsMargins() function now
acts as the RESET function for the contentsMargins property.

Change-Id: I463d88363c11f4a15ad3d6af71401d8698de1d41
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-04-21 22:13:11 +02:00
Ivan Solovev
1a65a4faf5 QObject: port to new property system
Extended QObjectPrivate::ExtraData to store a pointer
to its parent, and reimplemented qGetBindingStorage()
function for QObjectPrivate::ExtraData.
This allows to use Q_OBJECT_COMPAT_PROPERTY macro
for a property, stored in QObjectPrivate::ExtraData
and solves all the problems with calling a custom
setter.

Task-number: QTBUG-85520
Change-Id: I40e01c29430846359ef9160fa1ae97c702be9a18
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-04-21 15:34:28 +02:00
Allan Sandfeld Jensen
b1f956106c Fix tst_qicon for fractional dpr
Add rounding one place, and skip addFile for now since
the assumption about rounding dpr up no longer applies.

Pick-to: 6.1
Change-Id: I0a84dfabb218acf42cb3816ba50ef899c8762523
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-04-20 21:33:00 +02:00
Edward Welbourne
605ae62944 Correct the range of allowed hours for a POSIX rule's transition
A POSIX rule's transition time is allowed an hour in the range from
-137 to 137; in particular, a negative hour is allowed, and used by
some Greenland zones using Europe's time-of-transition which, as they
are more than two hours west of Greenwich, happens before midnight.

This means the time of transition can't be represented by a QTime(),
so propagate the int that represents it to the code that consumes it;
and treat parsing failure as an error rather than "correcting" it - if
the transition time is given, it must be valid.

Changed tst_QTimeZone::isTimeZoneIdAvailable()'s verification of
validity to report the name of the zone it thought was invalid.
(A later change, validating POSIX rules, caued this to fail for
America/Nuuk without the present fix.)

Change-Id: I5c9127ac34d878554dd0aca1c1c7338c7e0e1c28
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-20 21:33:00 +02:00
Edward Welbourne
ec8808c302 Return early from QTimeZone constructor if alleged IANA ID is invalid
If the ID isn't even valid, don't waste cycles trying to make sense of
it as identifying a time-zone.

Add test of an invalid ID that provoked an integer overflow on trying
to parse it as a POSIX zone specification.

Fixes: QTBUG-92842
Change-Id: Ib80bbb88c11c0484ce0358acabbdc25c5bd8e0b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-20 21:33:00 +02:00
Giuseppe D'Angelo
7cdf77f5e7 tst_qpromise: build fix
The test use aggregate initialization on some classes which however
are no longer aggregates in C++20 (the rules changed again; in C++20
having a user-*declared* constructor makes a class not an aggregate).

Just add a constructor so the code keeps compiling in both 17 and 20.

Fixes: QTBUG-92963
Pick-to: 6.0 6.1
Change-Id: I52371c5ee34c84358987b5ae8bee9ab9c49c8eab
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-20 20:34:53 +02:00
Andreas Buhr
4dccdd3693 Port QPropertyAnimation::propertyName to the new property system
Task-number: QTBUG-85520
Change-Id: Id439783672b17810a51f867bcb69ee6c3eb5a022
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-04-20 15:56:39 +02:00
Vincent Baijot
366bdcde97 Correct prefix reported for end element in QXmlStreamReader
Before this change, QXmlStreamReader prefix value was always an empty
string for EndElement when the documentation state : "Returns the prefix
of a StartElement or EndElement."

The error was a missing update of the prefix value when parsing
EndElement.

I updated the tests data which were also wrong because no prefix were
reported even for </a:foo>. No new test is necessary, I think, the test
data already cover the cases of EndElement with a prefix and without one
(unchanged here).

Fixes: QTBUG-86847
Pick-to: 5.15 6.0 6.1
Change-Id: I0ad38b9741d760f1ce688a36f969ec14e20a928c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-20 03:03:51 +02:00
Luca Beldi
fed2c0d236 Fix QAbstractItemModelTester false positive
When rows are removed from a model with no columns,
the test should not report a problem if indexes are invalid

Fixes: QTBUG-92886
Pick-to: 6.1 6.0 5.15
Change-Id: I7a042dfdb2575f87208a00cbed13db3869807f84
Reviewed-by: David Faure <david.faure@kdab.com>
2021-04-19 19:30:46 +01:00
Juha Vuolle
ed72147149 Fix qtbase cmake autotest
The testcase relied on having optional packages, and that the last
package in that list was found. Otherwise the version numbers of
the found modules were not set.

Change-Id: I76743fd029d6eed2f4b347280591e6fdaed19053
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-19 20:56:25 +03:00
Andreas Buhr
7b6cef0e65 Port QSequentialAnimationGroup to new property system
There is only one property in QSequentialAnimationGroup,
currentAnimation.
This patch ports this property to the new property system

Task-number: QTBUG-85520
Change-Id: Id528d30f551e88a6165bbb6a3c09d44e89257de5
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-19 15:18:46 +02:00
Andreas Buhr
97a8727f0e Port of QDBusServiceWatcher::watchMode to new property system
Port watchMode in QDBusServiceWatcher to the new property
system. This is the easiest part.

Task-number: QTBUG-85520
Change-Id: I588212af205e77765862b8fecdbdcbf871717142
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-19 15:18:46 +02:00
Qiang Li
777053cfff Re-layout QProgressDialog when setting the cancel button
Setting a cancel button on QProgressDialog more than once caused the layout
to be invalid. The layout was only applied when the dialog resizes or the
style changes, but not when a new cancel button is set.

The solution is to update the layout() before showing the dialog when adopting
new child widgets.

Fixes: QTBUG-19983
Pick-to: 6.0 6.1
Change-Id: Id8fb1ac56e94a9bd97d4559a2e8d4835856fd7d0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-04-19 09:22:04 +00:00
Andrei Golubev
7b7a6050e7 Inline test cases in tst_qlist
QList tests have mostly a scheme of:
void opInt() { op<int>(); }
void opMovable() { op<Movable>(); }
void opCustom() { op<Custom>(); }

As a drive by, move the leak checking into a separate struct/macro

Change-Id: I7cdda3a6c2aa324968aa26594da9f9eafbd49a0a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-17 12:24:14 +02:00
Qt CI Bot
042e728752 Merge integration refs/builds/qtci/dev/1618599897 2021-04-16 22:01:34 +00:00
Qt CI Bot
09d99a8d5f Merge integration refs/builds/qtci/dev/1618592683 2021-04-16 19:56:04 +00:00
Fabian Kosmale
e835bccb1e QPropertyBinding: Add sticky mode
A sticky QPropertyBinding is a binding that does not get removed when a
write occurs. This is used in the QML engine to implement support for
the QQmlPropertyData::DontRemoveBinding flag.

Task-number: QTBUG-91689
Change-Id: Ib575b49abe634215318ccc7ba46212cc21eb4dad
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-04-16 20:33:02 +02:00
Giuseppe D'Angelo
a794c5e287 Unicode: fix the extended grapheme cluster algorithm
UAX #29 in Unicode 11 changed the EGC algorithm to its current form.
Although Qt has upgraded the Unicode tables all the way up to
Unicode 13, the algorithm has never been adapted; in other words,
it has been working by chance for years. Luckily, MOST
of the cases were dealt with correctly, but emoji handling
actually manages to break it.

This commit:

* Adds parsing of emoji-data.txt into the unicode table generator.
  That is necessary to extract the Extended_Pictographic property,
  which is used by the EGC algorithm.

* Regenerates the tables.

* Removes some obsoleted grapheme cluster break properties, and
  adds the ones added in the meanwhile.

* Rewrites the EGC algorithm according to Unicode 13. This is
  done by simplifying a lot the lookup table. Some rules (GB11,
  GB12, GB13) can't be done by the table alone so some hand-rolled
  code is necessary in that case.

* Thanks to these fixes, the complete upstream GraphemeBreakTest
  now passes. Remove the "edited" version that ignored some rows
  (because they were failing).

Change-Id: Iaa07cb2e6d0ab9deac28397f46d9af189d2edf8b
Pick-to: 6.1 6.0 5.15
Fixes: QTBUG-92822
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2021-04-16 20:31:39 +02:00
Qt CI Bot
5839dee30f Merge integration refs/builds/qtci/dev/1618585460 2021-04-16 18:14:35 +00:00
Giuseppe D'Angelo
b9d0fd3a09 tst_qcborstreamwriter: don't pass char8_t strings to QByteArray
There isn't a QByteArray constructor taking a char8_t*. (I am not
sure if there should be one; QByteArray is not going to anything
special about that information anyways.)

Change such strings to be "ordinary" narrow string literals.
There should be no problems at doing so, as by default we build in
UTF-8 mode under all compilers.

Pick-to: 6.1 6.0
Change-Id: Ia200ec6e3b0453bad033d5d8ff34c013bb27abd1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-16 18:48:28 +02:00
Qt CI Bot
931929865f Merge integration refs/builds/qtci/dev/1618564901 2021-04-16 15:28:18 +00:00
Lars Knoll
fdedcb6ec6 Add support for grouped property changes
Add Qt::begin/endPropertyUpdateGroup() methods.
These methods will group a set of property updates together and delay
bindings evaluations or change notifications until the end of the update
group.

In cases where many properties get updated, this can avoid duplicated
recalculations and change notifications.

Change-Id: Ia78ae1d46abc6b7e5da5023442e081cb5c5ae67b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-04-16 16:49:29 +02:00
Lars Knoll
bb44c18b67 Don't emit change notifications more often than required
When a property value changes, first update all dependent bindings to
their new value. Only once that is done send out all the notifications
and changed signals.
This way, if a property depends on multiple other properties, which all
get changed, there will only be one notification; and (potentially
invalid) intermediate values will not be observed.

Fixes: QTBUG-89844
Change-Id: I086077934aee6dc940705f08a87bf8448708881f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-04-16 16:49:29 +02:00
Lars Knoll
cf42a0fe5e Remove lazy binding evaluation
Too much of the existing code in Qt requires eager evaluation without
large scale modifications. Combined with the fact that supporting both
eager and lazy evaluation has a high maintenance burden, keeping lazy
evaluation, at least in its current state, is not worth it.

This does not diminish other benefits of the new property system, which
include
- a C++ API to setup and modify bindings and
- faster execution compared to QML's existing bindings and the ability
  to use them without having a QML engine.

We do no longer benefit from doing less work thanks to laziness. A later
commit will introduce grouping support to recapture some of this
benefit.

[ChangeLog][Import Behavior Change][QProperty] QProperty uses always
eager evaluation now when a dependency in a binding changes.

Change-Id: I34694fd5c7bcb1d31a0052d2e3da8b68d016671b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-04-16 16:49:29 +02:00
Qt CI Bot
07d4a981a2 Merge integration refs/builds/qtci/dev/1618561273 2021-04-16 14:49:26 +00:00
Qt CI Bot
7e15d57eb4 Merge integration refs/builds/qtci/dev/1618515869 2021-04-16 10:08:31 +00:00
Edward Welbourne
b4a875544b Extend time_t-based handling all the way to the end of time_t
At least some modern 64-bit systems have widened time_t to 64 bits
fixing the "Unix time" problem. (This is even the default on MS-Win,
although the system functions artificially limit the accepted range to
1970 through 3000.) Even the 32-bit range extends into January 2038
but the code was artificially cutting this off at the end of 2037.
This is a preparation for using the same also all the way back to the
start of time_t.

In the process, simplify and tidy up the logic of the existing code,
update the docs (this includes correcting some misinformation) and
revise some tests.

Fixes: QTBUG-73225
Change-Id: Ib8001b5a982386c747eda3dea2b5a26eedd499ad
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-16 10:22:27 +02:00
Edward Welbourne
c3aa4cf952 Catch invalid offset returns from QTimeZone backends
If the backends run into an error in computing the offset, they return
INT_MIN; but they are valled via the front-end, which returns zero
when the zone is invalid. So treat INT_MIN returns from the backend
the same as the case of being invalid.

Change-Id: Ic3c4dfe964dbfba4030c770213eca8a63e84736d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-16 10:20:11 +02:00
Qt CI Bot
455994c2ee Merge integration refs/builds/qtci/dev/1618512247 2021-04-16 07:57:01 +00:00
Alex Trotsenko
063cdb9870 QWindowsPipe{Reader|Writer}: restructure signals
For QProcess, there is no point in suppressing recursive
QWPR::readyRead() emission, as the former manages this logic itself. On
top of that, the non-recursive nature of QWPR::readyRead() indirectly
disallowed reading from the channels inside
QProcess::waitForReadyRead(), if that is called from a slot connected
to QProcess::readyRead().

QWPW had two signals, one allowing recursion and one not.

This commit allows recursion of QWPR::readyRead() and
QWPW::bytesWritten(), and moves recursion suppression to the higher-
level classes. This makes the code more uniform and efficient, at the
cost of a few duplicated lines.

Change-Id: Ib20017fff4d92403d0bf2335f1622de4aa1ddcef
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-04-15 19:00:42 +00:00