Commit Graph

12632 Commits

Author SHA1 Message Date
Sona Kurazyan
1bf75f2a66 Remove the dead code for blocking methods from QtConcurrent
After 79fd1cb2c6 the methods for running
QtConcurrent algorithms in the blocking mode aren't used anymore. Since
ThreadEngineBase and ThreadEngineStarter classes aren't meant to be used
externally, it should be fine to remove startBlocking() methods now.

Removed the unused code and adjusted the tests accordingly.

Change-Id: Ifb13820ce207869d6f720bcb5be8d35bb355fe33
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-06-14 11:52:36 +02:00
Mårten Nordheim
e0ae1af278 QLatin1String: Add a constructor taking QByteArrayView
Change-Id: Ie90645486431d7af3fe8128417b0fb6bd02a88b5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-12 03:08:59 +02:00
Mårten Nordheim
6f25051536 QNetworkReply: Decompress when reading
Rather than when the data is received. Source compatibility is
achieved through double-decompressing the data. This lets us know
how many bytes are available just as before but without having the
uncompressed data left in memory.

Fixes: QTBUG-83269
Change-Id: I352bd09581614c582e4628243e2a0e895ba4946b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-12 00:04:04 +02:00
Mårten Nordheim
f9b867216b String API Symmetry: test for indexOf with large negative offset
Small change needed to make QString_char16 and QString_QChar return -1
in this case, but other combinations already returns -1.

[ChangeLog][QtCore][Behavior Change] QString::indexOf(QChar) and
QString::indexOf(char16_t) now treat a negative start-position, from,
bigger than the string's size as invalid. It previously
clipped such start-positions to the start of the string, inconsistently
with other QString indexOf overloads.

Change-Id: Ic56c8a558bf40a94845c649647db569892d4df02
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-11 22:04:04 +00:00
Edward Welbourne
e6457d9b60 Ensure test using setlocale() doesn't leave it permanently changed
tst_QStringList::sort() wants to use the C locale; but, if it failed,
it left that in force, since it only restored the prior locale on
success. It should also use C.UTF-8, since Qt now wants UTF-8.

Change-Id: If62e3d8da682081bf969075a719d03caebf09233
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-06-12 00:03:53 +02:00
Volker Hilsheimer
b65159a5ea Deliver WindowActivate/Deactivate events to QWindow
We need those events to trigger palette color group changes in QQuickItem
without having to connect every item to yet another QWindow signal.

Task-number: QTBUG-93752
Pick-to: 6.2
Change-Id: I8534808cdaab828e5876f8fda31567aeb1b4272a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-11 23:30:09 +02:00
Edward Welbourne
421c69fde5 Add .UTF-8 suffixes to locale-names passed to setlocale()
We use UTF-8 locales by default since Qt 6; and relatively few systems
have the encoding-unspecified locales we were trying to use, with the
result that the setlocale() calls all failed.

Task-number: COIN-689
Change-Id: Id791ba269bf4abac29da3daa4fd01684ca9caa7a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-06-11 23:30:09 +02:00
Edward Welbourne
81fbcc4dc6 Remove two QEXPECT_FAIL()s that no longer appear to be valid
Because they were followed by a QVERIFY(false), no-one noticed until
now. Dates from 2011, when ICU support was first added. I guess
someone fixed the problem in the intervening decade.

Change-Id: I847816c297156e65397c652767f286bc4de193a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-11 23:30:08 +02:00
Mårten Nordheim
1c164ec7f2 QLatin1String: Add overloads taking QLatin1Char
Without the overloads using QLatin1Char in QL1S member functions results
in the QL1Char being converted to QChar and QL1String being converted to
QString.

Change-Id: Ic19545539a207f025a6293f0b2d929de475dc166
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-11 20:25:05 +02:00
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