Enable the check, that has been disabled because of instability, which
makes the test-case useless. The reason for instability probably was
that it doesn't always start maxThreadCount number of threads: it could
be less if the workers reuse the thread pool's already created threads
(if possible) instead of creating new one each time. But we can at least
make sure, that we're not starting more threads than expected.
Task-number: QTBUG-94463
Pick-to: 5.15 6.1 6.2
Change-Id: I8e498c377d86c49758bde0114fe6f7e0432fe993
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
QTableView stored the current row/column selection start in an own
variable instead using currentSelectionStartIndex. This leads to an
inconsistent behavior when the selection is done with a click on the
header and then in a cell (and the other way round)
Fixes: QTBUG-92561
Change-Id: I4c8bda3a938de451b6eff2819141e86a6870fbef
Pick-to: 6.1 6.2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The decltype() of a const auto variable will be const T, for some
T. GCC warns that in the static_cast, said const is ignored.
Fix by not casting, but declaring a variable of fitting type. Add a
scope so the next reader doesn't have to go hunting for further uses
of 'readResult' or, now, 'expected'.
Change-Id: Iebc828a522810c6f2514fb3542d8c76c755ec7a5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Amends c0b3c06a7d.
The QCompleter used by QFileDialog uses starts-with matching of
the path parts, for all parts of the path. It uses the EditRole of the
underlying model for the data to match.
The path parts used for a path on Windows are "C:", "Users", "etc...",
and then finally whatever input has been typed so far. If we try to
match that against a starts-with rule against "Local Disk (C:)", then it
will fail and the completer will never have anything to show.
So, for the EditRole, return just the volume drive letter as we did before
c0b3c06a7d, not the volume name. Neither
can be edited anyway. This happens to then match the native file dialog
behavior, which doesn't complete "L" to "Local Disk (C:)" if the Computer
contents (ie. volumes) are shown.
Augment the QCompleter test case to cover that scenario (it already has
everything set up for this particular combination, even though we are
actually testing QFileSystemModel returning the correct data).
Fixes: QTBUG-94799
Task-number: QTBUG-78043
Pick-to: 5.15 6.2 6.1
Change-Id: I14844d91601e9b16dc07cff2ca48713acb7cdd09
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The method was never tested, but it failed to compile after
QMultiHash was introduced as a separate class in 6.0.
This patch fixes it and adds some unit-tests to cover the case.
Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: I5dd989d4775efc6a9bb13c5ed1d892e499d95dc2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The base implementation discards the data by reading into a dummy
buffer, which is slower than necessary.
Change-Id: Iabf0c4a25746af6cac5b61d7bda66d89501c808c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Do not detach when find(key, value) is called on an empty QMultiHash.
As a drive-by: fix return value for QMultiHash::remove() in case of
empty QMultiHash.
Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: I1e32f359e7ee9ce8403dae79d02e0b88a20ec4a5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
There's a chance that this would be used in some macro, so why not test
that this thing works in general (especially since it actually works)
Change-Id: Ib9d91fbd17cf16675ae89a99f010dacc5d30967a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Use the ctor instead of appending 1'000'000 chars.
Introduce C++14 digit separators as a drive-by.
Change-Id: Icdbef3173f42d12ae2226b8556f9b1519e594adc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
We call evaluateRecursive_inline in setBinding, which in turns runs the
noSelfDependecies check. However, creating a binding resuting in a
binding loop must not crash, but instead result in the binding entering
an error state. To prevent a crash caused by the assert in debug builds
of Qt, we replace the assert with a warning for now.
A better approach in the future would be to ensure that we only run the
check in cases where we are sure that a self-dependency is really a
fatal error.
Pick-to: 6.2
Change-Id: I58158864ed81fa907132a4e7d6667c9b529e7e64
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
After dc794f7622, side widgets only got
space if they were not fading out, but the logic was not correctly
accounting for side widgets that never fade, such as buttons added via
QLineEdit::addAction.
Fix this to give visible widgets space, unless they are fading out. That
was the intent of the original change. Rename the variable to make its
purpose clearer, and reset it at the end of the fade-out animation.
Add a much-needed test that relies on private APIs to verify that the
effective margins are calculated correctly.
Fixes: QTBUG-94824
Pick-to: 6.2 6.1 5.15
Change-Id: If2ee6be52be9e4f9be1e91f72f27681ce27def6d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
In the unit tests, two times a validator was used without a parent,
which led to memory leaks. This patch changes this: The
validators are initialized with the widget they are meant for
as parent. This fixes the memory leaks.
Pick-to: 6.2
Change-Id: I480c0c5104cbe60159fad49df28cbb6240e7ce68
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Incl. the static hash() function. Remove the QByteArray versions from
the API, but not the ABI.
Adapt some callers.
[ChangeLog][QtCore][QCryptographicHash] Replaced QByteArray with
QByteArrayView in addData() and static hash() functions.
Change-Id: Ia0e9bf726276305e05894d323d76a29e985f39eb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
QIODevice::readLine() can also return partial lines, which was not
properly documented. Add an autotest for QLocalSocket to illustrate
and test this behavior.
Pick-to: 6.2
Change-Id: Ia2c1c438cc68d2672d34881e11fdf7837232f3b4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Need to decrement 'remaining' (check), but also increment data (meep).
Testing is a bit complicated, as most algorithms are just too slow to
fit into the 5min QTestLib timeout. Picked the fast ones and Sha512
(which completes here in < 17s, with threads), at least.
Amends e12577b563.
[ChangeLog][QtCore][QCryptographicHash] Fixed a bug where presenting
more than 4GiB in a single addData() call would calculate the wrong
result().
Pick-to: 6.1 6.2
Change-Id: Ic72916ebc33ba087d58225af6d8240e46e41f434
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
If a child widget that is affected by the parent's style sheet is
polished (because it's been shown explicitly, for instance by a layout),
then it must be repolished when the parent's style sheet changes, even
if the parent itself has not been polished yet.
Since the style sheet is set on the parent widget, we must repolish the
parent (which will repolish the entire widget tree), not just the
individual children and grand children.
Fixes: QTBUG-76945
Task-number: QTBUG-39427
Task-number: QTBUG-18958
Change-Id: I7bca9ee1badc07202fa05dc97f440f4ca6c9517d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Due to mistake in data it was missed for testing.
Pick-to: 6.2
Change-Id: I4dcd6fd90fd501e4cc941c07efcf9439ba6acf30
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
target_link_options are placed by CMake at the beginning of a linker
line. This gives us an opportunity to use the function to propagate
object libraries. This change adds one more check in the root
Config.cmake file. If CMP0099 policy is enabled, CMake enables
propagating of the linking options when linking two static libraries
using the PRIVATE linking visibility, so we can rely on the correct
linking order and expect object libraries to be propagated.
Note that on the platforms where cmake version is higher than 3.16
Qt uses CMP0099 NEW in functions like qt_add_executable. This means
that at the moment of creating an executable target the TARGET_POLICY
genex will also be NEW, so we do not take into the account the user
defined CMP0099.
If the CMP0099 policy is not available for a certain CMake version
we skip the TARGET_POLICY check and simply disable propagation of
the object libraries using target_link_options for both user and Qt
libraries. This is applicable for the CMake versions 3.16 and less.
Linking approaches have the following priorities(from higher to lower)
after this change:
- target_link_libraries - works if link order matters not or CMake
version greater equal 3.21.
- target_link_options - works if CMP0099 is set to NEW by user or
if the CMake version is greater than or equal to 3.17 and an
executable is created using Qt functions.
- object library finalizer - works if CMake version is greater equal
3.19 or qt6_finalize_target is called explicitly.
- target_sources - is used when all the other approaches could not
be used.
Amends a1fd4f51ad
Amends 3329212815
Pick-to: 6.2
Change-Id: I14f88caeb04e357191c840abeab89b03e210b796
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
With MSVC it tries to link with the function in the scope qt::tst_QDtls::*
where it is not found
Pick-to: 6.2
Change-Id: If83a9f69c7b3834248569f6bdf203f5442693080
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
To (set)decompressedSafetyCheckThreshold, as suggested on the API review.
Task-number: QTBUG-94407
Change-Id: Iffc52691022939ae46703de8a0416355487b716f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Says GCC:
In function ‘char* QTest::toString(QPair<T1, T2>&) [with T1 = QWidget*; T2 = QEvent::Type]’,
warning: ‘%s’ directive argument is null [-Wformat-overflow=]
Fix by re-using formatString(), once introduced for std::tuple.
As a side-effect, this gets rid of the funny double-quotes around the
output.
Change-Id: I2dd5f10fa2b3a392370bf487c1b7e98f3d190978
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
... and C++20 std::counting_semaphore API compatibility.
[ChangeLog][QtCore][QSemaphore] tryAcquire() now optionally takes a
<chrono> duration as timeout, not just int milliseconds.
[ChangeLog][QtCore][QSemaphore] Added try_acquire{,_for,_until}() for
C++20 std::counting_semaphore compatibility.
Change-Id: I34b6b4bf57a54745d4b97349903d090c4995338a
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
GCC can't see through all the foreach code to determine whether the
loop will execute at least once, so don't play hardballs with the
compiler and initialize the variable.
Change-Id: I95756a99eda497a25aa277046df9895f558758c3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
... by making the test class a friend of the CUT, as we do elsewhere
for the same reason.
This allows to remove the duplicated enum and struct in favor of using
The Real Thing™, which means the test can no longer go out of sync
with the CUT anymore.
Change-Id: I87dc8bb4a5476ae4fc99e006c4690e96d2f530d2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Fixes compiler warnings:
warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]
Change-Id: Ia7cf50f491e92f39162c69afb2a8320afedba056
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
- QString/QStringView overloads were designed to be compatible for all
possible argument types, so check that it stays that way
- QString/QAnyStringView overloads have several known ambiguities that
we cannot and don't want to fix, because it would make
QAnyStringView less versatile, but at one should at least be able to
overload QString and weak-QAnyStringView.
Change-Id: I5e5ae3c96060c93bfe070f6c19213328dae9c5f9
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
For flush() it's not clear what they wanted to test.
isEncrypted() is tested indirectly in many of the other tests.
Change-Id: Id6dfecbb25b7bba8f1a99518fd9c9e06280aaa9f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
It needs to be checked at runtime to know if the current backend
supports it
Pick-to: 6.2
Change-Id: I0998309149b109e2075a008b2b8d8115fa3688cc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
With MSVC the current way we mark it (potentially) unused ends up with a
warning:
warning C4551: function call missing argument list
We require c++17 core language support so let's use [[maybe_unused]]
instead.
Pick-to: 6.2
Change-Id: I125986b729cb7cd540901702a47365f0491e7887
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
As per the best practice laid forth in RFC-8996.
TLS 1.2 was recommended from 2008 until TLS 1.3 was released in 2018.
[ChangeLog][QtNetwork][QSslSocket] TLS 1.0, 1.1 and DTLS 1.0 are now
deprecated, as recommended by RFC-8996.
Fixes: QTBUG-92880
Change-Id: I90cebcfb07cfce623af7ac9f2b66ce9d02586b54
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Since we're no longer connected, much less encrypted.
Was done in schannel backend, but not in ST or OpenSSL
Pick-to: 6.2
Change-Id: Ia49387be0088f899a0c89091f7e468dba1c0eee6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
With the recent change, 'system' headers gone: not in the test code anymore,
so, for example OPENSSL_VERSION_NUMBER is undefined, making the test
to select a wrong code-path - 'h2c', instead of encrypted h2.
Pick-to: 6.2
Pick-to: 6.1
Change-Id: I3b201e21fac56875c9045c7463e2ae69af4c6470
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Add an option that automatically generates an export header for a Qt
module. The header contains only Q_DECL_EXPORT/Q_DECL_IMPORT related
content, so it's not a full replacement of 'global' header files.
Task-number: QTBUG-90492
Change-Id: I250d1201b11d4096b7e78e61cbf4565945fe6517
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Triggered by API review in Gerrit patch 355960.
Task-number: QTBUG-94407
Pick-to: 6.2
Change-Id: I7cafc1cc9d4b929040b53c6bf92c91d73c3b39f2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Match the checks in the constructor test that are similar.
Change-Id: Ifb62af09e31aac339f001f44bc30789330c85be6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This should reduce the amount of fall-out from DST complications.
Also document the assumptions of QDateTimeParser's two fromString()
methods (and fix the punctuation on the QDateTime parameter).
Adjusted some tests to match.
Since only QDateTime-returning methods will show the difference, and
it's at least somewhat odd to be using those on QDateEdit or
QTimeEdit, this should have little impact on API users.
[ChangeLog][QtCore][Behavior Change] QDateEdit and QTimeEdit now
operate in UTC, to avoid spurious complications arising from time-zone
transitions (e.g. DST) causing the implicit other half to combine with
the part being edited to make an invalid result. Returns from their
dateTime() and other methods returning QDateTime (max/min) shall thus
be in UTC where previously they were in local time. QDateTimeEdit
continues using local time. The default can be over-ridden by
setTimeSpec(), as ever.
Change-Id: I44fece004c12342fe536bbe3048217d236fd97b2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QDTP's absoluteMax(), setDigit() and getDigit() simply treated
day-of-week as synonym for day-of-month.
Consequently, QDTE::stepBy() did the same.
This meant that wrapping happened at the month boundary, so would jump
within the week if it wrapped around, otherwise the up/down arrow
would "jam" at a particular day of the week when further steps would
leave the month. Instead, when wrapping, wrap round the week while
still moving the day-of-month to match, jumping back or forward a week
to stay within the month on hitting a month boundary; otherwise, stop
backwards stepping on hitting the locale-specific day of the week, or
forward stepping when the step would be to or past this first day.
Fixed various bugs found in the course of testing this.
[ChangeLog][QtWidgets][QDateTimeEdit] Corrected handling of weekdays.
Previously, changes to the week-day were simply changes to the day of
the month. Weekday fields are now handled as such: changes to them do
change the day of the month, but a change that would step past the end
(or start) of the month is adjusted to the relevant day of the nearest
week within the month. When wrapping is disabled, the locale-specific
first and last days of the week are the bounds. Formats which specify
day of week but not day of month will now preserve day of week when
changing month or year, selecting the nearest day of month that
matches.
Change-Id: I7868b000fea7a4bc17a1b5687c44bcd56d42ae90
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
If we disregard the precision we may read a very large string that we
subsequently discard. Furthermore, people use this to read
non-null-terminated strings, which randomly crashes.
Pick-to: 5.15 6.1 6.2
Change-Id: Ifa255dbe71c82d3d4fb46adfef7a9dc74bd40cee
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... even though the documentation states that the action takes
ownership of the widget.
Change-Id: Ie5520fbda295a5a2774ff8b82165070e9d49e310
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The linking logic of object libraries should be reusable outside of the
resource context. This introduces a
__qt_internal_propagate_object_library function that prepares all the
necessary genexes to link and propagate the object library to the
end-point executable.
Rename resource object finalizer API to make the naming more generic
to object libraries of any kind.
Amends 5fb99e3860
Pick-to: 6.2
Task-number: QTBUG-93002
Task-number: QTBUG-94528
Change-Id: I69d0f34c0dadbd67232de91035aaa53af93d1fa1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Changing anything on a QWindow's QSurfaceFormat has zero and null
effects once the underlying native window has been created. Letting
QWidget update the format is wrong in this case, because we always
expect that the value returned from QWindow::format() reflects
reality.
(reality being the settings with which the underlying native resource
was created, which is typically frozen after QWindow::create(), not
the state of some QWidget attribute. There are certain exceptions to
this, such as when preparing to recreate the underlying native window,
in which case one will want to update all relevant fields of the
format based on the current values of the widget attributes, which is
exactly what QWidgetPrivate::create() implements, and that's good.)
Such a mismatch can have fatal consequences when OpenGL and friends
are involved, but this always depends heavily on the platform and
windowing system. For example, claiming that the alpha buffer size is
0 when the native window was created with 8, or vice versa, can break
OpenGL-related code (both in Qt itself and in applications), that
tries to create a QOpengGLContext configured based on what
QWindow::format() returns. If that format describes settings that are
incompatible with the actual underlying native window, we end up with
the classic Invalid pixel format, EGL_BAD_MATCH, and alike errors.
This is exactly what is happening when a QOpenGLWidget (or
QQuickWidget) is placed in a QDockWidget where one of the ancestors is
forced to native (winId() was called or WA_NativeWindow was set). When
undocking, various code paths in QWidget will try to update the opaque
flag of the widget, which in turn calls updateIsTranslucent. Now, if
this function unconditionally changes the alphaBufferSize in the
QWindow's QSurfaceFormat (even though this is completely futile to do,
it has no visible effect in practice), we get the problem described
above: rendering breaking down due to OpenGL contexts created with a
pixel format incompatible with the native window.
Prevent all this by not touching the format once the QWindow has a
QPlatformWindow. This is the right thing to do, regardless of the bug
in question: a window's (or context's or any other native resource
wrapping class's) format must describe the underlying native resource
and must never deviate, unless we are preparing to create a new native
resource underneath.
When it comes to the autotest, this changes the test added in
555661b625: the autotest logic is
inverted because what we should test for is that the QSurfaceFormat
stays untouched once the application makes a - futile - attribute
change on the widget.
Fixes: QTBUG-85714
Pick-to: 6.2 6.1
Change-Id: I7bf90711867e8a0fd474895625bf9530a7821fd5
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
When the element you want to erase is the last element AND the
next element (element 0), when rehashed, would be relocated to the last
element, this leads to the state below. Which is similar to a test in
tst_qhash for some seeds.
auto it = hash.begin + (hash.size - 1)
it = hash.erase(it)
it != hash.end
By forcing the iterator to increment if we were erasing the last element
we always end up with a pointer which is equal to hash.end
Befriend the tst_qhash class so we can set the seed to a known-bad one
Pick-to: 6.2 6.1
Change-Id: Ie0b175003a2acb175ef5e3ab5a984e010f65d986
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
When calling `setStyleSheet` with property `qproperty-styleSheet`,
`QStyleSheetStyle::polish` will call`QStyleSheetStyle::setProperties`, and then`QStyleSheetStyle::setProperties` goes on to call `setProperty`.Because there is property `qproperty-styleSheet`, it will update stylesheet by calling QStyleSheetStyle::polish`.
This causes the recursive call to crash.
Fixes: QTBUG-94448
Pick-to: 5.15 6.2
Change-Id: I79c51192a939b0b62e5b1d0dcc90d38f79e28222
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>