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>
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>
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>
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>
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>
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>
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>
This patch adds the API, with no supporting backends
Task-number: QTBUG-93848
Change-Id: I50454717f928819e1b990df91872675e842f9987
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Supported on OpenGL (and ES) 3.0+ and everywhere else.
Can also be a render target, targeting a single slice at a time.
Can be mipmapped, cannot be multisample.
Reading back a given slice from a 3D texture is left as a future
exercise, for now it is documented to be not supported.
Upload is going to be limited to one slice in one upload entry,
just like we specify one face or one miplevel for cubemap and
mipmapped textures.
This also involves some welcome hardening of how texture subresources
are described internally: as we no longer can count on a layer index
between 0..5 (as is the case with cubemaps), simply arrays with
MAX_LAYER==6 are no longer sufficient. Switch to sufficiently dynamic
data structures where applicable.
On Vulkan rendering to a slice needs Vulkan 1.1 (and 1.1 enabled on the
VkInstance).
Task-number: QTBUG-89703
Change-Id: Ide6c20124ec9201d94ffc339dd479cd1ece777b0
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
It's pointless in a fuzzer and slows down execution.
Change-Id: I0d36ed8814cf8fb332c196ea7e24eae8ee4d3c6e
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
It's pointless in a fuzzer and slows down execution.
Change-Id: I160d7fd761118f9eba9b98fc024aef293e021845
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
When the PageDown is pressed, the current's rect cannot be
used to match the item, because we don't know the size of
the rect. Move the rect by the height of the viewport, and
then move the rect upwards until it matches the
button <= viewport's bottom of the item
Fixes: QTBUG-92583
Pick-to: 6.1
Change-Id: I210edc0e8b942984f3fc20e7752c6e1315152ea1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
When changing the style of the combobox, the change will not propagate
to the internal container widget, so the changeEvent handler won't be
called. This is correct (as per QWidget::setStyle documentation).
QComboBoxPrivateContainer asks the combobox style for relevant settings,
such as the frame style, which is then used for sizing and positioning.
If the combobox's and container's settings become inconsistent, then the
combobox popup will not get the correct size and/or position.
Move some of the style-dependent changes into a separate function and
call it when the QComboBox::changeEvent handles the style change so that
both widgets have a consistent set of settings.
Add a test case that verifies that the style is asked for the relevant
setting when the style changes.
Note: QComboBox does a lot of style-dependent setup work in different
places, which is quite messy and complex. Trying to consolidate that
further breaks tests though, so this change is doing the minimum
necessary to fix the reported issue.
Pick-to: 6.1 5.15
Fixes: QTBUG-92488
Change-Id: Ia957d504b2d800add26fc0565be727b5c08a5358
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This proposal collects all the resource objects to the qt-specific
property of the static libraries. This is done to avoid littering
of other static libraries and put resource object files to the
source part of the linker line when linking the end-point
executable.
The way we link object resource libraries is changed back to the
target_link_libraries approach as we may omit using finalizers
with linkers other than ld. Users may enforce finalizers by calling
the qt6_enable_resource_objects_finalizer_mode function if need.
Refactor tests related to the static resources.
Amends ddaa7150d8
Task-number: QTBUG-93002
Change-Id: I74135e291cd82fb54d1b284b4b4a1e002b1fef98
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Only use plugin finalizer mode if qt_finalize_target is called at the
end of the user project (which we can't really check, the user has to
ensure that) or when qt_finalize_target is automatically defer-called
by CMake 3.19+ (which is done by qt_add_executable).
This removes the previous behavior of using the finalizer mode if
qt_import_plugins is called. Instead the old regular mode is used
if the above preconditions are not met.
The removed behavior had ordering issues if qt_import_plugins was called
before target_link_libraries. The dependency walking would be done
before Qt dependencies were added and thus no plugins would be
linked.
Amends 6fcc272ac9
Task-number: QTBUG-80863
Task-number: QTBUG-92933
Task-number: QTBUG-94030
Change-Id: I78702b653a35596f5581c2f4282b2336f0124e60
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
It's possible that Qt is built with OpenSSL and some other backend.
The ifdefs generated are not mutually exclusive anymore, as it was
in the past. So tests should rely on the actual backend they have
working at runtime.
In the process of fixing the auto-tests, modernized feature #if-ery and
some associated compilation issues.
Fixes: QTBUG-92875
Change-Id: I2be1b924d506fd36dc4e2c6c9158b5023ff87f32
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This replaces QtAndroidPrivate::runOnAndroidThread{Sync} calls.
This also now allows passing std::function<> that can return values,
and not only an std::function<void()>.
This adds some tests for this calls as well.
Fixes: QTBUG-90501
Change-Id: I138d2aae64be17347f7ff712d8a86edb49ea8350
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Add NEON for RGB32 and RGBA64 writeback, and SSE2 for
RGBA64 writeback.
Change-Id: Id9ee803267a78f5bdff5beaa719e7a59c1dbb9fb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Useful for some HDR representations and HDR rendering.
Change-Id: If6e8a661faa3d2afdf17b6ed4d8ff5c5b2aeb30e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
When adding an offset from UTC, arithmetic may overflow. Likewise
when combining a date and time (that have been offset for UTC). Also
check the return from epochMSecsToLocalTime(), as it can fail; and pay
attention to the status stored by setDateTime(), to notice when it
hits an overflow. Fixed some tests that only passed because we
neglected these checks. Extended a test to check we detect overflow in
a couple of cases close to the extremes.
Change-Id: I127a670302f94a07bb9b087b1b9c608b7c08785c
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QDateTime has long followed a convention of ignoring what it knows
about time-zone transitions before the epoch. This produces unhelpful
artefacts (such as an ahistorical spring-forward skipping the first
hour of 1970 in Europe/London, which was in permanent DST at the time)
and complicates the code. It documented that DST transitions were
ignored, but in fact ignored all transitions prior to 1970 and simply
assumed that the current time-zone properties (half a century later)
applied to all times before 1970.
This appears to be based on the fact that the MS APIs using time_t all
limit their range to after 1970. Given that we have to resort to
"other means" to deal with times after the end of time_t, when it's
only 32-bit (and after year 3000, on MS systems), we have the means in
place to handle times outside the range supported by the system APIs,
so have no need to mimic this restriction. (Those means are not as
robust as we might want, but they are less bad than assuming that the
present zone properites were always in effect prior to 1970.) On
macOS, the time_t functions only reach back to the start of 1900; it
reaches to the end of its time_t range and Linux covers the whole
range. Given this variety, the range is now auto-detected the first
time it is needed (based on some quick and dirty heuristics).
Various CET-specific tests now need adjustments in tests of times
before the introduction of time-zones (when they are in fact on LMT,
not CET). The systemZone() test of QTimeZone can now restore its
pre-zone test cases. Various comments on tests needed updates.
[ChangeLog][QtCore][QDateTime] Available time-zone information is now
used to its full extent, where previously QDateTime used LocalTime's
current standard time for all dates before 1970. Where we have
time-zone information, it is considered reliable, so we use it. This
changes the "best efforts" used for times outside the range supported
by the system APIs, in most cases giving less misleading results.
Fixes: QTBUG-80421
Change-Id: I7b1df7622dd9be244b0238ed9c08845fb5b32215
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Output object name and class in QCOMPARE(). This should help
to debug flaky QWidget tests that for example check on focusWidget().
[ChangeLog][QtTestLib] QCOMPARE() now reports QObject * values by class and objectName().
Task-number: QTBUG-64446
Change-Id: Ife04e89bba04fc78d077c8f0f07af17a17c9cf8c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
QNetworkInterface reports as up and running an interface,
seemingly having a valid IP address which actually has
not IPv4/IPv6 configured at all (this is what getifaddrs
gives us).
Change-Id: I5808d5dfdbc54004a1e02b791917e9b2ba62905f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
There were two problems here: first, qHash(std::pair) must be declared
before qHashMulti that might call back to qHash(std::pair) (i.e., a pair
with one element that is also a pair). But moving the declaration above
causes the second problem: the noexcept expression can't refer to qHash
functions that aren't declared yet. So we forward-declare a constexpr
function for that result, but implement it far below.
Fixes: QTBUG-92910
Change-Id: Ia8e48103a54446509e3bfffd16767ed2e29b026c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Commit 37e0953613 added a to-do, but we
can actually change the type, since we've documented since Qt 5.10 that
setting a non-zero value (aside from -1) with qSetGlobalQHashSeed was
not allowed. Storing a value to be reset later is simply not supported.
Change-Id: Id2983978ad544ff79911fffd1671f7b5de284bab
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
It is now possible to call qt_add_big_resources with multiple .qrc files
that are in different directories but have the same file name.
Before, this resulted in target name conflict errors.
Pick-to: 6.1
Fixes: QTBUG-93230
Change-Id: Ic3d9d6974a107163aeb7ada0b6f1fa113fb18de0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
For some reason the test case was (no longer?) detected by moc
Change-Id: I20f20de76479f7d9db43fae985cefe0869a7e203
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The existing conversions weren't handling gamma correctly and used
an ad-hoc definition of gray instead of based on true luminance.
[ChangeLog][QtGui] RGB conversions to grayscale formats are now
gamma-corrected and produce color-space luminance values
Change-Id: I88ab870c8f5e502ddb053e6a14a75102239a26f2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The check is over-arching. is_move_constructible is sufficient;
we don't have to support "ridiculous" types that are copiable but
have deleted move operations (such types are fundamentally broken).
This is in line with the Move* (legacy) named requirements.
Change-Id: Idc7116b39013501b9be39628a4e7afd35fe15530
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
To see if a certain method is supported. To be used in an upcoming patch.
Change-Id: I1a5c2f655585331820701bb54f6991b4aba38273
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The qt6_add_big_resources command was dysfunctional whenever AUTOMOC was
enabled for a target.
We passed multiple object files with the --temp argument of the second
pass of rcc. We must pass exactly one. The spurious object file was the
one that's created by AUTOMOC. Turn off all of AUTOGEN for the C++
source file that's generated in the first pass of rcc.
Enable AUTOMOC for tests/auto/cmake/test_add_big_resource to cover this
situation.
Pick-to: 6.1
Fixes: QTBUG-85051
Change-Id: I6d2ce4953297db0751913456db0a4a126fe33f14
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
It's very likely that we'll have to run certain finalizer code for
targets other than executables.
Rename qt_finalize_executable to _qt_internal_finalize_executable so
it's internal.
Introduce a new function qt_finalize_target which will call the above
internal one when the target is an executable.
This should future proof the API so we have a hook to call code for
any user CMake project that intends to use Qt CMake API.
Change-Id: I03f6f4dcba22461351c247a20241ca7de1a59c1d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
In QFileSystemModel, in some cases the hostname in a UNC path is
converted to lower case and stored in the root node's visibleChildren.
When QFileSystemModel sets the UNC path as the root path, it tries to
get the row number for the host, but it didn't convert the hostname to
lower case before getting the row number, which resulted in the host
not found in the root node's visible children. As a result, it returns
-1, an invalid row number. Change the behavior to find the node for the
host using the host name case-insensitive and then get the row number.
Fixes: QTBUG-71701
Pick-to: 5.15 6.0 6.1
Change-Id: Ib95c7b6d2bc22fd82f2789b7004b6fc82dfcb13b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
There was previously no way to compare QByteArrayView to with another
QByteArrayView case-insensitively without allocating memory.
[ChangeLog][QtCore][QByteArrayView] Added compare(), enabling case
sensitive and insensitive comparison with other QByteArrayViews.
Change-Id: I7582cc414563ddbde26da35a568421edcc649f93
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Allow linking all plugin initializer object libraries directly
into the final target (executable or shared library).
The finalizer mode is triggered when the project adds a call
to qt_import_plugins, as well when the project has an explicit
call to qt_finalize_executable or when it is defer called by
CMake 3.19+.
Otherwise the old non-finalizer mode is used, where each plugin
initializer object library is propagated via the usage
requirements of its associated module.
A user can explicitly opt in or out of the new mode by calling
qt_enable_import_plugins_finalizer_mode(target TRUE/FALSE)
The implementation, at configure time, recursively collects all
dependencies of the target to extract a list of used Qt modules.
From each module we extract its list of associated plugins and
their genex conditions. These genexes are used to conditionally
link the plugins and the initializers.
Renamed QT_PLUGINS property to _qt_plugins, so we can safely query the
property even on INTERFACE libraries with lower CMake versions.
QT_PLUGINS is kept for backwards compatibility with projects already
using it, but should be removed in Qt 7.
The upside of the finalizer mode is that it avoids creating link
cycles (e.g. Gui -> SvgPlugin -> Gui case) which causes CMake to
duplicate the library on the link line, slowing down link time as well
as possibly breaking link order dependencies.
The downside is that finalizer mode can't cope with generator
expressions at the moment. So if a Qt module target is wrapped in a
generator expression, it's plugins will not be detected and thus
linked.
Task-number: QTBUG-80863
Task-number: QTBUG-92933
Change-Id: Ic40c8ae5807a154ed18fcac18b25f00864c8f143
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
After commit 3966b571 the function was kinda broken already, though
this got unnoticed since it was not covered by an the auto-test.
This commit adds another test case with Windows native separators
and removes the use of QDir::fromNativeSeparators. Instead use the
original code from QDir::fromNativeSeparators to replace the backslashes.
Pick-to: 5.15 6.0 6.1
Change-Id: I190560d0e75cb8c177d63b142aa4be5b01498da2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Normally we only allow creating wrappers for texture objects. These
can then be used with a QRhiTextureRenderTarget to allow rendering into
an externally created texture.
With OpenGL (ES), there are additional, special cases, especially on
embedded. Consider EGLImages for example. An EGLImageKHR can be bound to
a renderbuffer object (glEGLImageTargetRenderbufferStorageOES), which
can then be associated with a framebuffer object to allow rendering into
the external buffer represented by the EGLImage. To implement the same
via QRhi one needs a way to create a wrapping QRhiRenderBuffer for the
native OpenGL renderbuffer object.
Here we add a createFrom() to QRhiRenderBuffer, while providing a dummy,
default implementation. The only real implementation is in the OpenGL
backend, which simply takes a renderbuffer id, without taking ownership.
Task-number: QTBUG-92116
Change-Id: I4e68e665fb35a7d7803b7780db901c8bed5740e2
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Mostly for testing QLatin1String::indexOf optimizations in the next
patch but useful in general
Change-Id: I85bf76f3e1d5abb994fd12907db2f2a723a8d330
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The BASE argument of qt_add_resources now denotes the root point of the
alias of the file. Before, BASE was merely prepended to every file that
got passed to qt_add_resources.
Old behavior:
qt_add_resources(app "images"
PREFIX "/"
BASE "../shared"
FILES "images/button.png")
Alias is "../shared/images/button.png", and pro2cmake generated
QT_RESOURCE_ALIAS assignments to fix this.
New behavior:
qt_add_resources(app "images"
PREFIX "/"
BASE "../shared"
FILES "../shared/images/button.png")
The alias is "images/button.png". No extra QT_RESOURCE_ALIAS assignment
is needed.
The new behavior is in effect for user projects and for Qt repositories
that define QT_USE_FIXED_QT_ADD_RESOURCE_BASE. Qt repositories will be
ported one by one to this new behavior. Then the old code path can be
removed.
Pick-to: 6.1
Task-number: QTBUG-86726
Change-Id: Ib895edd4df8e97b54badadd9a1c34408beff131f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>