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>
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>
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>
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>
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>
With the updated QEMU and toolchain, these tests now pass.
Change-Id: Icb74562a0e6422cd4564f63db991aa431e0e3119
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
...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>
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>
The timeout defaults to 0, give it 5s.
Pick-to: 6.0
Change-Id: I975810a1ecee8bb8b3a3f143f1379a9a09589a40
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
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>
The test has been failing frequently, recently.
Pick-to: 6.0
Change-Id: I3ae00a64f67e4b6a0b5ade0c660805f4d12f8317
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
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>
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>
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>
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>
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>
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>
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>
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>
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>