We only use monotonic clocks now (std::chrono::steady_clock). This
probably didn't work very well anyway.
Change-Id: Ieec322d73c1e40ad95c8fffd17465f06b5b2816f
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This removes all uses of QDeadlineTimer::t2 member in the .cpp (so it
gets marked [[maybe_unused]]) and greatly simplifies the code.
Change-Id: Ieec322d73c1e40ad95c8fffd17465bd50c1113ea
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
You can't partially specialize a template function, so these
specializations for steady_clock only worked if the Duration parameter
was nanoseconds. This could have been solved with function overloads
instead, but I find the if constexpr code simpler to read.
Pick-to: 6.5
Change-Id: Ieec322d73c1e40ad95c8fffd17468bd73fc2fe24
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This matches the work that was done for QElapsedTimer. The
QDeadlineTimer::t2 member is now always 0.
This also removes the last distinction of timer types. Originally I had
intended to use CLOCK_MONOTONIC_COARSE on Linux[1], but that created
more problems than was worth, so I abandoned the idea in 2016.
[1] https://codereview.qt-project.org/c/qt/qtbase/+/159933
Change-Id: Ieec322d73c1e40ad95c8fffd17468b313798ef79
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This commit deletes the direct, low-level functionality that
QElapsedTimer has carried since it was introduced. Everything now uses
only std::chrono::steady_clock and std::chrono::nanoseconds.
QDeadlineTimer temporarily still uses qt_gettime(), which is moved to
qcore_unix.cpp.
Task-number: QTBUG-110059
Change-Id: Ieec322d73c1e40ad95c8fffd174641a469b1eee5
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We don't need to hand-roll our own conversions when QDeadlineTimer can
convert to the time points of any std::chrono clock. In particular, if
the clock we ask for is the clock its internal representation is already
storing, then it's more efficient too.
Change-Id: Ieec322d73c1e40ad95c8fffd174689a171cb6f18
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This actually saves two clock_gettime(CLOCK_MONOTONIC) system calls
(albeit to the vDSO): one inside QDeadlineTimer::remainingTimeNSecs() to
calculate the remaining time from the deadline, then one other inside
pthread_cond_timedwait_relative_np() to calculate the deadline from the
timeout, so it can place the FUTEX_WAIT_BITSET system call.
In fact, I can't find __pthread_cond_timedwait_relative() in the Bionic
source any more. The last reference was removed in 2015, when Bionic
started using FUTEX_WAIT_BITSET. So this commit is just removing dead
code in current Android.
Pick-to: 6.5
Change-Id: Ieec322d73c1e40ad95c8fffd174689c4fcff40ae
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This avoids creating and destroying the pthread_condattr_t on systems
without a monotonic clock (INTEGRITY) or for which we can't ask that
pthread_cond_t use it (Darwin).
Change-Id: Ieec322d73c1e40ad95c8fffd1746878316ab8708
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Old versions of the Apple operating systems did not implement the POSIX
realtime monotonic clock, so we used the Mach absolute timer. The LLVM
libc++ implementation[1] unconditionally uses CLOCK_MONOTONIC_RAW on
these OSes:
* macOS >= 10.12
* iPhoneOS >= 10.0
* tvOS >= 10.0
* watchOS >= 3.0
Qt 6 doesn't support the latter two and the former two are much older
than what we require, so we can use this functionality too.
[1] https://github.com/llvm/llvm-project/blob/main/libcxx/src/chrono.cpp
Change-Id: Ieec322d73c1e40ad95c8fffd174641c723b81be2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Modeled after Metal's cb.GPUStart/EndTime. Implemented with timestamp
queries for other APIs.
Implemented for Metal, D3D11, Vulkan for now. No more callback, just
a getter on the command buffer which returns the latest known value,
referring to some previous frame. This makes it a lot more usable
than the original solution that is not really used anywhere at
the moment.
Now works for offscreen "frames" as well, this was not implemented
before.
Opt in with a new QRhi::create() flag because we cannot tell in
advance if the getter will be called or not, and this way we can
skip recording the timestamps by default. The cost is probably
minimal, though. Qt Quick will set this automatically when running
with QSG_RHI_PROFILE=1.
Change-Id: I903779984a4e0bbf1d03806d04bf61571ce23d72
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
...even when the QRhi is already gone. This should not happen in
well-written applications and libraries, but we handle this
gracefully in the regular dtor and destroy() for resources that
register themselves to their creator QRhi, so by registering
everything we can offer this to all QRhiResource subclasses.
We still want to differentiate between native resource owning
QRhiResources and others (that do not create native graphics
objects), so do this via a flag passed to registerResource().
This way the behavior with QT_RHI_LEAK_CHECK=1 does not change.
Pick-to: 6.5
Fixes: QTBUG-112914
Change-Id: I9bafc81ef7a4ae76f356fc5f6248628d1f8791e0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
The makes sure that the scale factor used by the style
is identical to the scale factor used by Qt Gui, by for
instance taking scale factor rounding into account.
Task-id: QTBUG-109715
Change-Id: Ia0354a7ce0f51eb9fd5f2591ee6c4057291943f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The custom dialog-deleting lambda in QFileDialog::saveFileContent
is redundant
Change-Id: I03c2fa29ab0502b981460e34674a40a704a22e2d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
- handle only winrt::hresult_error exceptions, as this is the only
reported cases, so we don't need ellipsis there
- print relevant warnings
Pick-to: 6.5
Change-Id: Ibf18a7eab7862e2c20f5729545387ddc7ca42952
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Depending on the corner that the size grip lives in, the style sheet
style rotates the painter before rendering the drawable. However, that
needs to be done around the center of the size grip, not around the
origin, as otherwise the image rotates out of the rect.
Use a static array to map the corner to the rotation value, and
translate/rotate/translate back only if there is a rotation.
Pick-to: 6.5
Fixes: QTBUG-112252
Change-Id: I59f69385bd6699ecc8db46390c5f7cc933574ce8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Avoid capturing the same property multiple times in a binding by
storing them in the BindingEvaluationState. We store them in a
QVarLengthArray array, as the number of properties involved in a binding
is expected to be rather low, so a linear scan is fine.
Avoiding double capture is a good idea in general, as we would otherwise
needlessly reevaluate bindings multiple times, and also needlessly
allocate memory for further observers, instead of using a binding's
inline observer array.
Even more importantantly, our notification code makes assumptions that
notify will visit bindings only exactly once. Not upholding that
invariant leads to memory corruption and subsequent crashes, as
observers allocated by the binding would get freed, even though we would
still access them later.
Fixes: QTBUG-112822
Pick-to: 6.5 6.2
Change-Id: Icdc1f43fe554df6fa69e881872b2c429d5fa0bbc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
If the QOpenGLFramebufferObject (which owns the OpenGL texture object)
is destroyed, the wrapper QRhiTexture must be destroyed too.
This surfaced with WebAssembly for some reason, likely due to an event
(most likely resize) sending pattern that is different from other
platforms. Sending more resizes likely triggers another recreateFbos()
call which, until now, did not correctly dropped the wrapper
QRhiTextures so those continued to refer to the now-destroyed texture
IDs.
Pick-to: 6.5 6.4
Task-number: QTBUG-111304
Change-Id: Ieed9a11c5c28da0fee497107ebe88da9eb5f45a8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
...in paintGL. There is nothing saying the current
program (or other state) cannot change between
paintGL calls (or initializeGL and paintGL calls).
Correctly call program.bind(). This eliminates the
WebGL warning with WebAssembly.
Pick-to: 6.5 6.4
Task-number: QTBUG-111304
Change-Id: I19792f5f193dcdb305473a939780df33deb1f8e1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The module information .json gained a "plugin_types" key in 6.5.0.
Unfortunately, this contained the "sanitized" version of plugin types,
meaning dashes converted to underscores. For plugin types that contain
dashes, e.g. wayland-decoration-client, the file contained
wayland_decoration_client, which doesn't match its plugin directory
name.
Since "unsanitizing" plugin names is hard and "sanitizing" is easy, we
now store the unsanitized plugin names and burden the consumer of the
module .json files with the sanitation task.
[ChangeLog][CMake] The module information JSON files now contain the
unsanitized plugin types of a module, e.g. wayland-decoration-client
instead of wayland_decoration_client. Consumers of the module
information file must sanitize plugin types themselves if necessary.
Pick-to: 6.5
Fixes: QTBUG-112872
Change-Id: I09cc9406b360779087086707abee3d5219a24452
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QIOSTracker registers itself as handlers for system notifications about
changes of the screen environment. If no QIOSIntegration instance
exists, newly detected screens are not added to the list of known
screens (see screenConnected()). This, in turn, will result in a crash
if a screen is disconnected and removed in screenDisconnected() as it
is not known to qtPlatformScreenFor() and the function returns a
nullptr.
Consider the QIOSIntegration also whenever a screen is "changed". This
is more of a safety measure do avoid crashes for unknown screens.
This situation occurs if an iOS device is used to mirror the display
via AirPlay and no actual QGuiApplication exists, e.g. Qt is only
embedded in a Framework.
Pick-to: 6.5 6.2
Fixes: QTBUG-106701
Change-Id: Id778fc5afa7c284b0536ee02b1ba2c10321cc5b1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de>
Setting up the args and types arrays is cumbersome and error prone, and
we do it at least twice in qtbase. Provide a central implementation as a
variadic template function, and make it exception-safe with a unique_ptr
(the destructor of QMetaCallEvent will destroy the cloned arguments).
Change-Id: I5ff400467928446264eaedddb394691e9e23d22e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In the previous patch, I did not account for how we usually use the
qt-internal-configure-test.bat in our CI. This should be a more robust
script, where we search for the source path, -S <PATH>, make it native,
and put it back.
Amend 389b3a131a
Pick-to: 6.5
Change-Id: Ic59de2eb1e6720de150a9e15a4b38fae4d871815
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
If RESOURCES contained a non-existent .qrc file, qmake produced
Makefiles that resulted in an infinite loop when running GNU Make.
Introduce a new extra compiler CONFIG value "remove_no_exist" that
removes non-existent extra compiler input. This value is now used in the
extra compiler that handles the RESOURCES variable.
The difference to the existing CONFIG value "ignore_no_exist" is that
qmake still prints a warning about the non-existent file.
Pick-to: 6.5
Fixes: QTBUG-112743
Change-Id: I3293af75b75f217e1a1738b49da0af1117cfdecb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The MinGW runtimes were imported through the PATH, which creates
mismatches with the expected libraries that are installed directly
through Qt. Check if those can be used instead, and issue a warning
(and default to PATH) if not.
Fixes: QTBUG-112448
Pick-to: 6.5
Change-Id: I061baabb6d6188bd0817b68c39a5d9f04ff391b5
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
There's no 2nd translate() method. Instead, link to the section about
I18N in the summary.
Pick-to: 6.5
Change-Id: I7c3177cee91eeb550eb24b6f272a175b5c0e5487
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
As usual this is only doing anything when launched with
QSG_RHI_PROFILE=1. Otherwise the debugMark* functions are
no-ops.
Uses the old PIX API (pix.h) since that is what is available in the
Windows SDK. This works well with RenderDoc. The strings show up
in PIX captures as well although that will warn that the pix.h stuff
is deprecated. Unfortunately using the PIX3 API involves headers and
libraries not part of the Windows SDK so we do not want to open that
can of worms now.
Problem is, pix.h may not be present in some SDKs as shown in the CI.
So use __has_include and lose the whole feature if the header is not
present at build time.
Change-Id: I8606d151f75a492071bf0c8d98b16026ff94d45c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Task-number: QTBUG-109779
Pick-to: 6.5
Change-Id: I21ecd4910ba3d699e44d9ea922093e98e0b8a335
Reviewed-by: Inho Lee <inho.lee@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
qtconfigmacros:
Otherwise we'd need to include <QtCore/qassert.h> before using
QT_REQUIRE_CONFIG. It cannot be added here as qassert.h itself uses
QT_CONFIG, i.e. qassert.h needs to include this header. And
Q_STATIC_ASSERT_X is only kept around to keep old code working.
_Static_assert is deprecated in C23:
https://en.cppreference.com/w/c/language/_Static_assert
Change-Id: Ie60a02274cc5be8bd1c6dc3819ccfbc2e7864a21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Although undocumented (which is weird, as other docs refer to it),
fix the spelling and the formatting.
Change-Id: Ief8b04e3b9272386c663c463c3659e8b837260f5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Fixes compiler warnings about narrowing conversions.
Found by compiling with clang and -Wshorten-64-to-32.
Drive-by changes:
- use range-for instead of an iterator based loop
- use strlen("*.") instead of magic number 2
Pick-to: 6.5
Task-number: QTBUG-102461
Change-Id: I0bf2299049c0411ed496468238ca30b69946ffc2
Reviewed-by: David Faure <david.faure@kdab.com>
The previous patch for QTBUG-112019 could lead to an uneven length which
in results in an incorrect center. Fix it by making sure that the length
(and width) of the two rectangles are even so we always get a proper
center without fiddling around with float values. Also honor
PM_ButtonShiftHorizontal/Vertical now (was forgotten in the last patch).
Pick-to: 6.5
Fixes: QTBUG-112019
Fixes: QTBUG-112861
Change-Id: Ifc19b863c761ae545208b996ba60d1f33bceb2b3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Similar to TableScope - create a helper class to make sure the
procedures are cleaned up on exit so they don't affect the result during
the next test run.
Change-Id: Ic5b02ca63e03f330392797ed22313767557fc548
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Accessibility actually works when running applications as root, but we
would never properly connect, since the enabledChanged signal would be
emitted from the constructor in this case. So after connecting the
signal, check the value by hand to make sure not to miss the
notification.
Only applications running as root would be affected, because all other
applications would go through the asynchronous pattern of getting the
bus address from dbus instead.
[ChangeLog][QtGui][Accessibility] On XCB applications running as root are
now accessible.
Pick-to: 6.5
Fixes: QTBUG-43674
Change-Id: I82cdc35f00693a8366dfcdab2f2c3c6dc5f5b783
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Some Windows SDKs seem to throw an exception from winrt::check_hresult()
We need to handle this accordingly. Catch the exception and print relevant warning.
Fixes: QTBUG-110408
Pick-to: 6.5
Change-Id: I1434ec425f0d0e597308b53f25f4f15049640060
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Equivalent to the test added to the QWidget test case, but since QtWidgets
code contains logic to both synthesize and compress/filter enter/leave
events, we can only verify that the QWindow does get the events.
The test is very flaky on Windows, so blacklisting it right away.
Change-Id: Ic1da9439f60f619a76a3653a23fef8e9ebc0e75d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Avoid some code duplication and enhance the documentation about
thread-safeness of QSQLDatabase::cloneDatabase()
Fixes: QTBUG-60505
Change-Id: I6ca6b9f47d818d49ca51395da14051e40317cef6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Temporary exclude `qwaitcondition_unix.cpp` from the unity build, until
either of the mentioned change sets get merged.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Iaacd090647ba007e0ab714dc674e67552f85c350
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Like qt-configure-module.bat, when building with unity build, CMake
needs to know the full path of the source directory to be able to
correctly generate its `*_cxx.cxx` files. So far, this seems to only
affect Windows' LLVM/MinGW builds. By this patch, I make sure that we
pass the full path to CMake.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ida2da127ecba95856b6e0091936c471c2a116936
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>