Commit Graph

61018 Commits

Author SHA1 Message Date
Thiago Macieira
5c95cb8722 tst_QDeadlineTimer: use std::chrono_literals
For greater readability.

Pick-to: 6.5
Change-Id: Ieec322d73c1e40ad95c8fffd17468e0c737bec0e
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-18 19:23:43 -03:00
Thiago Macieira
13c3558fe9 tst_QDeadlineTimer: use the new QCOMPARE_xx() macros
Pick-to: 6.5
Change-Id: Ieec322d73c1e40ad95c8fffd17468cb805546aea
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-18 19:23:43 -03:00
Thiago Macieira
c9f4c0d45e QElapsedTimer: rewrite using std::chrono::steady_clock everywhere
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>
2023-04-18 19:23:42 -03:00
Thiago Macieira
13f0ee021e QWaitCondition/Unix: sort and organize includes
Change-Id: Idd5e1bb52be047d7b4fffffd174ea54b8e954387
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-18 19:23:42 -03:00
Thiago Macieira
eac30fcb82 QWaitCondition/Unix: use QDeadlineTimer's <chrono> support
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>
2023-04-18 15:23:41 -07:00
Thiago Macieira
2a997942db QWaitCondition/Android: remove support for relative time waits
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>
2023-04-18 19:23:40 -03:00
Thiago Macieira
ccd3f2369a QWaitCondition/Unix: Modernize the call to pthread_condattr_setclock
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>
2023-04-18 19:23:40 -03:00
Thiago Macieira
840af18b8d QElapsedTimer/Darwin: merge with the Unix implementation
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>
2023-04-18 19:23:39 -03:00
Andreas Eliasson
4c34894075 Doc: Fix typo
It should read ISO-8859-1, not IS0-5589-1.

Fixes: QTBUG-112735
Pick-to: 6.5 6.2 5.15
Change-Id: I8247264d39f2af5b2f9699564cdd576df65cd9b8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-04-18 13:39:26 +00:00
Laszlo Agocs
e539e9a7af rhi: Replace the temporary GPU time query API with a saner one
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>
2023-04-18 15:35:28 +02:00
Laszlo Agocs
62a4ca773a rhi: Make it safe to always call deleteLater on a resource
...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>
2023-04-18 14:42:45 +02:00
Morten Sørvig
e3c9dce0b6 Use QHighDpiScaling when determining scale factor
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>
2023-04-18 12:42:45 +00:00
Mikolaj Boc
020f03c47e FileDialog: Use well-known DeleteOnClose instead of custom lambda
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>
2023-04-18 13:39:20 +02:00
Vladimir Belyavsky
f6908c4f71 QNetworkInformation[Win]: Improve WinRT exceptions handling
- 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>
2023-04-18 11:39:20 +00:00
Volker Hilsheimer
ca978e2c12 QStyleSheet: rotate QSizeGrip image around center
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>
2023-04-18 13:23:48 +02:00
Fabian Kosmale
cb30e45b9a Avoid capturing same property twice
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>
2023-04-18 13:23:48 +02:00
Laszlo Agocs
2b908ba8f4 QOpenGLWidget: correct the lifetime of the wrapper texture objects
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>
2023-04-18 13:23:48 +02:00
Laszlo Agocs
99c8eca3f4 cube example: make sure the program is bound
...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>
2023-04-18 13:23:48 +02:00
Laszlo Agocs
1645ce9a4a rhi: Fix offscreen manual test's Vulkan init
Pick-to: 6.5
Change-Id: Iaf7da78fd0c1c1265b05bfd4c7ced5d94ae963fe
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-04-18 13:23:48 +02:00
Joerg Bornemann
24fe86ebe7 CMake: Store unsanitized plugin type names in module .json files
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>
2023-04-18 09:29:33 +02:00
Jan Moeller
ffdfafc4b4 Ignore removed/changed screens if no QIOSIntegration instance exists
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>
2023-04-18 09:22:46 +02:00
Volker Hilsheimer
c4449c040c Add helper template for metacall event creation
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>
2023-04-18 00:11:13 +02:00
Christian Ehrlicher
db7dc35897 SQL: replace qPrintable() / toLocal8Bit() with unicode versions
Replace qPrintable() and toLocal8Bit() with qUtf16Printable()

Change-Id: Id30b5ba611b005faab91a08b10a9dc5569fd7a07
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-18 00:11:05 +02:00
Volker Hilsheimer
fd879a38cc Fix another warning when comparing size_t and qsizetype
Amends 07f7ed2bad.

Change-Id: I0644e47e8e9ccd0bcaf074adf99e7481c692b5c1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-04-18 00:10:56 +02:00
Amir Masoud Abdol
bafe9dfc61 Pass native path in qt-internal-configure-tests
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>
2023-04-17 23:32:34 +02:00
Yuhang Zhao
97ee38eb52 SQL plugins: add mimer to the help text
Change-Id: Icd080131924ad1e3fb42fc39327621faac0b1659
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-18 05:32:34 +08:00
Joerg Bornemann
0aa9b08536 qmake: Fix infinite make loop if RESOURCES contains nonexistent .qrc
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>
2023-04-17 23:32:34 +02:00
Friedemann Kleint
69d4ecd6ef Remove unused documentation code snippets
Modules:
- Core
- Gui
- Widgets
- Open(Widgets)
- PrintSupport
- Sql
- Network
- Concurrent
- Testlib

Pick-to: 6.5
Change-Id: I63e58c01bec4bd162486020f0085227fdaa83b18
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-17 21:02:32 +02:00
Timothée Keller
94279afff8 Windeployqt: change MinGW dll's import location
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>
2023-04-17 16:24:59 +02:00
Kai Köhne
a03fdd65ee Doc: Fix dead link in QCA::translate()
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>
2023-04-17 16:23:24 +02:00
Laszlo Agocs
5f3c3044a5 rhi: d3d12: Implement debug markers
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>
2023-04-17 16:06:17 +02:00
Liang Qi
14feb6792e tests: blacklist tst_QGraphicsEffect::draw() on Wayland
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>
2023-04-17 16:05:24 +02:00
Ahmad Samir
044a29bc66 corelib/global/*.h: use static_assert instead of Q_STATIC_ASSERT_X
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>
2023-04-16 22:17:51 +02:00
Giuseppe D'Angelo
3b81d04bc6 QMetaType: more doc tidies for the flags
Change-Id: I354b2dc901ecb1b2baa717c74e265e9201d8e63e
Pick-to: 6.5 6.2 5.15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-16 12:00:24 +02:00
Giuseppe D'Angelo
ecfa13bdac QMetaType::IsGadget: doc tidies
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>
2023-04-16 12:00:17 +02:00
Ahmad Samir
c1e1d133c4 mimetypes/: port to qsizetype
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>
2023-04-15 17:21:10 +02:00
Christian Ehrlicher
8ca2d6ba09 CommonStyle/QSpinBox: fix rendering up/down symbols in high-dpi mode
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>
2023-04-15 13:56:27 +02:00
Christian Ehrlicher
d9bd46b2b8 SQL/Tests: make sure created procedures are cleaned up on exit
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>
2023-04-15 13:56:21 +02:00
Frederik Gladhorn
db346e711c Fix accessibility on XCB when running as root
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>
2023-04-15 05:48:27 +02:00
Vladimir Belyavsky
5564b166a3 QNetworkInformation[Win]: Catch potential WinRT exceptions
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>
2023-04-14 21:26:29 +03:00
Volker Hilsheimer
79ac430537 Test for QWindow getting enter/leave events when secondary window shows/hides
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>
2023-04-14 20:13:41 +02:00
Christian Ehrlicher
d71dc36f47 QSQLDatabase: avoid some code duplication
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>
2023-04-14 19:25:55 +02:00
Amir Masoud Abdol
6de26ae531 Exclude thread/qwaitcondition_unix.cpp from the Unity Build
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>
2023-04-14 18:34:06 +02:00
Amir Masoud Abdol
389b3a131a Add drive letter to source paths when calling qt-internal- scripts
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>
2023-04-14 18:34:05 +02:00
Amir Masoud Abdol
38d56e2b72 Add [[maybe_unused]] attribute to an unused variable
Otherwise, it could break the unity build.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ic1b3ac51b8a9e8bb93a3b1a4d6717fa45099e91b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-14 18:34:05 +02:00
Edward Welbourne
76075aa3a9 QDate: enable {start,end}OfDay() to make second-adjustments
Previously it only got the answer correct to the minute. That's good
enough for most transitions, but those involving local solar mean time
(LMT) may have second deviations. So check the second before or after,
that'll usually be the other side of the transition; if it isn't, do a
further binary chop on seconds to hit the correct value.

Most zones' canonical locations are only specified to the size of a
city, so second precision is all anyone cares about; a few hundred
metres difference in location would change that. The one exception is
Europe/Amsterdam, which had its own Royal Observatory and time
standard, hence had an offset known to greater precision; but the IANA
DB duly approximates that, too, so we won't have data with millisecond
precision even in that case, so don't try to refine beyond second.

Change-Id: I20fb355f8113c32387ed8a84fbf5a41004273978
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-04-14 13:23:50 +00:00
Edward Welbourne
b906796af6 Fix QDateTime tests in zones whose side of UTC varies
The classification of local time as ahead of UTC, behind it or equal
to it gets complicated by zones near the prime meridian - some of
which have varied which side of it they nominally are - or the
international date line, which a few zones have crossed.

So, instead of having one classifying variable, split to having three,
one for the distant past (when using local solar mean time), one for
the epoch and one for the distant future.

Change-Id: I7c0da376e1625372086dc51afa815756f0bde442
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:23:09 +02:00
Edward Welbourne
462d3547f7 Add a manual test helper script, foreachzone
This makes it possible, on a system with /usr/{lib,share}/zoneinfo/,
to systematically run a command with TZ set to each system-supported
zone. For example, it can be used to verify that a corelib/time/ test
passes regardless of the valid setting of TZ.

Change-Id: I6ea9a64d8bcb745aea80ab9ae431602d3e3265a1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:22:27 +02:00
Edward Welbourne
9f11574a7d Explain the cases where we must exclude some QDTE test cases
The stepIntoDSTGap() hour cases were already conditioned on hour > 0,
explain why. The month and year tests need similar checks for kindred
reasons; add and document those checks.

Pick-to: 6.5
Change-Id: Ibcb69449fcd572ee94306a805fd680e9b5155322
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-14 15:22:16 +02:00
Edward Welbourne
ee46c645a6 Skip some tests that fail in the Indian/Cocos timezone
The zone had a transition at the start of 1900, so QDTP's default date
ends up being 1900-01-01 at 00:02:20 instead of at 00:00:00; and any
parsing of date-time strings that doesn't set the minutes and seconds
consequently ends up "wrong" (about a field that wasn't specified).

Change-Id: If4b9864616fa08bc023a6974dae255f96ca90f83
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:21:50 +02:00