65727 Commits

Author SHA1 Message Date
Volker Hilsheimer
100071af82 QJniArray: fix const_iterator declaration, make it default-constructible
Iterators are required to be default-constructible and
value-initialized iterators must compare equal.

In a const_iterator, the pointee should be const, not
the iterator itself.

Found during header review.

Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: I036c0a62ade8c59dc5d62c0823b375223719af3f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-24 00:26:37 +00:00
Ghenady Kuznetsov
b820aa7a04 Fusion style: wrongly used PixelMetric enum
Wrongly used QStyle::PM_ExclusiveIndicatorHeight, which is height of a
radio button indicator instead of QStyle::PM_IndicatorHeight, which is
height of a checkbox indicator in pixelMetric() calls for checkbox
subcontrol of groupbox.

Pick-to: 6.7 6.6
Change-Id: Ifbf7783fd4494d1e00ee28c27fa5f62b319b8787
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2024-01-23 22:00:02 +00:00
Marc Mutz
93a4478c5f QSsl: QMetaObject is defined in qobjectdefs.h
... not in qmetaobject.h.

Don't include more than we need.

Found in API-Review.

Amends b856790d67ad25f5cd8e374cb299a129acbea2ff.

[ChangeLog][QtNetwork] The enums in namespace QSsl are now Q_ENUMs.

Pick-to: 6.7
Change-Id: I67ec107ce5ab266cfad8a628e7ba3496d2484766
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-01-23 21:38:23 +01:00
Thiago Macieira
4a33472026 QChar: unexport the class and export only the helper members
Which are helpfully already marked with QT_FASTCALL.

This reduces the number of exports of the QChar class from 84 to 25 when
built by MSVC.

Task-number: QTBUG-121356
Change-Id: I76ffba14ece04f24b43efffd17abd303e9a462fa
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-01-23 10:08:23 -08:00
Thiago Macieira
62de01bf17 QString & QByteArray: ensure QT_NO_CAST_* are not defined on Windows
We can't have those macros defined while compiling the headers on
Windows (mainly MSVC, but there are some corner cases that apply to
MinGW too) because the inline functions must be emitted and added to the
DLL export table. Trying to undefine (as qchar.cpp did) won't work in
builds with PCH or in CMake Unified builds, because the headers in
question will have already been included. So instead just #error out.

qchar.cpp is #included in qstring.cpp so it no longer needs this. For Qt
7, we'll un-export the class (see next commit).

Note: it's possible we only need a single .cpp including the headers and
compiled without these macros for the export to kick in. That could be
removed_api.cpp, because that can never be part of PCH or Unified
sources. But I have not confirmed this is the case.

Task-number: QTBUG-121356
Change-Id: I5dd50a1a7ca5424d9e7afffd17acba32fb27f1ca
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-23 10:08:23 -08:00
Marc Mutz
4b3d6be5f5 QHostInfo: fix lookupHost() signature immediately
... and not just for Qt 7.

Found in API-Review.

Amends dd50d58af267bd3b79d1ca31b920d72b925d5a37.

[ChangeLog][QtNetwork][QHostInfo] The lookupHost() static function now
takes const QObject* receivers (was: (non-const) QObject*).

Pick-to: 6.7
Change-Id: I22b11e06cfba4e96975239cabed8b379cf3f4fa4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-01-23 19:08:23 +01:00
Alexandru Croitor
081e50d768 CMake: Fix unity build for qtgraphs
qtgraphs defines a target in one directory, and then calls
qt_internal_extend_target with NO_UNITY_BUILD_SOURCES in another
subdirectory scope. That in turn calls set_source_files_properties
but only for the latter subdirectory, and not the main target
directory.

Because CMake has per-directory-scope source file properties, the
'no unity sources' option was effectively ignored.

When using CMake 3.18, make sure to specify the TARGET_DIRECTORY
option so that the source file properties are added to the scope of
the defining target.

Pick-to: 6.5 6.6 6.7
Change-Id: I4190d4073a2955aa7053b5faaaa57f683bc768a2
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-01-23 19:08:23 +01:00
Juha Vuolle
30bacf78f4 Add the new Android bluetooth permissions to the manual test app
Otherwise the bluetooth permission requests fail on 12+ Android.

Fixes: QTBUG-114941
Pick-to: 6.7 6.6 6.5
Change-Id: I545299e38a7b30df840863ac880ad5bdff5fbc5e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-01-23 18:44:54 +02:00
Jonathan Ketchker
afa6cbed64 Fix code style - add missing trailing comma
For better consistency and git changes tracking add trailing comma at
the end of the last value of an enum.
See also code-review at:
https://codereview.qt-project.org
/c/qt/qtbase/+/528392/comment/663ba25a_51ed514b/

Pick-to: 6.7
Change-Id: Ibcfcfb1ba1a8ba4b59297bf17103181a0ee6eafc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-23 15:48:41 +02:00
Alexey Edelev
868e91474c Cut off the IMPORTED targets from the sync header dependencies
IMPORTED targets obviously have nothing to sync. So we should ignore
them when collecting dependencies for header sync.

Pick-to: 6.5 6.6 6.7
Change-Id: Ief68ff5eb2eb13a3fe1608445e8f5e6abb5971b4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-01-23 14:30:50 +01:00
Alexandru Croitor
5b5fa7b75a CMake: Fix sqldrivers project to allow building as Debug MSVC config
When the user:
- has a non-developer-build -debug-and-release Qt
- and tries to configure the sqldrivers project with
  -DCMAKE_BUILD_TYPE=Debug
our build system discarded the user request, and defaulted to
'Release'.

That happens because CMake sets CMAKE_BUILD_TYPE_INIT to 'Debug' by
default on Windows-MSVC, and we have no marker to differentiate
that the 'Debug' value was user-specified.

We have such a marker
- via the
  __qt_auto_detect_cmake_build_type_before_project_call variable
  when configuring qtbase / top-level qt
- via the
  __qt_toolchain_cmake_build_type_before_project_call variable when
  configuring via the qt toolchain file (although that doesn't apply
  when configuring a multi-config build for obscure reasons, which
  should be addressed).

A conservative fix is to add a new variable / marker called
__qt_internal_standalone_project_cmake_build_type_before_project_call
which the 'sqldrivers' project will set with the build type that is
detected before the first project() call, and use that to decide
whether to override the build type, similar how we do with toolchain
file variable.

We could reuse one of the previous variables, but I figured it's better
to be explicit with a new one. And hopefully we can clean up the whole
logic in a follow-up commit.

Amends 48841c34d2e86a741ec9992b9704c0fa5973503c
Amends 8c912cddebe544010e7da3f87af5b21f3328d7ec

Pick-to: 6.5 6.6 6.7
Fixes: QTBUG-120436
Task-number: QTBUG-114958
Change-Id: I37e3d8041088fe6084a9976ecc80ddd62d73ef81
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-01-23 14:26:21 +01:00
Tor Arne Vestbø
12203e94f5 QWidget: Clean up state that depends on QWindow from ~QWidgetWindow()
We were assuming that QWidget was in full control of QWidgetWindow
destruction, via deleteTLSysExtra(), and that we could limit any
cleanups to that function.

But in some situations QWidgetWindow is destructed from other code paths,
in which case we were left with dangling pointers to the QWidgetWindow
in both QTLWExtra, as well as the backingstore.

This can happen if there's a child widget hierarchy where there is not
a 1:1 mapping between QWidgets and QWindows, for example if the window
attribute WA_DontCreateNativeAncestors has been set. In this situation
our normal recursion into children in QWidget::destroy() stops at the
first widget without a window handle. When we then delete the top level
QWindow, the QWindow destructor will delete any child QWindows, which
includes our leaf QWidgetWindow.

We should probably fix up QWidget::destroy to continue looking for
children, even if we don't destroy the current child. But independently
of that we should make sure the QWidgetWindow cleans up when it's being
deleted, regardless of how it ended up there.

There's further room to clean up the deleteTLSysExtra() function and
friends, but that's been left for a later time.

Fixes: QTBUG-120509
Pick-to: 6.7 6.6 6.6.2 6.5
Change-Id: Ib691df164d7c9c83cb464c0a6bf3bc2116e8ca43
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-01-23 12:56:54 +00:00
Joni Poikelin
96f1ef1c1c Fix out of bounds access during QTextDocument cloning
Fixes: QTBUG-120962
Pick-to: 6.5 6.6 6.7
Change-Id: Ib2a35acd5a0d673b39556a4aa930e37eb40b39b2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2024-01-23 14:56:54 +02:00
Volker Hilsheimer
3fd49e95a9 QJniArray: fix prototype of member functions
Remove the redundant template parameter. As a drive-by, swap
pointer members using qt_ptr_swap instead of std::swap.

Found during header review.

Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: Ibed9c7e7866672401b9dd87ff6e33db8f61e7282
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-23 13:56:54 +01:00
Volker Hilsheimer
2c9525a501 QJniArray: add test case for QJniArray::size
Fix build of the test by removing the reference from the
container type before accessing the nested typedef.

Pick-to: 6.7
Change-Id: Ic35f312bac70b8f8f80149a3432329070c8c8c7d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-23 13:56:54 +01:00
Marcin Zdunek
2a832b40af Disable raster_fp for VxWorks
raster_fp is turned off, as it produces a crash. Is may be a miscompilation issue, but we are not 100% sure of the origin.

Task-number: QTBUG-115777
Change-Id: Icf2b31b73afba3505a1d4c8c5194bfa2b85325ed
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2024-01-23 12:39:46 +01:00
Marc Mutz
f0dcbb66e8 QTest: Extract Method qCaught() from THROWS_(NO_)EXCEPTION
We've already done a lot in 59600a514ba99ed62b46237d8f160dea84474190,
but we can do more:

Thanks to std::exception_ptr, we can drag the handling of unexpected
exceptions completely to out-of-line code, leaving only the catch(...)
as inline.

As a nice side-effect, we no longer need the nested try blocks in
QVERIFY_THROWS_EXCEPTION to work around GCC -Wexceptions or MSVC C2312
complaining about two handlers for the same exception type (which can
happen when exceptiontype is std::exception itself).

This may not handle __cxxabi::__forced_unwind correctly, but it
doesn't need to: Tests should not need to call THROWS_EXECPTION on
code that could emit a pthread cancellation; tests are controlled
environments.

Keep the old qCaught() function for BC. We don't promise BC in
QtTestLib, but it doesn't cost much.

Pick-to: 6.7
Change-Id: I1e1627c6341b09197a8a79669fde061c47e6ba47
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-01-23 10:20:53 +00:00
Thiago Macieira
79e1389fb9 QProcess: align treatment of early start errors
There are a couple of possible runtime errors that could happen before
the state was changed to QProcess::Starting. This aligns the Unix code
with Windows, which has the state transition at the top, and with the
documentation which says we will enter QProcess::Starting state.

Complements commit 956b2495285251e4840ec32885ffa2cfbb7bd79c, repeating
what it did for Unix (removing the overwriting of the error message that
openChannel() sets) on Windows. We also need to ensure cleanup() is
always called.

Pick-to: 6.6 6.7
Change-Id: I76ffba14ece04f24b43efffd17aafdd47f908bf1
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-01-22 21:44:21 -08:00
Mårten Nordheim
aec39bd136 tst_bench_{qhash,qset}: set deterministic seed
There's a lot of variation in the benchmark graphs for QHash
presumably caused by variation in seed.

Optimally we would set deterministic seed for all
benchmarks, but we don't know whether or not it is
one until the macro is reached.

Pick-to: 6.7 6.6 6.5
Change-Id: I4e412e4d4e2cc65eada94ed123243ed0047dd9cf
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-23 05:17:06 +01:00
Jacek Poplawski
ba75e7770f Make sure the sqrt value in qdrawhelper is non-negative
It's possible for the "det" variable to exceed 0 and be negative.
This scenario is already handled in one case, this change will fix second case.

Pick-to: 6.7
Fixes: QTBUG-120907
Change-Id: Ib30213b3455b5c6f3b8b8384e78e7b43158f93b5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-01-23 04:21:01 +01:00
Thiago Macieira
14115da183 QStorageInfo/Linux: use FS_IOC_GETFSLABEL to get the labels
This ioctl was introduced in kernel version 4.18 and before that it was
used for btrfs alone. It is currently (kernel v6.7) supported by:
 * btrfs
 * ext2/ext4
 * f2fs
 * gfs2
 * xfs
See man ioctl_fslabel(2)

This means we won't need to list the /dev/disks/by-label directory if
you only have mounted filesystems like the above or tmpfs (which doesn't
support labels).

On my system, there are still two cases that cause the listing:
 * a mount point not readable by my user, such as /.snapshots and /root
 * a FAT32 filesystem mounted on /boot/efi

Pick-to: 6.7
Change-Id: I76ffba14ece04f24b43efffd17ab3dced74ffd2c
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-01-22 13:30:02 -08:00
Christian Ehrlicher
41c842d3f7 SQL/MySQL: Fix compilation with MySQL 8.3
With MySQL 8.3 mysql_fetch_field() was removed which was used in
QMYSQLDriver::record(). There is no real replacement function so we
use 'SELECT * from table LIMIT 0' to retrieve the schema information.
Additionally mysql_stmt_bind_param() was deprecated and needs to be
replaced by mysql_stmt_bind_named_param().

[ChangeLog][SQL][MySQL] Fixed compilation with MySQL 8.3.

Pick-to: 6.7 6.6 6.5 6.2 5.15
Fixes: QTBUG-121183
Change-Id: I149836bd5674d0784255baf416d437c424992f20
Reviewed-by: silverqx <silver.zachara@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-22 21:18:00 +01:00
Alexey Edelev
0047affafb Make the QtNetwork private symbols visible
Export QHttpNetworkConnection and QHttpNetworkReply classes, this is
required to use the freshly introduced QHttp2Stream.

Pick-to: 6.7
Change-Id: I4920d342af943b393afa78a187b562549fa919e0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-01-22 19:40:19 +00:00
Thiago Macieira
96e5d0d5c1 QStorageInfo/Linux: merge doStat() and initRootPath()
The doStat() function was too simple. Plus, we can now avoid having to
come up with an non-zero-but-unused device ID for some corner cases.

Pick-to: 6.7
Change-Id: I76ffba14ece04f24b43efffd17ab3a79e54e636d
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-01-22 11:40:19 -08:00
Thiago Macieira
264b7a6733 QStorageInfo/Linux: move retrieveVolumeInfo() up because it won't fail
initRootPath() may fail, so let's make sure we do extract some
information from the FS even if that does. Issue introduced by
3e330a79ec8d273630660eefae42995018421c0c ("QStorageInfo/Linux: rewrite
the label retriever to use device IDs")

Task-number: QTBUG-121140
Pick-to: 6.7
Change-Id: I76ffba14ece04f24b43efffd17ab2df71af8c4e0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-01-22 11:40:19 -08:00
Laszlo Agocs
a7e429e5a3 Show frame capture in configure summary
Have to watch the RenderDoc test otherwise in the CMake
output (e.g. on Windows), making it quite hard to spot
if QGraphicsFrameCapture is going to be available or
not.

Change-Id: I147378a7d1e5725239472ef83814eebb1358878a
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2024-01-22 20:40:19 +01:00
Laszlo Agocs
80e7bcd368 Do more QRhiWidget cleanups based on API review
Pick-to: 6.7
Change-Id: I339fb2ac2546b9d7b4b88cba89191e7a4311017f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-01-22 20:40:19 +01:00
Joerg Bornemann
a7a9a1d43c Un-blacklist QMessageLogger backtrace tests for b2qt 64bit
They are working fine by now.

Change-Id: I24b1ac61791a850da85347c9718df678dfea2706
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-01-22 17:51:56 +01:00
Joerg Bornemann
5b9654613b Blacklist QMessageHandler backtrace tests for b2qt 32bit
Un-blacklist tests/auto/corelib/global/qlogging for Boot2Qt+CMake, since
we only have a CMake build by now.

Task-number: QTBUG-90545
Task-number: QTBUG-121389
Change-Id: Ia9d5fb2344598d58e06595c9cef93d5bba3de0cb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-01-22 17:51:56 +01:00
Ahmad Samir
b426414a55 QFileInfo: cleanup snippets file
This makes it possible for LSP clients, e.g. clangd, to inspect the code
while typing it, which hopefully means less errors.

Change-Id: Ib2ed8fec94a559575237107afbcd2bdb3c46ef8d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-22 17:59:31 +02:00
Tinja Paavoseppä
1062373b8e Android: Remove parent before adding window to screen
When a window's parent is set to null, remove the corresponding native
view from its previous parent layout before adding it to the layout
for top level windows. If the removal from the previous layout is
done after adding the window to the screen, an exception will be
thrown due to the view already having a parent.

Fixes: QTBUG-121232
Pick-to: 6.7
Change-Id: I1c065b5158d32150042d25fb64f10cf48f83f9f4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-01-22 15:07:49 +00:00
Nicholas Bennett
ef01f32388 Docs: Review and improve QString documentation
Changed section titles to sentence case.
Added or removed commas as required.
Simplified language were appropriate.
Varied terms to improve engagement.
Corrected resultant text to within the 80 character
width, so there will be whitespace change warnings.

Fixes: QTBUG-119553
Pick-to: 6.6 6.7
Change-Id: I5f40605fde4639a6dfcdb3816f32ad7599572fae
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mats Honkamaa <mats.honkamaa@qt.io>
2024-01-22 17:07:49 +02:00
Axel Spoerl
08ddf846ae QAppleTestLogger: Add source link to failure messages
The apple test logger did not include the failure location in the log
output, because the assumption was that the structured logging would
report the file and line separately.

Unfortunately we can't do that using the os_log machinery just yet,
so we bring in the manual location printing as in the plain text
logger.

Pick-to: 6.7
Change-Id: Ief0a6a6e04d628c98ed09c09334b694504cbff2c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-01-22 15:51:21 +01:00
Topi Reinio
091096fed7 Doc: Update copyright year to 2024
Update copyright year in documentation template and
copy-notice paragraphs.

Pick-to: 6.7 6.6 6.5 6.2
Change-Id: I0ff70bbd5925078e80e6799ac80cfc8e6e68a2a0
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2024-01-22 14:51:21 +00:00
Alexandru Croitor
85c462855b CMake: Fix Threads global promotion issue when using static openssl
and an older CMake 3.22, which is shipped by default on Ubuntu 22.04.

If for some reason there's a static openssl library lying around in
the default sysroot (or any ssl search path), like in
 /usr/lib/libssl.a,
then CMake's _OpenSSL_test_and_find_dependencies
will try to find_package(Threads) because it assumes it has a
dependency on the Threads package.

Because we do qt_find_package(WrapOpenSSLHeaders) in
qtbase/configure.cmake
and we do qt_find_package(Threads) in
src/corelib/CMakeLists.txt,
we would create the Threads target in the root directory scope, and
then try to promote it to global in the corelib subdirectory,
which fails with

CMake Error at qtbase/cmake/QtPublicTargetHelpers.cmake:260
  (set_property):
  Attempt to promote imported target "Threads::Threads" to global scope
  (by setting IMPORTED_GLOBAL) which is not built in this directory.
Call Stack (most recent call first):
  qtbase/cmake/QtFindPackageHelpers.cmake:211
  (__qt_internal_promote_target_to_global)
  qtbase/src/corelib/CMakeLists.txt:4 (qt_find_package)

Newer versions of CMake's FindOpenSSL actually try to determine if
the Threads package is really needed.

To avoid the issue entirely, just look up Threads before we look up
the OpenSSL package.

Pick-to: 6.5 6.6 6.7
Change-Id: Ia3cde93e26ba004f64105a5b457098e1b9870885
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-01-22 14:18:09 +01:00
Alexandru Croitor
5122fe625d CMake: Partially disable sanitizers for syncqt
Won't work when syncqt is built using
qt_internal_add_configure_time_executable.
That needs some extra infrastructure.

Task-number: QTBUG-121348
Change-Id: I627dea39c906ea374848d848b0ea740826991140
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-01-22 14:18:09 +01:00
Thorbjørn Lindeijer
d99b0cfed2 Increase precision for QGraphicsView::AnchorUnderMouse
* Use a more precise view center for views with odd width/height
* Use the QPointF version of mapToScene to avoid rounding
* Round instead of truncate when setting scroll bar values

These changes increase the precision of AnchorUnderMouse, which is
important when for example wheel scrolling is used to change the scale
of the view. Without these changes, the view shifts slightly with each
change in the transform.

[ChangeLog][QtWidgets][QGraphicsView] Increase precision for QGraphicsView::AnchorUnderMouse and QGraphicsView::centerOn

Pick-to: 6.6 6.7
Task-number: QTBUG-96879
Change-Id: I8199196c671e4aa96732f382e8057468f676b8d7
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2024-01-22 14:18:09 +01:00
Ivan Solovev
cde7d5d3ff Make public QLocale's constant for the two-digit-year base
The private QLocale::FirstTwoDigitYear constant, which is used as a
default value for the parameters in some methods, causes troubles for
Qt for Python Team, because they need to use the default values in the
binding code. It also potentially create some inconveniences for the
users who want to write functions wrapping these methods.

The name is also confusing, because, when read out of context, it
implies that there might be SecondTwoDigitYear, etc...
Rename QLocale::FirstTwoDigitYear to QLocale::DefaultTwoDigitBaseYear
and make it public.

Now when the constant is public, we can use it in QDate, instead of
introducing another constant, so do that.
The qdatetime.h header already includes qlocale.h via qcalendar.h,
but, rather than relying on this transitive include, add it
explicitly.

As pointed out by Thiago [1], the static constexpr members of exported
classes need out-of-line definitions, so add such definition to
qlocale.cpp.

Amends 41f84f3ddb780ec751e3fc706dd242fc4a99de7a

Found in 6.7 API review.

[1]: https://lists.qt-project.org/pipermail/development/2024-January/044888.html

Pick-to: 6.7
Change-Id: Ib3c6f1d5b181968bf311fd0435173e025a369865
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-22 14:18:09 +01:00
Axel Spoerl
e957ed97e0 QFontEngine: Silence bogus gcc warnings
gcc warns about using uninitialized variables in
QFontEngine::getTrueTypeGlyphIndex. The warning is bogus, because all
variables subject to the warning are initialized by passing their
pointer to qSafeFromBigEndian().

Initialize them anyway to silence the warnings.

Pick-to: 6.7 6.6 6.5
Change-Id: I25e062f25e2b06701af5edca27a9e56b939daa79
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2024-01-22 11:06:49 +00:00
Ed Cooke
343551ffae QPushButton with a menu remains in sunken state after menu closed
Regression fix, introduced in:
7199498fb9cbfb5afc043ddb0e630c8ffad5240b

QPushButton with a menu will have a sunken state, QStyle::State_Sunken,
when the menu has been closed. Expected behavior is that the sunken
style is to be removed when the menu is closed.

A boolean called "menuOpen" is never set to false after being set to
true in the popupPressed() method. When this boolean is true, a sunken
state is painted.

Fixes: QTBUG-120976
Pick-to: 6.6 6.7
Change-Id: I3e721da5dfbb6db200aa2de7366ac5dc73c873e0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2024-01-22 08:19:20 +01:00
Ahmad Samir
17b414f75a QProcess: use enum types in tests instead of plain int
Pick-to: 6.7
Change-Id: Ibba85d28c2a5329f9224ffdc893f2dab8e672ee9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-22 00:33:03 +02:00
Thiago Macieira
c8db469fd5 QMimeBinaryProvider: move CacheFile up in the file
Amends 329722a322a80d5ea8d6f9aa993c2fc4995b08a4 ("QMimeBinaryProvider:
manage m_cacheFile with a std::unique_ptr"), which added the
std::unique_ptr<CacheFile>.

This is required because in C++23 std::unique_ptr's destructor became
constexpr and is therefore instantiated more eagerly. The type must be
fully defined (not forward-declared) when the std::unique_ptr member is
initialised in the QMimeBinaryProvider constructors.

Fixes: QTBUG-121204
Pick-to: 6.6 6.7
Change-Id: I76ffba14ece04f24b43efffd17ab9a861aff89b8
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-01-21 14:33:03 -08:00
Thiago Macieira
987abb9253 QStorageInfo/Linux: fix getting information on unmounted btrfs subvols
Amends 1cd6c6c69e9813c791f8bebb6c0c9214ce765060.

Btrfs can have subvolumes and each one of them is assigned a device ID
when the filesystem is loaded into the kernel. But subvolumes don't all
have to be a mountpoint of their own: if we insist on matching device
IDs, as initRootPath() was doing, we'd fail at finding the mount point.

Fixes: QTBUG-121140
Pick-to: 6.7
Change-Id: I76ffba14ece04f24b43efffd17ab39f503000dd7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-01-21 14:33:03 -08:00
Thiago Macieira
458a9d288a QProcess/Doc: clarify that early crashes happen after started()
This is notable when dynamic linking fails, because that happens before
the first line of main() (or equivalent) of the child process, so even
banners printed by that function may be missing.

Pick-to: 6.7
Change-Id: I5201966b308e48989c06fffd17aa9837156e23f4
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2024-01-21 10:50:32 -08:00
Thiago Macieira
8e1f9169ca QProcess/Doc: clarify that started() may be emitted very early
On Windows, process creation is synchronous so we will always emit
either started() or errorOccurred() before QProcess::start() returns.
This condition doesn't currently happen on Unix systems, but we could do
that because we're now using vfork() on most platforms, so the child
process has either successfully execve()d or _exit()ed before
QProcessPrivate::startProcess continued.

Drive-by reorganization of the code to remove the one-line \note in the
middle of the docs.

Pick-to: 6.5 6.6 6.7
Fixes: QTBUG-120968
Task-number: QTCREATORBUG-30066
Change-Id: I4d0668e0fae5299551ff91480828a68e62fdacec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-01-21 10:50:32 -08:00
Tinja Paavoseppä
06d2aa91eb Android: Add a context delegate for embedding QML to native Android
When we are embedding a QML view to a non-Qt Android app, there are a lot
of functionalities that are shared with the refular Qt Android app, but
some are not. We should not, for example, try to control the hosting
Activity.
Create a base class that both the QtActivityDelegate, used for the
standard Qt for Android app, and the delegate for the embedding case
can extend.

In this commit, the QtEmbeddedDelegate is very simple, the
biggest difference to QtActivityDelegate being it does not create
a QtLayout or instantiate a QtAccessibilityDelegate.
It does start the Qt app, without waiting for a layout, and register
to listen for changes in the state of the Qt app.

Taking the embedded delegate into use, loading the embedded QML
views and their handling is added in a follow up commit.

Task-number: QTBUG-118872
Pick-to: 6.7
Change-Id: Id390a2b35c70b35880523886bf6fcf59d420cb42
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-01-21 15:46:30 +02:00
Christian Ehrlicher
52a41bac77 QTextImageHandler: Use QUrl::toLocalFile to convert to local file name
Simply stripping away the first six characters does not work on Windows.

Amends 2d87c4d881b74619fef966ffb0d7a00cb4ccea50

Pick-to: 6.7 6.6 6.5 6.2
Fixes: QTBUG-120577
Change-Id: If48ba026785cab784f46109e34ac80e39a990b79
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-01-21 09:12:33 +00:00
Christian Ehrlicher
747581e0bf SQL: remove outdated \since tags
There is no need to know if a function was added in Qt4 or earlier so
remove all \since 4.x tags

Change-Id: I5cf4e89a3e30c13fac076f1ae7abb33a625e366c
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2024-01-21 10:12:31 +01:00
Tor Arne Vestbø
0c2a16c49c tst_QWidget: Add test that WA_NativeWindow results in window handle
Pick-to: 6.7
Change-Id: I63a653a552be2a6435e0c068e47c2442e53642cb
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-01-20 13:29:14 +01:00
Allan Sandfeld Jensen
92acc94fa9 Optimize QSet::unite
Done similar to intersect. This also improves one test, as we get one less detach, and makes it consistent with other results.

Change-Id: I4d08bf43e750c758b363f8e4fe1fe312a7a0cde4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-01-20 08:55:06 +00:00