Commit Graph

11461 Commits

Author SHA1 Message Date
Allan Sandfeld Jensen
bde773ec6a Fix a few compiler warnings in tests
Change-Id: I22f6ac8ed02dd4ef4083ce3c781552623a0b08da
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-02-02 12:06:05 +01:00
Edward Welbourne
1e3b0d9280 Purge various BLACKLIST entries that are now fixed
Based on BPASS results from recent test-runs.

Task-number: QTBUG-69131
Fixes: QTBUG-87416
Fixes: QTBUG-87662
Task-number: QTBUG-87663
Fixes: QTBUG-88705
Change-Id: I8ebe014517bfa8d124e86b821650b07c591ea16e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-02-02 10:40:44 +01:00
Jonas Karlsson
c5e9708ce6 Support cubemap ktx files
Change-Id: I6905c393647d31fab958cdd9471bb0a6ffe83596
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-02-01 20:28:37 +01:00
Edward Welbourne
38a72af4fd Fix handling of Sunday in POSIX time-zone rules
Dating from the origins of our support for the zoneinfo file format,
the mapping of POSIX's day-numbering (0 = Sunday through 6 = Saturday,
see [*]) to Qt's (1 = Monday through 7 = Sunday) was done by mapping 0
to 1, when it should have been 7.

[*] http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html

Corrected a QTimeZone test that trusted the results it got without
checking which day of the week those were: they were all Mondays.
Verified that the corrected dates are in fact Sundays.
Checked the zone abbreviations, too.

Fixes: QTBUG-90553
Pick-to: 6.0 5.15
Change-Id: I84b4b14f9892ff687918cd3c42c7c9807e45313c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-02-01 16:28:26 +01:00
Andreas Buhr
a1a2d97e34 Remove QObjectCompatProperty::operator= for safer usage
Introduction of QObjectCompatProperty requires every write to
the property to be examined whether it is OK or should be replaced
by a setValueBypassingBindings/markDirty combination. The existence
of operator= make this difficult as it is easy to miss places where
it is written. By not having operator=, we can help developers
make sure they had a conscious decision about each write to the
property.

Change-Id: Ia61ea4722eb0bab26ce7684b85dd03d710cd1751
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-01-29 16:06:19 +01:00
Allan Sandfeld Jensen
f2c3b52c6c Revert "Port QThreadPool to the new property system"
This reverts commit 8f8405e046.

Reason for revert: Appears not entirely thread-safe and caused QTBUG-90705

Change-Id: I390c0b1a555a18e6a095b52010371d017071e26b
Fixes: QTBUG-90705
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-01-29 10:55:42 +00:00
Fabian Kosmale
af53fb0e00 QProperty: Treat change listener modifying its source property as a loop
This is in line with QML where

import QtQuick 2.15
Rectangle {
  width: 100
  height: 100
  color: "red"
  Rectangle {
    id:  inner
    x: 10
    y: x
    width: 50
    height: 50
    onYChanged: { console.log("hey"); inner.x = 10}
    TapHandler {
      onTapped: inner.x = 20
    }
  }
}

results in a binding loop warning when the tap handler triggers. While
the change handler would only run once, we cannot statically determine
if we need to loop once, twice, or if there actually is a diverging
loop. Thus we unconditionally warn about the binding loop and stop
executing the binding.

As a drive-by, verify in the related test that a change handler which
overwrites its properties binding itself removes the binding.

Change-Id: I5372019c2389ab724c49cd7489ecbd3ebced1c69
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-01-28 18:51:19 +01:00
Timur Pocheptsov
1a2dd92767 TLS backend: merge with its factory
QTlsBackend is a factory itself - it creates TLS/X509 objects. Having
an intermediary between Factory->Backend->TLS primitive does not look
very natural thus let's squash the first two parts. Backend is a factory
creating TLS primitives, but its static functions also provide information
about backends availablei and give access to those backends.

Fixes: QTBUG-90606
Task-number: QTBUG-65922
Change-Id: I8409d81fd11fb46e6ab4465b4937a7680a8c2447
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-01-28 16:21:07 +01:00
Eirik Aavitsland
bfc09b8d8f Avoid overflow in text layout
Fixes oss-fuzz issue 29313.

Pick-to: 6.0 5.15
Change-Id: Idbabd162fa9e0dbce687981bdbcc75be37189a61
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
2021-01-28 11:02:18 +01:00
Samuli Piippo
07c248a594 Remove blacklisting for b2qt tests that now pass
With the updated QEMU and toolchain, these tests now pass.

Change-Id: Icb74562a0e6422cd4564f63db991aa431e0e3119
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-01-28 09:27:14 +02:00
Samuli Piippo
d5a20467b8 tests: remove unnecessary skips for qemu
QEMU sysroots are now root owned.

Change-Id: Id829cb5debc449efee929ef83876e6ffbf78332c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-01-28 09:27:06 +02:00
Timur Pocheptsov
7687e2a429 Port QLocalServer to the new property system
Task-number: QTBUG-85520
Change-Id: Iee43a2e9e2d4847dad3b8be345d562af9aa3b690
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-01-27 16:54:46 +01:00
Timur Pocheptsov
061254ed12 QDnsLookup - port to the new property system
Read/write/notify properties, 3 out of 5 defined in this class.

Task-number: QTBUG-85520
Change-Id: Ic6c74f90a2fa3c71d71cf9a5d557f1b6fc489d35
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-01-27 16:54:38 +01:00
Assam Boudjelthia
4e60681c87 Make QJniObject and QJniEnvironment public API
As part of Qt 6 restructring for the extras modules, this change exposes
the Jni APIs which are very important for Android platform. This patch
adds the APIs QJniObject, QJniEnvironment, QJniExceptionCleaner based
from private QtCore and QtAndroidExtras.

The Jni interface is cross-platform which justifies the name, but
currently, this API is used mainly for Android, and the naming comes
generic without Android keyword to avoid any future limitation on
supporting other platforms.

[ChangeLog][QtCore] Add new QJniObject, QJniEnvironment and
QJniExceptionCleaner APIs.

Task-number: QTBUG-89482
Fixes: QTBUG-89633
Change-Id: I4382dd53a225375759b9d042f6035a4a9810572b
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-01-27 17:23:04 +02:00
Sona Kurazyan
3a5a404a53 Port QMovie to the new property system
Task-number: QTBUG-85520
Task-number: QTBUG-85521
Change-Id: Ib936020260cf01a5221b63fb1eb0ccb23f5553a3
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-27 15:16:20 +01:00
Fabian Kosmale
0f4d512dc4 Q(Untyped)Bindable: add takeBinding method
We missed takeBinding as a supported operation on Q(Untyped)Bindable.
To avoid adding version checks to code dealing with QBindableInterface,
we simply synthesize takeBinding as a combination of binding to retrieve
the binding and setBinding with a default-constructed
QUntypedPropertyBinding.

Change-Id: I43803a0dfe210353d0235f0373d2257f75ffe534
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-27 15:01:56 +01:00
Friedemann Kleint
5849619607 Stabilize tst_QListView::internalDragDropMove() on X11
The test was flaky in recent test runs on X11. Debugging
showed that the global position of the synthesized mouse
events was not correct due to the window not being mapped
properly. Use QTest::qWaitForWindowActive() instead of
QTest::qWaitForWindowExposed() to ensure that.

Task-number: QTBUG-90016
Pick-to: 5.15
Pick-to: 6.0
Change-Id: Ie1bc4157e6d0e807d8530f70dcbd27b5e2fc813c
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-01-27 14:00:57 +00:00
Edward Welbourne
b08368d99f Add qHypot() to qmath.h, exposing and extending std::hypot()
We have plenty of places where we add some squares and take a square
root; this may be done more accurately and faster by hypot().
Introduce QHypotHelper to handle hypot with more than 3 parameters,
and with 3 when the C++17 version is missing (which it never should
be). Include an overload taking arbitrarily many valus and ensure that
we can use qHypot() with qfloat16.  Illustrate with some example uses,
add some tests.

[ChangeLog][QtCore][QMath] Header <QMath> now provides qHypot(), an
implementation of std::hypot() taking arbitrarily many numeric values,
including support for qfloat16, while avoiding the overflow and
underflow problems that arise when naively taking the square root of a
sum of squares.

Change-Id: Ia4e3913fe83fc27d17d8e7f1a52f03ad445c1fed
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-01-27 15:00:57 +01:00
Edward Welbourne
ad16f79e5f Update public suffix list to today's latest
Fetched from the authoritative source, verified the content matches
that of the current master revision in the github repository.

Amend one cookie jar test to find the last group in the last chunk
correctly - each group arises from a non-empty hsah-table entry, but
the last few hash-table entries may be empty, in which case the last
group isn't just before the last index, it's earlier by the number of
empty hash table entries. In the process, amend this test and the
related test of the end of the first chunk to iterate all the entries
in the group (in the present version, as it happens, each end-group
has just one entry, but that may vary).

Task-number: QTBUG-90214
Pick-to: 6.0 5.15
Change-Id: I6da365a6ca558124f8275e392735071dc77e04bb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-01-27 15:00:57 +01:00
Sona Kurazyan
8f8405e046 Port QThreadPool to the new property system
Ported all properties, except activeThreadCount. Marking it dirty may
cause a re-evaluation of properties depending on it, which may reault in
a deadlock in case of trying to read activeThreadCount property which is
being marked as dirty.

Task-number: QTBUG-85520
Change-Id: Id073b0895c89a9e6b05b57ad520db994e550a1c9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-01-27 15:00:56 +01:00
Thiago Macieira
00b759a8d0 QJsonObject::take: add missing detach() call
We were modifying shared objects.

Pick-to: 6.0 5.15
Fixes: QTBUG-89625
Change-Id: Id6bc735b79cf4beb9454fffd165c56476a5dec04
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2021-01-27 05:11:39 +00:00
Sona Kurazyan
ba62256c5a Port QStandardItemModel to the new property system
Task-number: QTBUG-85520
Task-number: QTBUG-85521
Change-Id: I2f9bbe8bc06838fcbadd446e111fb697120f550c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-26 21:48:00 +01:00
Ivan Solovev
709a0942aa QTimer: port to new property system
Task-number: QTBUG-85520
Change-Id: I1f92b86619f2ca186c505251b21463f396af0ac6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-01-26 21:47:50 +01:00
Sona Kurazyan
519420641f Port QPauseAnimation to the new property system
Task-number: QTBUG-85520
Change-Id: I8c0ee86598f4c0f093f64b2891ee835a43964b84
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-26 21:47:47 +01:00
Ivan Solovev
fe7cbf8fe6 QRegularExpression: add move constructor
- Add move constructors to QRegularExpression, QRegularExpressionMatch
  and QRegularExpressionMatchIterator.
- Update the documentation to explicitly state that only destructor
  and assignment operators can be called for a moved-from object

Task-number: QTBUG-86634
Change-Id: I06b4f54e300541033a9a18339c97338717a06da0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-01-26 17:20:01 +01:00
Bastien Bouclet
b69b04c479 QIcon: Use the @nx pixmaps in the paint method
Make use of the device pixel ratio in the QIcon paint method so the @nx
hi-dpi pixmaps are selected when appropriate when painting to a
QPainter.

Pick-to: 6.0
Fixes: QTBUG-90042
Change-Id: I53995a2285ef879e3c4fddb9f8da702e256a260f
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-01-26 15:33:08 +00:00
Andrei Golubev
37e26d2b30 Extend alignment of QArrayData to std::max_align_t in allocation
Make stricter alignment requirements for the allocated header

This strict alignment allows reallocateUnaligned() to property account
for the padding occurring in cases when
alignof(QArrayData) < alignof(T) <= alignof(std::max_align_t), which
happens to be the case on e.g. 32-bit platforms with specific alignment
requirements.

This adds 4 bytes (the difference between alignof(std::max_align_t) and
sizeof(QArrayData)) of overhead for QString, QByteArray and certain QLists
on 32-bit systems.

Task-number: QTBUG-90359
Pick-to: 6.0
Change-Id: I8176a4cc79f100ee772b09425e88fe8ff3ae226a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-01-26 08:01:27 +00:00
Kai Köhne
e7c028bb9c QLocale: Allow direct conversion from language, country, and script codes
This complements patch a148c7b5d71d244, where languageToCode(),
countryToCode() scriptToCode() methods were introduced, with matching
codeToLanguage(), codeToCountry(), and codeToScript() methods.

This allows us to remove the use of private Qt Core API in Qt Linguist.

[ChangeLog][QtCore][QLocale] Added static codeToLanguage(),
codeToCountry(), codeToScript() methods that convert ISO code strings
to the respective enum values.

Change-Id: If5c0843a718c006ade086a6f74ceb86ac6e0fce4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-25 19:56:59 +01:00
Kevin Funk
80e87ca05c dbus: Fix missing QVersionNumber include
Fixes the build

Change-Id: Ie0b7a1476bb1f80ee2ccfe1cbc6ca37e9c93e758
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-25 12:09:17 +01:00
Joerg Bornemann
88e24e6a25 Remove the QT_CMAKE_BUILD preprocessor define
Qt is now always built with CMake.

The "cmake" keyword for QtTest blacklists remains for now. Removal is
tracked in QTBUG-90545.

Change-Id: I0011d56176a07c82698b2eb9aa330e77efa6cd34
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-01-22 19:22:15 +01:00
Morten Johan Sørvig
3a1773dd76 High-DPI: Test application startup with no screens
Initialize the offscreen platform plugin with no screens,
create QGuiApplication object.

Not much of the high-dpi related Qt API can be used
in this configuration, but at least Qt should not crash
on startup.

Task-number: QTBUG-71034
Change-Id: I6620843c3bd8b692c5c2419b1ba290e16175ba5b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-01-22 14:27:27 +00:00
Laszlo Agocs
df0e98d408 rhi: Pipeline cache load/save
Add QRhi APIs to retrieve and reload the contents of the "pipeline
cache".

The only API where there is a true pipeline cache is object is Vulkan
(VkPipelineCache). For OpenGL, the other backend where we support this,
it is simulated with program binaries. The Qt 5 style OpenGL program
binary disk cache continues to work like before, but one has now the
option to do things in a more modern, graphics API agnostic way, that
leads to generating a single blob instead of a large set of files in
some system location, allowing easier "pre-baking" of the cache content.

It is expected that Qt Quick exposes the two new functions in form
if QSG_RHI_ environment variables, thus allowing easy testing and
cache file generation.

As an example for the performance improvements this can give, consider
Vulkan, where we do not have any existing persistent caching mechanism
in place:

Running BenchmarkDemoQt6.exe --scene flythrough --mode demo creates 18
QRhiGraphicsPipeline objects from Qt Quick and Qt Quick 3D.

The total time spent in QRhiGraphicsPipeline::create() during application
startup for these 18 pipelines is 35-40 ms on a given Windows (NVIDIA)
system.

When exporting the pipeline cache contents to a file, and then, in a
subsequent run, reloading the cache contents, this is reduced to 5-7 ms
on the same system, meaning we get a 6-7x improvement.

The generated data is always specific to a given Qt version, RHI
backend, graphics device, and driver version. Much of the implementation
consists of adding and verifying the appropriate header to the blobs
retrieved from the driver, to allow gracefully ignoring data that was
generated with a device or driver that differs from the one used at
run time. This should provide robustness, even if the Vulkan or OpenGL
implementation is for some reason not prepared to identity and reject
incompatible cache/program blobs.

Fixes: QTBUG-90398
Change-Id: I67b197f393562434f372c7b7377f638abab85cb3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-22 10:26:03 +01:00
Timur Pocheptsov
7cf8e5ada9 QSsl: add a new private API
This is an abstraction for TLS backend and its factory, preparing to transition
to plugin-based design.

Task-number: QTBUG-65922
Change-Id: Ibe810e77fd1b715a6bea66cd3f44312b015ac274
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-01-22 09:09:46 +01:00
Samuli Piippo
946facb1ae tst_qfont: expect failure on font testcase for QEMU ARMv7
FontConfig related tests fail on ARMv7 QEMU.

Task-number: QTQAINFRA-4127
Change-Id: I3202f660d12d09a65bc50747d679921b6dfa75f8
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-01-22 09:00:24 +02:00
Timur Pocheptsov
ee89f3a6e3 QSslSocket - introduce the API providing information about backends
This API gives the names of available backends and provides a basic
information about features/protocols supported by those backends.
Also, it has the 'loadBackend' functions which allow to select
a particular backend (which are becoming plugins).

At the moment, the implementation is still 'hardcoded', the
follow-up patch will allow to select different backends in runtime.

Task-number: QTBUG-65922
Change-Id: I05877de9c02857594e76b24d52e7578bdb01df69
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-01-21 23:01:33 +01:00
Laszlo Agocs
46b892c16c tst_qvulkan: Skip assumption about supportedApiVersion
...when the platform does not support Vulkan. The version is left
at the default 0 then, so checking for >= 1.0 is wrong.

This allows the test to pass with the offscreen platform plugin.

Change-Id: I5afba8f1e703e4fa0ff41da91d18f5fabfb54868
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-21 17:00:32 +01:00
Fabian Kosmale
3861ec735e QProperty: Add private isAnyBindingEvaluating function
To optimize certain operations, it can be useful to know whether we are
currently evaluating a binding. For instance, we have properties whose
storage is only alloctaed on-demand when they are set. However, we would
also allocate them if they are used in a binding context, as we would
otherwise not properly track the dependency. Using
isAnyBindingEvaluating in the getter, we can detect this
situation, and avoid the allocation if it returns false.

This API is private for now, as it exposes some internals of the
property system and should be used with care. As it needs to access the
TLS variable, it also has a non-negligible cost.

Change-Id: I373aabee644fe7020b2ffba7d6a0ad9a1e1b4ec0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-01-21 17:00:29 +01:00
Ulf Hermann
150660887f tst_qsequentialanimationgroup.cpp: Avoid some memory leaks
Change-Id: Iecedb31b6993f6771b4b7a5d2708995365b8515f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-01-21 14:40:42 +01:00
Friedemann Kleint
ad84332f2b tst_socketnotifier: Fix timeout of QTcpServer::waitForNewConnection()
The timeout defaults to 0, give it 5s.

Pick-to: 6.0
Change-Id: I975810a1ecee8bb8b3a3f143f1379a9a09589a40
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
2021-01-21 08:53:35 +00:00
Mårten Nordheim
0875626e22 Long live QNetworkInformation
The plugins are meant to indicate what they do support, meaning users of
QNetworkInformation can choose to not care about which plugin is used
and rather just request what they want.

Task-number: QTBUG-86966
Change-Id: Ie130e1791250ec2a4470e3ba7081d982654af06c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-20 16:21:28 +01:00
Friedemann Kleint
0b4717097e tst_socketnotifier/unexpectedDisconnection: Extend blacklisting to all windows versions
The test has been failing frequently, recently.

Pick-to: 6.0
Change-Id: I3ae00a64f67e4b6a0b5ade0c660805f4d12f8317
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-01-19 19:10:42 +01:00
Sophie Kums
aa09bea00c control scrolling of QTabBar using StyleHint
Mouse wheel/touchpad scroll signals sent to the tab bar trigger
cycling through the tabs. In applications where the tab bar is
close to "mouse click hotspots", the cursor may accidentally be
left over the tab bar instead of the main content of the window.
When the user wants to scroll up/down the main conten, the
scroll signals are thus sent to the tab bar and instead of
scrolling, the focus switches to another tab. This is
confusing to the user, because not only does the application
not carry out the desired action (scrolling through the main
content), it jumps to a different tab. Two common examples of
applications affected by this nuisance are Konsole and any kind
of browser (file browser or web browser), where the address bar
is right below the tab bar. Moreover, on macOS, scroll events
do not have an effect on the tab bar widget of the native UI.
Currently, the code makes use of preprocessor directives to
achieve consistent behavior on macOS (`#ifndef Q_OS_MAC`). This
patch implements the check of a StyleHint in order to determine
if scroll events on the tabbar should have an effect. This
approach is more consistent with Qt coding style than
OS-dependent preprocessor directives and, in addition, makes
the behavior configurable according to the user's preferences.

[ChangeLog][QtWidgets][QStyle] Added
SH_TabBar_AllowWheelScrolling as a style hint to enable/disable
cycling through tabs using the scroll wheel. This defaults to
true in all styles except the macOS one so there is no change in
existing behavior.

Change-Id: I99eeb5a1aab03cbc574fac7187d85a8a2d60cf34
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-01-19 19:10:41 +01:00
Sona Kurazyan
2ce94889a1 tst_QThreadPool: avoid a potential memory leaks
Don't use raw pointers when allocating memory, it won't be deleted if
the test-cases fail.

Change-Id: I212a12c988f401f97c2c92a7fae09b2aa7d913a9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-01-19 14:17:55 +01:00
Alexey Edelev
fd5006eb48 Fix qt_add_big_resources with namespace builds
Add INTERFACE_COMPILE_DEFINITIONS of Qt6::Core to generated rcc object
libraries. This propagates QT_NAMESPACE definition to the object
library.

Fixes: QTBUG-85620
Change-Id: I252d1aaee7b19a49bc321fdd271a5d85a34bf67f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-01-19 14:17:55 +01:00
Assam Boudjelthia
0392dce4f0 Android: skip tst_QFile::moveToTrash()
Android doesn't have a trash bin, so this test is not valid for that
platform.

Pick-to: 6.0
Fixes: QTBUG-89398
Change-Id: I119b25682ba18e18466b5687cae369445dc73311
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-19 13:17:55 +00:00
Laszlo Agocs
c6d6029909 Update QVulkan(Device)Functions to Vulkan 1.2
This also needs improvements to qvkgen. What we get with this patch
are the Vulkan 1.1 and 1.2 core API's additional 11 instance-level
and 30 device-level commands present in QVulkanFunctions and
QVulkanDeviceFunctions.

All of these are attempted to be resolved upon construction. When the
implementation does not return a valid function pointer for some of them
(e.g. because it is a Vulkan 1.0 instance or physical device), calling
the corresponding wrapper functions will lead to unspecified behavior.
This is in line with how QOpenGLExtraFunctions works. The simple
autotest added to exercise some Vulkan 1.1 APIs demonstrates this in
action.

The member functions in the generated qvulkan(device)functions header
and source files are ifdefed by VK_VERSION_1_{0,1,2}. This is essential
because otherwise a Qt build made on a system with Vulkan 1.2
headers would cause compilation breaks in application build environments
with Vulkan 1.0/1.1 headers when including qvulkanfunctions.h (due to
missing the 1.1/1.2 types and constants, some of which are used in the
function prototypes). In practice this should be alright - the only
caveat to keep in mind is that the Qt builds meant to be distributed
to a wide variety of systems need to be made with a sufficiently new
version of the Vulkan headers installed, just to ensure that the
1.1 and 1.2 wrapper functions are compiled into the Qt libraries.

Task-number: QTBUG-90219
Change-Id: I48360a8a2e915d2709fe82993f65e99b2ccd5d53
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-19 14:17:55 +01:00
Edward Welbourne
6ee13db700 Correct string comparison in Android's IANA ID matching code
It used QString.compare() and assumed it was returning a bool true on
equality, when it actually returns an int that compares to 0 as the
given strings compare. So it should use compare() == 0.

This fixes several of QTimeZone's blacklisted tests on Android and a
crasher, which we dodged with a QSKIP. Added an id-comparison to a
test. Gave two local variables more informative names, made an early
return into a QSKIP so it explains itself.

Fixes: QTBUG-89905
Fixes: QTBUG-69122
Fixes: QTBUG-69132
Fixes: QTBUG-87435
Pick-to: 6.0 5.15
Change-Id: Icf18ed5a810143d6e65d36e34a70e82faac10b8e
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>
2021-01-18 15:55:15 +01:00
Edward Welbourne
50c63446f5 Fix problems with offset-derived ids for QTimeZone
When creating a time-zone from a UTC+offset name that isn't known to
the system, QTimeZone (since the fix to QTBUG-77738 in 5.15.0) falls
back to constructing a suitable UTC-offset backend; however, the id of
this is not guaranteed to match the id passed in to the constructor.
In all other cases, the id of a QTimeZone does match the id passed to
its constructor.

Some utcOffsetId testcases had different id() than the id passed to
the constructor, due to mismatches where a zone was constructed using
the fall-back but the generated id included its minutes (as :00) or
omitted its seconds. The omission of seconds is clearly a bug, but we
also don't want to include :00 for seconds when it's not needed. So
change QTimeZonePrivate::isoOffsetFormat() to accept a
QTimeZone::NameType to configure how much we include in an id. Its
callers other than the relevant constructor (from offset) still get
minutes, even when :00, but will also get seconds added if that isn't
zero; and the constructor from offset now gets the short form obtained
by omitting all trailing zeros.

Since all valid whole-hour offset names that do include :00 for the
minutes field are in fact known standard offset names, the elision of
minutes will only affect zones created by ID in the case of a
whole-hour offset given without :00 minutes specifier, so these shall
necessarily in fact get the ID passed to the constructor. Creating by
UTC-offset with a name that specifies zero seconds will result in a
QTimeZone instance whose id() differs from what was passed to its
constructor (eliding the :00 seconds and potentially also minutes, if
also zero) but this should be the only case where a QTimeZone's id
doesn't match the one passed to the constructor, when constructed by
id.

Fixed inconsistency between the offset-constructor's declaration
(taking offset as int) and definition (taking qint32) in the process.
Added an id check to the utcOffsetId() testcase. Amended two tests of
offset-derived time-zones' IDs, added comments to make clear how one
of those differs from a matching standard name test and converted two
uses of QCOMPARE(, true) to QVERIFY().

[ChangeLog][QtCore][QTimeZone] QTimeZone instances created by offset
from UTC (in seconds) shall now only include minutes in their ID when
the offset is not a whole number of hours. They shall also include the
seconds in their ID when the offset is not a whole number of minutes.

Pick-to: 6.0 5.15
Task-number: QTBUG-87435
Change-Id: I610e0a78e2aca51e12bfe003497434a998e93dc7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-18 15:55:05 +01:00
Andrei Golubev
6f520abdab Add new special QObjectPrivate::{connect, disconnect} for QML
Original QML-specific connection mechanism ignores the receiver argument
and uses sender as receiver. This causes uncontrollable memory growth
in certain cases as connections on receiver persist even after receiver
is destroyed

New connect() with receiver parameter uses underlying API correctly,
disconnect is provided for the symmetry (not sure it's really needed)

Task-number: QTBUG-86368
Pick-to: 5.15 6.0
Change-Id: I4580d75b617cb2c4dfb971a4dfb8e943e325572b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-18 15:54:03 +01:00
Kai Köhne
f1465c621c QLocale: Allow direct conversion to language, country, and script codes
Currently the codes are only exposed in aggregated form, i.e. through
name(), bcp47Name(). There are use cases though where you are only
interested in either language, country, or script codes. One example
is in Qt Linguist.

This patch therefore exposes the static languageToCode(),
countryToCode(), scriptToCode() methods that were so far only available
in the private API also in the public API.

[ChangeLog][QtCore][QLocale] Added static languageToCode(),
countryToCode() scriptToCode() methods that convert enum values
to the respective ISO code strings.

Fixes: QTBUG-39542
Fixes: QTBUG-64942
Change-Id: Ib1d5c3293e2f53245ba4c1fc8159275bcb290080
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-18 15:52:31 +01:00