Commit Graph

60699 Commits

Author SHA1 Message Date
Piotr Wierciński
1faea46fb6 Wasm: Hide "Enable screen reader" button in QWasmWindow
For each QWasmWindow, there is "Enable screeen reader" button added
for accessibility. It's hidden visually by z-ordering behind main
QWasmWindow div.
Sometimes the content of QWasmWindow contains transparent elements
and the underlying accessibility button gets visible.
This commit introduces new CSS class which hides elements visually,
but keeps it accessible for screen readers.

Fixes: QTBUG-111896
Change-Id: I78ef5746da9e0d1584ee36dd0ca6ba476623a3de
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-03-15 09:52:04 +01:00
Ahmad Samir
5cea5fc80b QLockFile: tryLock(): use chrono first
I.e. tryLock(chrono::milliseconds) shouldn't call the int overload as
that truncates the timeout (milliseconds is typically int64_t).

Add a note to the tryLock(millisecons) docs that passing
milliseconds::max() will make it wait forever to obtain the lock.

Task-number: QTBUG-110059
Change-Id: Ib48d9b1b117ce816348625331543d6ba8a788973
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-14 22:15:35 +02:00
Axel Spoerl
425e635ecd QCompleter::setPopup() - refactor and cleanup
QCompleter::setPopup() sets window flags, focus policy, parent, focus
proxy, item delate and installs an event filter, before the popup
argument is assigned to d->popup.

In the QCompleter::eventFilter override, QObject::eventFilter is called
(under more) if d->popup is nullptr.

If a custom class is inherited from QCompleter and it overrides
QObject::eventFilter(), this causes an infinite loop.

This patch re-factors the method.
- early return is added if the new popup != d->popup
- remembering the existing widget's focus policy is constified and
  moved ahead of the delete secion.
- assignment of d->popup to popup argument is moved after the delete
  section.
- after assignment, the argument variable is no longer used.

The refactoring eliminates two issues:
- potential risk of double-installing event filter due to missing
  early return.
- inifite loop if inherited class installs another event filter.

The patch adds a test function to tst_QCompleter, which implements an
inherited class, installs an event filter on a popup and checks if a
ChildAdded event hass been recorded.

Fixes: QTBUG-111869
Pick-to: 6.5 6.2
Change-Id: I3f7a2434a11476077a5260e7686a912da9f6c60d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-03-14 21:15:31 +01:00
Piotr Wierciński
c99614711e Wasm: Add support for setOpacity() in QWasmWindow
Add support for QPlatformWindow::setOpacity() in QWasmWindow.

Change-Id: Ib54cecf1f49e3d576a386f4109b8c6df1f16f312
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-03-14 19:46:08 +01:00
Ievgenii Meshcheriakov
20668baa59 dbus examples: Update screenshots
Use WEBP format to reduce the file size.

Task-number: QTBUG-111366
Pick-to: 6.5
Change-Id: I14ff15010e7ac7e1b375eeafaa1c153b0fdd95e6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-14 19:46:08 +01:00
Morten Sørvig
2245a8dbb0 wasm: restore windowCursor nullptr check
This check was accidentally removed in commit 783b63ce.

If the cursor is null, set the default cursor.

Pick-to: 6.5 6.5.0
Change-Id: I894d5e04cd7b49041bd0d3b59fc816a8b7efffe7
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-03-14 17:37:13 +00:00
Amir Masoud Abdol
3602936230 Improve the internal handling of unity build
- Removed the NO_UNITY_BUILD argument from commands that disable it by
  default.
- Add a warning in case NO_UNITY_BUILD or NO_UNITY_BUILD_SOURCES is
  being used where it is already disabled, e.g., qt_internal_add_test
- Exclude all sources of a target from unity build if NO_UNITY_BUILD
  is set on the target. This sounds a bit harsh, but I have noticed that
  sometimes the same source file can be included somewhere else, and
  some unexpected collision may occur.
- qt_examples_build_end excludes all its examples from the unity build.
- qt_build_test now sets the CMAKE_UNITY_BUILD to OFF before configuring
  the tests, and restore its value when done.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ia42e7dd5a5bfb151db241deb639325720fd91eec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-14 17:28:44 +01:00
Amir Masoud Abdol
cfed658747 Utilize NO_UNITY_BUILD arguments instead of manual exclusion
Unity build is disabled by default for all 3rdparty libraries, so we
don't need to set the manually anymore; and for the plugins we can use
NO_UNITY_BUILD instead.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ia2f83ae083924d31adf07e7647b34ae6571ed01f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-14 17:28:44 +01:00
Amir Masoud Abdol
f4228163fb Exclude a few source files from QtCore
On macOS, if QtCore is built with unity build, tst_qmakelib will fail.
For now, we decided to exclude the qsystemerror.cpp on macOS. The
_DARWIN_C_SOURCE provides a few necessary macros on macOS. By defining
the macro we can include the qfilesystemengine_unix.cpp and
qlockfile_unix.cpp into the unity build again.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I2c8b38b0512792c21966582c33471b7ee222617a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-14 17:28:44 +01:00
Amir Masoud Abdol
3e9f2a0adb Silence an unused-parameter warning
On Windows, when using unity build, compilers insist that these are
not used, even though they are; and consequently the build fails.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I6441134db563e0553a3c9193afe2569fc2ffce85
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-14 17:28:44 +01:00
Amir Masoud Abdol
d203f82916 Fix for CMake tests when build with unity
Some of the mockplugin tests needed to be excluded from the unity build
manually. In addition, MSVC's complain about include <QtCore/QString>
instead of <QString> was addressed here since it was breaking the unity
build as well.

Some other independent executable and libraries have to be excluded
manually as well.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I1f21f8484b4d3b1c399e2118ab3a71e682a3006a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-14 17:28:43 +01:00
Amir Masoud Abdol
608c2501e5 Fix tst_qfreelist when build with unity
Previous setup of the test was failing in minimal static build if built
using the unity build because of the explicit inclusion of the qtcore
source files. In order to resolve this, I removed the inclusion of
qtcore's headers and made the test private.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Id1c7b3b65ca2078354c235a718ff3e93a65362e6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-14 17:28:43 +01:00
Amir Masoud Abdol
e512734278 Use qt_internal_add_executable in auto tests
When possible, I replaced add_executable with
qt_internal_add_executable.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I643d2e27f0d880fe9b6cec7af790e4c99227fb0c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-14 17:28:43 +01:00
Marc Mutz
3e1108aa7f tracepointgen: fix inefficient loops, add a const
Take the loop variable by cref.
Make one loop variable const that was ok to be taken by value.

Coverity-Id: 404395
Coverity-Id: 404396
Coverity-Id: 404397
Coverity-Id: 404398
Coverity-Id: 404399
Pick-to: 6.5
Change-Id: Ib90a8f12b98c892314f10a9a3cb2f3c5c19a5d78
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-03-14 15:55:48 +01:00
Marc Mutz
6fd163f627 tracegen: fix inefficient loops
Take the loop variable by cref.

Amends 83effb3a3f.

Pick-to: 6.5
Coverity-Id: 404701
Change-Id: I1266dd1feb16b3842a93169e554a6563861f5a14
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-03-14 15:55:48 +01:00
Marc Mutz
60c3aaa54f tracepointgen: fix inefficient loops
Take the loop variable by cref, avoid some QList detaching.

Coverity-Id: 404697
Coverity-Id: 404697
Coverity-Id: 404699
Coverity-Id: 404700
Pick-to: 6.5
Change-Id: I9fe7b6ad3cf87f442e6c111d6f661122ac23769c
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-03-14 15:55:47 +01:00
Alexandru Croitor
595ac662ed CMake: Pass CMAKE_EXE_LINKER_FLAGS to project-based try_compile
CMake does it for non-project-based try_compile calls if the
CMP0056 policy is set to NEW. That was introduced in CMake 3.2,
thus set it unconditionally.

The use case is to pick up custom -rpath-link paths when
cross-compiling.

Pick-to: 6.4 6.5
Change-Id: I726b90267dd46de116052b5b7f19b9354a568200
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-14 15:55:47 +01:00
Fabian Kosmale
6d054270fc QMetaType: Ensure that qfloat16 gets correct id
Code initially compiled against Qt <= 6.2 does not have a qfloat16
metatype that unconditionally gets registeret from QtBase.

Therefore, any preexisting metatype instance for qfloat16 will hit the
custom type registry code path. As builtin metatypes are not part of the
custom registry, we will create a new type-id, and the type will thus
not compare equal to new code using the builtin type-id.

Avoid this issue by inserting an alias to the type in
QMetaTypeCustomRegistry's constructor.

Change-Id: I825265ad16e274c08b2c4a3a4814475b6c6c6187
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b68ad5ef7fd8df0ef4aea03f33dfe05fd8272469)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-14 01:34:27 +00:00
Christian Heimlich
e7b8b7bfbe CMake: Add NO_COMPILER_RUNTIME to deploy script macros
Provides the NO_COMPILER_RUNTIME boolean option to
qt_deploy_runtime_dependencies() and qt_generate_deploy_app_script().

In both cases this results in using the "--no-compiler-runtime" option
of windeployqt.

The value has no effect on other platforms.

[ChangeLog][CMake] Added the option NO_COMPILER_RUNTIME to
qt_generate_deploy_app_script.

Task-number: QTBUG-111741
Pick-to: 6.5 6.5.0
Change-Id: I2e86f0959c4e1ae47b247667ace88d07e2f22271
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-13 16:31:31 -05:00
Tor Arne Vestbø
24da05f68d macOS: Remove workaround for worksWhenModal not being reevaluated
On macOS < 10.15 the worksWhenModal property of our NSWindow was read
on window initialization and propagated to the window server, but never
updated on the window server past that point, even if updating the
worksWhenModal property on the NSWindow.

Now that we no longer support macOS < 10.15, we can remove the workaround,
that was using private APIs to talk to the window server directly.

Pick-to: 6.5
Change-Id: Ide5a6d63cc471fd04748d1aa7f7915ccde2a1cdc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-13 22:26:28 +01:00
Ahmad Samir
f948835e62 QLocalTime: getCurrentStandardUtcOffset: fix narrowing warnings
UTC offset in seconds can't be bigger than 24 hours, so it should fit in
an int. Explicitly cast to int and add asserts.

Change-Id: I45460a0489a134e4ad03bdab112f067d5913709a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-13 23:26:28 +02:00
Ahmad Samir
5bffb47d6e QFSFileEngine: fix overflow bug when using lseek64
QT_LSEEK (lseek64()) returns QT_OFF_T, which is off64_t on 32bit
systems. The return from the lseek64() call was being assigned to an
int, which meant that if the returned value is > INT_MAX it will
overflow and the value becomes -1, and since errno would be EOVERFLOW
the code would fail to open the file.

Fix the issue by assigning the return value to QT_OFF_T.

Thanks to Giuseppe for pointing out the issue in the code review.

Found by compiling with -Wshorten-64-to-32.

[ChangeLog][QtCore][QFile] Fixed a bug where opening a file in append
mode may fail if the file size was bigger than INT_MAX.

Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Iad33e3192f37466643a1218d38e5ecc2baaa7dc9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-13 23:26:28 +02:00
Ahmad Samir
0d29a406f7 QThread: add sleep(std::chrono::nanoseconds) overload
All the other overloads are implemented using the new one.

Windows change relies on the pre-check in the code review making sure it
compiles.

[ChangeLog][QtCore][QThread] Added sleep(std::chrono::nanoseconds)
overload.

Task-number: QTBUG-110059
Change-Id: I9a4f4bf09041788ec9275093b6b8d0386521e286
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-13 23:26:28 +02:00
Mikolaj Boc
d7f0677368 Skip also QML tests in submodules when batching is on
This should be handled later ideally, for now we should skip and
QML tests targets are still being produced, which leads to errors
on WASM.

Task-number: QTBUG-109786
Change-Id: I3d0d1f3115e324c7a0cb036e972226310294b216
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-13 22:26:08 +01:00
Edward Welbourne
0b66d4a3d4 Don't use unnamed namespace in qlocale_p.h
Pointed out by CodeChecker. It's included by plenty of places, so
duplicating that anonymous namespace potential code duplication. Use
QtPrivate namespace instead.

Change-Id: I9ccfd569089ea01a8be9ffd87889bca73b70dd9c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-03-13 21:20:51 +00:00
Ivan Solovev
eaae969ac6 Propagate QT_DISABLE_DEPRECATED_UP_TO to QtLibraryInfo library
This helps to fix the static build, which was previously failing with
QT_DISABLE_DEPRECATED_UP_TO, because it was the only library that
did not see the definition.

Fixes: QTBUG-111884
Pick-to: 6.5 6.5.0 6.4
Change-Id: I9324019bc8cbb7ba7a87dd348ea60e25cb681005
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-03-13 22:12:38 +01:00
Assam Boudjelthia
f314e821c1 Android: skip two qrhi tests to enable Android 12 in CI
This is expected to be temporary and to be investigated afterwards.

Task-number: QTBUG-108844
Pick-to: 6.5
Change-Id: I0a571dad2b99ceaa0fd48e5cdd81057e49e55ddf
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-03-13 21:12:38 +00:00
Ivan Solovev
0ac234f9e2 Imagescaling example: fix memory leaks
* The DownloadDialog was never destroyed properly. Pass 'this' to its
  constructor to fix it.
* When re-creating an image grid layout, properly clean up old image
  labels in Images::initLayout()

Task-number: QTBUG-103514
Pick-to: 6.5 6.5.0
Change-Id: Ief52774002632d4ad3a6cca85bb0c0aa1a1d4bc0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-03-13 19:24:14 +01:00
Tor Arne Vestbø
441993a9a2 macOS: Guard text input client from destroyed QCocoaWindow
The text input system on macOS may in some cases hold references to our
QNSView, even after we've destroyed the corresponding QCocoaWindow. This
happens e.g. when using the Keyboard Viewer to input text into a dialog,
and then closing the dialog.

In this situation we get text input callbacks such as selectedRange,
attributedSubstringForProposedRange, firstRectForCharacterRange, and
need to account for the lack of a valid platform window.

This happens even if NSTextInputContext.currentInputContext has been
updated to the input context of the parent window, and even if we
explicitly deactivate the old input context and return nil for the
input context of the now QCocoaWindow-less QNSView.

We can combine this situation with the handling of a missing focus
object, so that each callback doesn't need explicit platform window
checks.

Fixes: QTBUG-106369
Fixes: QTBUG-111183
Fixes: QTBUG-105250
Pick-to: 6.5 6.2 5.15
Change-Id: I5bc1b9667376c87221fe5007db162224c022c09f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-13 15:49:37 +00:00
Mikolaj Boc
bd68df0905 Adapt qt_process_qlalr for test batching
Calling qt_process_qlalr with a skipped/batched target name results
in an error. Do the same as for other helper functions and handle
these two cases.

Task-number: QTBUG-109786
Change-Id: I774b148989a25d01bdf724e69a722aae132389ee
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-13 16:49:37 +01:00
Tor Arne Vestbø
5a9fbae0ba QMenuBar: Mark items as dirty when switching away from native menu bar
QMenuBarPrivate::updateGeometries() returns early if the native menu
bar is in use, skipping the call to calcActionRects, so the action
rects are not in sync with the actions in this mode.

When switching to non-native menu bars, we would then crash in
QMenuBar::minimumSizeHint() because we're iterating the action
rects assuming the match the actions.

To fix this we need to ensure the action rects are computed by our
call to updateGeometries() in setNativeMenuBar(), which we can do
by explicitly marking the items as dirty.

Note that it's currently not possible to switch back to the native
menu bar, as the native menu bar is populated in QMenuBar::actionEvent
via QEvent::ActionAdded, and we're not doing anything to re-add
these actions once we've recreated the native menu bar.

Fixes: QTBUG-102107
Pick-to: 6.5 6.4 6.2
Change-Id: I7cf2b25539da633727693f5894ea22ea0d0d9aa5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-03-13 16:49:37 +01:00
Mikolaj Boc
5947c07717 Do not batch standalone tests; add an option to batch them
Tests generated with qt-cmake-standalone-test will now not be
batched by default. Defining the QT_BATCH_STANDALONE_TESTS
environment variable will make the build system batch them.

Fixes: QTBUG-111226
Change-Id: I9f01c662e22f8ffdd33e1c4d82619db0689fecc7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-13 16:12:28 +01:00
Mikolaj Boc
d87ba73d48 Avoid error with test helper when test batch is missing
qt_internal_add_test_helper will fail if a test batch is missing and
batching is enabled. It will now copy to the parent binary directory
as without batching for simplicity, as this happens when batched tests
are skipped.

One consequence could be that when the first test specified has
the NO_BATCH argument, this will incorrectly install the helper, but
helpers still need extra work to function properly, so for now we just
make it compile.

Task-number: QTBUG-109786
Change-Id: Ib307ae79799422c2a4102885aa007ef043835e50
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-13 16:12:28 +01:00
Alexey Edelev
5e4f4816a8 Make sure that all dependencies are found before creating tool targets
The result of dependency lookup is not taken into account when
evaluating tool packages. Check for <ToolPackage>_FOUND before creating
the tool targets that belong to the tool package. Adjust the tool package
lookup that the dependencies always affect the lookup result even if
we avoided creating targets by setting QT_NO_CREATE_TARGETS.

Pick-to: 6.5 6.5.0
Change-Id: Ia95c9c71370becc639ed8a9db026aed2f93959b4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-13 16:12:28 +01:00
Andreas Eliasson
9f93f96394 Doc: Remove broken link to Anchor Layout Example
This example was moved to manual tests in 6.5, which broke the link.
Now that it's in manual tests, I guess we can stop promoting it.

Pick-to: 6.5 6.5.0
Change-Id: I1aa4a7de5123e96bf9ff56eeae49104acdce9645
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-03-13 08:12:01 +00:00
Thiago Macieira
e3c5ae2e38 configure: remove -c++ entry from the -help output
That's an internal option: only Qt developers are meant to ever use it,
in order to test new compilers with non-default settings. Users should
use only what the configure chooses by default.

Pick-to: 6.5
Change-Id: Ib1d2fc7100134f7597cdfffd174a2d2567222c29
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-12 21:28:24 -08:00
Ahmad Samir
fd48bcec52 QMetaEnum: fix narrowing warnings related to valueToKey*()
valueToKey*() takes an int, and QMetaEnum internally assumes the
underlying type of an enum is not bigger than int.

Using static_cast as it's easier to search for it in the codebase if
needed.

Found by compiling with -Wshorten-64-to-32.

Drive-by change: remove qdoc \fn command for qt_QMetaEnum_debugOperator,
it's an internal method and defined right under the doc block (the
signature still said "int" but it's qint64).

Change-Id: Ia6abc85173bf94c0a8c56663481d83d3a998f68d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-13 03:02:36 +02:00
Kai Köhne
d4dba80863 Fix listed files for sha3_keccak
JSON allows duplicated fields, but the last one will prevail. Therefore
move the new "comment" before the actual list of files.

Amends fa4b7495b7.

Pick-to: 6.5.0 6.5 6.4.3 6.4 6.2 5.15
Change-Id: I06874745c8c51e55d79d7a373236cc8d9151079d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-03-12 23:23:59 +00:00
Ahmad Samir
6e29632006 QString: fix a couple of integral narrowing warnings
Change-Id: Ibc193665c4fe5458a4ba84a3993dcd67a6180048
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-12 21:34:43 +02:00
Christian Ehrlicher
30de1f74de SQL/MySQL: Add support for Bit-Value Type - BIT
Add support for MYSQL_TYPE_BIT. Since the bitfield can be max 64bits,
store it in a uint64_t. Writing such a value as MYSQL_TYPE_LONGLONG
works as expected but receiving it needs a special handling.

[ChangeLog][SQL][MySQL] Added handling for Bit-Value Type - BIT.

Fixes: QTBUG-21326
Change-Id: Id20e3316caf6703b3bec8a828144494a20693fd8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-12 16:21:17 +00:00
Christian Ehrlicher
18bd15a9ea SQL/Tests: remove safeDropTable() / add helper class
Add a helper class which makes sure that the used table does not exist
before usage (e.g. due to leftovers from previous tests) and is properly
cleaned up on exit. This also allows to remove all usages of
safeDropTable().

Change-Id: Iefeffbd10e2f2f67985183ea822d7b6dd2b80be7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-12 17:21:17 +01:00
Christian Ehrlicher
f19320748d SQL/ODBC: add another check to detect unicode availability in driver
Since ODBC does not have a direct way finding out if unicode is
supported by the underlying driver the ODBC plugin does some checks. As
a last resort a sql statement is executed which returns a string. But
even this may fail because the select statement has no FROM part which
is rejected by at least Oracle does not allow. Therefore add another
query which is correct for Oracle & DB2 as a workaround. The question
why the first three statements to check for unicode availability fail
is still open but can't be checked since I've no access to an oracle
database.

Pick-to: 6.5
Fixes: QTBUG-96616
Fixes: QTBUG-102958
Change-Id: I8ec0115bbfbfc40852bcfb8e94b4b4ad3e395b37
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-12 16:21:17 +00:00
Christian Ehrlicher
3b2c09a13c SQL/MySQL: fix QSqlDatabase::tables() with MySQL 8.0.x
The (undocumented) struct MYSQL returned by mysql_real_connect() no
longer stores the db name in MYSQL.db but something else. This leads to
a wrong select statement within QMYSQLDriver::tables(). Therefore store
the current database name in QMYSQLDriverPrivate to be able to use it in
tables() later on.

Pick-to: 6.5 6.2 5.15
Change-Id: I27d3345dd44a0d8642ca120cddc5c151b8bed85d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-12 16:21:17 +00:00
Mikolaj Boc
6852627777 Reuse the existing canvas context for offscreen surfaces
Due to the nature of WebGL contexts, which cannot be reassigned to
targets other than they were created for, we will now reuse the created
canvas context for offscreen surfaces, since those (hopefully) mostly
operate on textures anyway. If this is not done, any switch to an
offscreen surface for the main RHI context invalidates resources on
contexts in a share group with it.

Fixes: QTBUG-111617
Change-Id: I9752f7eec396a3ef11414881f5f79f26e1e2c859
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-03-12 16:00:02 +01:00
Christian Ehrlicher
cdbfaf1b65 SQL/OCI: Compile with QT_NO_CAST_FROM_ASCII
Don't know why this even went through the ci.

Pick-to: 6.5
Change-Id: I9f0d1cee0c600c98f5b71bdd10f8f0260e43afcf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-12 12:36:55 +01:00
Christian Ehrlicher
3cb5408e9e SQL: add QIBASE to toc
Add QIBASE in the toc for the supported sql drivers - was removed
by accident.

Pick-to: 6.5 6.2
Change-Id: I70a295e59939317e6b99bb2bd4aad39b0b813509
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-12 11:36:54 +00:00
Christian Ehrlicher
813b4cc2ea SQL/IBASE: also search in firebird subdir
Firebird has it's include files in <include>/firebird so we should also
search there.

Pick-to: 6.5 6.2
Change-Id: Ief57abbfd6973ab9077abc1a1a2791a62ce4102a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-12 11:36:53 +00:00
Ahmad Samir
46b483ace0 Make sure helper executables used by unittests are built
E.g. tst_qprocess_and_guieventloop uses write-read-write.

This is useful e.g. when not building all of qtbase, but only a specific
unittest while hacking code.

Change-Id: Id97c6c09c180ba35554d75877a434cb258a6243d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-11 12:40:14 +02:00
Ahmad Samir
e426a4e3fa QObject: implement startTimer(int) in terms of startTimer(chrono)
I.e. use chrono first, this means the API isn't limited by the size of
int, but by the size of whatever chrono::milliseconds uses (typically
int64_t), and chrono units are much more readable as well.

Task-number: QTBUG-110059
Change-Id: Ie7f2d90864782361a89866693011803be6f8545e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-11 12:40:04 +02:00
Ahmad Samir
957ed5e71e QMimeDatabase: cleanup unittest
Use QLatin1StringView directly, instead of const char[].

Change-Id: Iae15b9f92d959efc6414ec8549b86560604dfb01
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-11 12:39:56 +02:00