Commit Graph

57726 Commits

Author SHA1 Message Date
Joerg Bornemann
042290d0fb CMake: Add QT_ANDROID_SIGN_AAB variable
[ChangeLog][CMake] Added the QT_ANDROID_SIGN_AAB variable that can be
set to ON to enable signing of .aab packages.

Pick-to: 6.4
Fixes: QTBUG-105529
Change-Id: Ic06cc452851dc81b10a2721b544641cb5eeea8be
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-08-12 22:42:51 +03:00
Edward Welbourne
45cbb1e31e Fix DeferredFlag implementation for QTestEventLoop
As discovered in the expanded testing of QTRY_COMPARE() using the same
class, the timer needs a context object and a slot to call.
This amends commit 35ad157d88

Pick-to: 6.4 6.3
Task-number: QTBUG-104441
Change-Id: I41fc23de84ce8c7d6608db0005276a2071974494
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-08-12 20:32:30 +02:00
Edward Welbourne
54bcefb25c Test QTRY_COMPARE() and expand testing of QTRY_VERIFY*()
In the process, simplify the latter while adding some actual
time-variation for the QTRY_* loop to navigate round - based on the
extendedcompare test's ClassWithDeferredSetter. Testing remains
primitive, but is at least a bit more thorough.

Pick-to: 6.4
Change-Id: I40be8fb485f3f18f0a4f4bc62ad36cccac691979
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-08-12 20:32:30 +02:00
Edward Welbourne
f5840692b0 Remove the stale expected_crashes_[345].txt
These contain output only ever sent to stderr, which tst_selftests no
longer looks at; it merely verifies stderr is empty for all tests
except those expected to produce stderr output, and ignores the stderr
output for these last.

Change-Id: I50fee445d84c2d125e6db5303fc389e87746455e
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-12 20:32:30 +02:00
Edward Welbourne
f9b58b5c14 Include current test name in crash reports
Previously a crashing test's output would end with the last completed
test's output followed by a crash report, leading readers
(understandably enough) to conclude that the last-named test is the
one that crashed. In fact the crashing test is typically the next one
in the class definition.

Include the current test function's name (when non-null) in the output
accompanying crash logs. This always goes to stderr so does not show
up in the expected output.

Pick-to: 6.4
Change-Id: Icab0ccd1fe434827ee92459ab0c97f9dc034754e
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-08-12 20:32:30 +02:00
Marc Mutz
013574a5fd QLocale: port locale_data indexing to qsizetype
Not a bug, just porting to avoid the next reader having to wonder
whether the ints and uints are 64-bit safe.

As a drive-by, make a static variable constexpr and replace sizeof
foo/sizeof *foo with q20::ssize(foo).

Pick-to: 6.4
Task-number: QTBUG-103531
Change-Id: Iccc5a5896ab87981f4535820cea7f274e568f325
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-12 20:32:30 +02:00
Marc Mutz
62aec32dfa QLocale: fix UB in defaultIndex() (using < on unrelated pointers)
It's undefined behavior to compare pointers with <, >, <=, >=, unless
they point into the same subobject (or one past the last element, for
arrays). The Q_ASSERT() should detect UB. For that, it mustn't cause
UB itself.

Fix by using q_points_into_range(), which uses std::less, which is
guaranteed to define a total order on pointer values.

Pick-to: 6.4 6.3 6.2
Change-Id: I725eb9e4a9304d2edcd0776e756e6a67e224c1a7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-12 18:32:29 +00:00
Thiago Macieira
6234182d82 QMetaType: don't use global relocations to the lambdas and structures
The way the Qt 6.0 QMetaTypeInterface was designed, using a static
inline variable in a template, would normally require the linker and
dynamic linker to merge all copies and choose a single copy as the
official one. But because of hidden visibility and of Windows DLLs,
QMetaType already copes with multiple copies NOT getting merged. So we
may as well ask the linkers not to bother and use simpler, local
relocations to find those symbols.

They are all supposed to still be equivalent and it's an ODR violation
if they're not.

The Apple ld64 linker complains if you use this type of global
relocation:

 ld: warning: direct access in function
  [...]
   to global weak symbol
   'QtPrivate::QMetaTypeInterfaceWrapper<int>::metaType'

Fixes: QTBUG-93471
Pick-to: 6.3 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f98a10aa719434
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-12 11:32:29 -07:00
Thiago Macieira
985e24dd5f QMetaType: add a test to confirm that types are equal across libraries
Because of the template shenanigans. This is just to make sure.

Pick-to: 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f989e7d555894f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-12 11:32:29 -07:00
Marc Mutz
bbcdee2afa QChar: replace uint with char32_t in the implementation
Finishes the port from uint to char32_t started in Qt 5.

Task-number: QTBUG-103531
Pick-to: 6.4
Change-Id: I97c29deb30a9a4563e2eafdb25e1f290a079726f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-12 20:32:29 +02:00
Marc Mutz
cd0f696891 QString: finish migration to qsizetype
These don't look like they could cause bugs, because their range of
values is physically limited, but port them to qsizetype nonetheless,
for consistency, and to save the next reader the task of proving that
they're, indeed, ok.

Pick-to: 6.4
Task-number: QTBUG-103531
Change-Id: I337ea327b54bcf5960928f5d1d72c6fc80dcda31
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 20:32:29 +02:00
Mikolaj Boc
f8e460b915 Use the local file APIs to save/load files on WASM
QFileDialog::saveFileContent, QFileDialog::getOpenFileContent are now
using local file APIs to access files on any browser that passes a
feature check.
The feature is thoroughly tested using sinon and a new mock library.

Task-number: QTBUG-99611
Change-Id: I3dd27a9d21eb143c71ea7db0563f70ac7db3a3ac
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-12 20:32:29 +02:00
Laszlo Agocs
742ae9ea1c Be more graceful when objects die by the time the dnd loop exits
The main issue fixed in 7f23dd963536eb8123ee4c5c22bf43b6f866d008 can
manifest in another form on platforms where QBasicDrag is used (xcb).

Make sure that we recognize if an object (e.g. a QWidgetWindow) is
destroyed by the time the nested event loop exits.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-104596
Change-Id: Ib82dd8230cb6f13d804bd992234b2a3ce85a7061
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-08-12 18:24:54 +02:00
Alexandru Croitor
e671b852e7 CMake: Improve tool not found error message
Pick-to: 6.4
Change-Id: I7f04e4af80c4d23b855c8c9d5f5017f8afb112ea
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-12 14:55:03 +02:00
Alexey Edelev
9029b90538 Rename arg_HEADER_MODULE variable to 'is_interface_lib'
Variables starting with 'arg_' usually are the result of the
cmake_parse_arguments call. It's better to not use them for the regular
variables for readability.

Change-Id: I4054c63d3e48b2a27d8a632cd8908a59302afa47
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-12 13:50:55 +02:00
Alexey Edelev
a3e8d28fdb Do not use the HEADER_MODULE argument in qt_generate_module_pri_file
HEADER_MODULE argument is passed to qt_generate_module_pri_file from
the qt_internal_add_module function, but the property means that the
module is an interface library. So it makes sense to replace this
argument with the reading of the target TYPE.

Change-Id: I1d8cd2ff732f526975cde6bdd4783fee44c8bd98
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-12 13:50:55 +02:00
Laszlo Agocs
011d10fe26 rhi: metal: Simplify batch comparisons
Change-Id: I9d61ce3f2e8501a854e070a83cd748928129e76d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-12 12:51:59 +02:00
Andy Nichols
ea1f172267 RHI: Cache ShaderResourceBindings for Metal
We current have lots of redundant state bindings for things like
SamplerState that could reduced by checking if the state is already set.
ShaderResourceBindings are fairly involved to cache since they are done
in batches. This patch stores the current ShaderResourceBindings state
and checkes the current state before setting a new one.

Change-Id: If15ebd2b8b14b016f492d881197e423773c30ef7
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-08-12 12:51:59 +02:00
Marc Mutz
0c716c687a QUnicodeTools: mark a test-only flag constexpr/constinit
For QT_BUILD_INTERNAL, mark the flag constinit, because tests may want
to set it (which they better do before Qt spins up threads, because
otherwise this non-atomic flag runs into UB (data races)).

For non-QT_BUILD_INTERNAL, mark the flag constexpr, so dead code
elimination can do its job.

Inconsistently, of the two readers of the flag, one was ifdef'ed on
QT_BUILD_INTERNAL, while the other wasn't. Settle on exposing both,
which increases the compiler coverage of the code.

Pick-to: 6.4
Task-number: QTBUG-100486
Task-number: QTBUG-100485
Change-Id: I6e041359b8214b40d80eefa92c26422aada3eb59
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 07:55:23 +02:00
Marc Mutz
bd9c704823 QStringConverter: add Q_CONSTINIT to function-level QBasicAtomic
Task-number: QTBUG-100486
Pick-to: 6.4
Change-Id: Ia55b743fd7ad4716b82425410ed0cf9ff2ee30e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 07:55:06 +02:00
Marc Mutz
496b4294c9 QLocale: port findTag to std::string_view
QStringView lacks the equivalent of find_first_of, so use string_view
for now.

Fixes an unnecessary QString ctor/dtor call, as well as the
int/qsizetype mismatch, looking for which I found this code.

The function can now be properly noexcept.

Task-number: QTBUG-103531
Pick-to: 6.4 6.3
Change-Id: I1198c082a2ee0addbe7c0d2192073b017d9f8dd7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 07:54:59 +02:00
Marc Mutz
1aa00c993b Port qt_readEscapedFormatString() to qsizetype
More of the usual missing int -> qsizetype porting...

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-103531
Change-Id: I53faff5fe306c1d207741bc93a1e5c15d3eefa4f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 07:54:51 +02:00
Marc Mutz
3e1c6e7496 QTextBoundaryFinder: fix a flawed buffer size calculation
There were two problems:

1. The cast to uint truncates the input qsizetype bufferSize mod
   UINT_MAX, which, if the original value was qsizetype(UINT_MAX) + 1,
   would yield a false negative check, so remove the cast.

2. The multiplication of the input string size with
   sizeof(QCharAttributes) looks like it could overflow, esp. on
   32-bit platforms. It can't, because sizeof(QCharAttributes) == 1
   atm, but the next attribute that's added to the struct will turn
   that into sizeof 2, so play it safe and use division on the LHS
   instead of multiplication on the RHS to avoid this arithmetic 101
   antipattern.

Task-number: QTBUG-103531
Pick-to: 6.4 6.3
Change-Id: Icae3bea1c3cb52a235b8aae181af35c86c3f5d6f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 07:54:38 +02:00
Marc Mutz
48c8072bb8 Finish porting cross-platform parts of QStringConverter to qsizetype/size_t
There are still problems with platforms-specific APIs that are 32-bit
only (cf. QTBUG-105105), but this patch finishes the port of the
cross-platform parts of QStringConverter.

None of these changes have a user-visible effect. They just avoid the
Code Smell that int has become since Qt 6.0.

Pick-to: 6.4
Task-number: QTBUG-103531
Change-Id: I267e2e1268a18c130892fa2fd80d1b5dabb3d9b9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 07:53:58 +02:00
Marc Mutz
eb55e2980e QStringConverter: make a narrowing conversion explicit
Int variables are a code smell these days, so make the narrowing
conversion (from ptrdiff_t to int) explicit and add a comment.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-105105
Change-Id: Ia4e14f1cc132ca36d15e9684bfcb4605d7b9251f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 07:53:37 +02:00
Marc Mutz
42fbd063e2 QStringConverter: fix -Wc++20-compat
GCC 13 warns:

  qstringconverter_p.h:29:6: warning: identifier ‘char8_t’ is a keyword in C++20 [-Wc++20-compat]
     29 | enum char8_t : uchar {};

Fix by calling the replacement qchar8_t (and making it a typedef to
char8_t when the latter is available).

Pick-to: 6.4 6.3 6.2
Change-Id: If59a9d55667bf1f5245e3a34189687995b000daa
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 07:53:23 +02:00
Marc Mutz
32c0d32a4f QString: fix arg() for >2Gi repeated lowest-escape-sequence-numbers
Building on 15a80cf8a9, this patch fixes
the case where there are more than INT_MAX occurrences of the
lowest-escape-sequence number, as in

   QString("%0").repeated(qsizetype(INT_MAX) + 1).arg(42);

by replacing the corresponding int variables with qsizetype ones.

Task-number: QTBUG-103531
Pick-to: 6.4 6.3
Change-Id: I6f4593a86d8d605031bc1d6520a247676091b2c2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-12 02:42:27 +02:00
Lorn Potter
1f9c1f032c wasm: allow apps to override EXPORT_RUNTIME_METHODS
Developers can add to Emscripten's EXPORT_RUNTIME_METHODS
by defining their own using:
QT_WASM_EXTRA_EXPORTED_METHODS

Which will add on to Qt's default exported runtime methods
of UTF16ToString,stringToUTF16

for cmake:
set_target_properties(<target> PROPERTIES QT_WASM_EXTRA_EXPORTED_METHODS "ccall,cwrap")
or
set(QT_WASM_EXTRA_EXPORTED_METHODS "ccall,cwrap")

for qmake:
QT_WASM_EXTRA_EXPORTED_METHODS = ccall,cwrap

Done-with: Mikolaj Boc
Fixes: QTBUG-104882
Pick-to: 6.4
Change-Id: I9678bdb7b077aaa8527057212ea4e161c0be0b60
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-12 10:13:51 +10:00
Sona Kurazyan
97f6878afd Move Q_OF_ELF/Q_OF_MACH_O macros to qsystemdetection.h
Task-number: QTBUG-99313
Change-Id: I373fad6f8339a0bad1ebc5d81386b18794bf32cc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-11 21:13:31 +02:00
Sona Kurazyan
85414ac6c0 Move Qt 6/7 specific macros to qtversionchecks.h
Task-number: QTBUG-99313
Change-Id: I57032bf5d0edcb7345267512e12837b1d90d1485
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-08-11 19:13:23 +00:00
Ivan Solovev
df1db826cb Move qMin/qMax/qBound() to a separate qminmax.h header
Also replaced qMin() uses in qnumeric.h with QtPrivate::min().
Including qassert.h in qminmax.h leads to indirect include of qglobal.h
(through qcompilerdetection.h), which in turn leads to qMin() declaration
not being available at the point the compiler sees qFuzzyCompare()
definitions in qnumeric.h. This makes the headersclean build fail.

Task-number: QTBUG-99313
Change-Id: I824422698b06f94a4a62e2f19d4507c87f90334e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-11 21:13:16 +02:00
Sona Kurazyan
fc3441101b Extract header qtypes.h from qglobal.h
And move the related checks from qglobal.cpp to qtypes.cpp.

This requires removing the unnecessary include statement for qglobal.h
from qprocessordetection.h, that now needs to be included in qtypes.h.

Task-number: QTBUG-99313
Change-Id: Ifd72b956326909be82c162f37854cad0878010e2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-11 21:13:10 +02:00
Marc Mutz
a8e6a0e546 [docs] Fix return value of QStringIterator::next()
It's char32_t these days, not uint.

Task-number: QTBUG-103531
Pick-to: 6.4 6.3 6.2
Change-Id: Iaa03f97d0d1266a6763eb858edb45ae0f2a4729d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-11 20:44:16 +02:00
Marc Mutz
8dbc569538 QUnicodeTools: fix truncation in debug statements
Instead of casting to int, cast to qlonglong, which is guaranteed to
be able to hold all qsizetype values.

Task-number: QTBUG-103531
Pick-to: 6.4 6.3 6.2
Change-Id: I3e89892defd091fa6ef305b8ed5c3819a2cc13da
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-11 20:44:16 +02:00
Marc Mutz
7d021e3173 QUnicodeTools: fix data race in initialization of libthai symbols
The facilities of qunicodetools.cpp are not limited to the GUI thread,
so initialization must be thread-safe.

The old code wasn't, though, and contained several data races

- non-atomic initialized was read while another thead may write it
- th_brk and th_next_cell were read while another thead may write them

Fix by using Double-Checked Locking. This also prepares the code for
an eventual port to th_brk_find_breaks() (th_brk is deprecated).

The function pointers don't need to be atomic, because all reads from
them are guaranteed to happen-after the writes to them (as long as all
users call init_libthai() and don't proceeed if it returns false; this
could be ensured by returning a struct with the function pointers from
init_libthai() instead of maintaining them as statically-visible
globals, but that's outsize the scope of this patch).

As a drive-by, remove a pointless static_cast<int>(~~int expression~~).

Fixes: QTBUG-105543
Pick-to: 6.4 6.3 6.2
Change-Id: I492acd7e9a257e5c4b91f576e9bc448b6bb96ad1
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-11 20:44:16 +02:00
Marc Mutz
50d1a8a377 QUnicodeTools: fix types used around th_brk()
Libthai's th_brk() takes the breakpoints array lengths as size_t, so
use that.

This still doesn't fix thaiAssignAttributes() for ≥ 2 Gi characters,
because th_brk returns break positions in an array of int, thus
limiting any results to the first INT_MAX characters. Created
QTBUG-105541 to track this.

Task-number: QTBUG-103531
Pick-to: 6.4 6.3 6.2
Change-Id: Iba468cc9389f4533401bc18dd326c4ca7e85a5da
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-11 20:44:16 +02:00
Marc Mutz
ea1e005cb1 QUnicodeTools: fix types used around th_next_cell
Libthai's th_next_cell takes and returns lengths as size_t.

- pass size_t, not qsizetype (the value can never be negative)
- receive size_t, don't cast to uint

As a drive-by, scope variables tighter.

Task-number: QTBUG-103531
Pick-to: 6.4 6.3 6.2
Change-Id: Ib1eeb1f0e8974ee8b0f88d080d06136b307c324f
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-11 20:44:16 +02:00
Maximilian Goldstein
6f976a4c7d qlocale: Fix some flags not being exposed to the metatype system
This caused it to be unavailable in metatypes and thus to not work in
qml.

Change-Id: I22b6fa3b43fe609bdc1167dc081290eb93845491
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-11 20:36:40 +02:00
Dimitrios Apostolou
d68da61564 Wait for window focus instead of expose event
This fixes the flakiness seen in OpenSUSE KDE/X11 desktop.

Fixes: QTBUG-70590
Task-number: QTBUG-105177
Change-Id: I7c2431e58b2a60ea04e26d4e70c0f2867d544ff2
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2022-08-11 19:09:09 +02:00
Andy Nichols
4cf30d8c1b RHI: Take advantage of Apple GPU specific features when available
Pick-to: 6.4
Change-Id: Ie59405bd8cf235086f7e9a675270ed25beb8aedc
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-08-11 15:21:44 +02:00
Assam Boudjelthia
edc024e826 Android: handle quoted args passed to an app
Currently, arguments passed to the app through applicationArguments
extra bundle treat every space as an argument separator. This then
doesn't handle the case where an argument is a space separated quoted
multi-word. This is more apparent when androidtestrunner is passing
test arguments to the app where an argument can be a test case with
a data tag that contains a space, which then is treated as two separate
tag names.

This change makes sure that androidtestrunner quotes each argument,
and the app doesn't split the arguments list by spaces, but rather
passed the argument string directly to c++ where
QProcess::splitCommand() is used to get the correct set of arguments
that will be passed to main().

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-104730
Change-Id: I45d8ca979d90f2a383c84623f0eb2eec29bba727
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-08-11 13:21:44 +00:00
Joerg Bornemann
55af91f822 CMake: Put Qt-internal targets into a dedicated FOLDER
When loading a Qt CMake project in an IDE like Visual Studio, many
Qt-internal targets are visible, right next to the user's targets.  This
is inconvenient and confusing.

Use CMake's FOLDER concept, and put Qt-internal targets into a dedicated
FOLDER.

For that we introduce the new global property QT_TARGETS_FOLDER that,
analoguous to AUTOGEN_TARGETS_FOLDER, is the folder name for Qt-internal
targets.  By default, it's not set, nor is folder support enabled.

Change qt_standard_project_setup() to
- enable folder support
- initialize QT_TARGETS_FOLDER if unset
- initialize AUTOGEN_TARGETS_FOLDER to the same value if unset

Set the FOLDER property of qtbase's internal targets for user projects
to the value of QT_TARGETS_FOLDER.

Task-number: QTBUG-99808
Change-Id: I880ac7731f88faa83a384dcdec98b1b88ac6cc2e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-11 13:47:15 +02:00
Alexey Edelev
548440dd4b Remove HEADER_MODULE from qt_internal_extend_target
The current qt_internal_extend_target interface expects that the caller
will pass the HEADER_MODULE argument on each call. This is not correct,
since the argument doesn't affect the target internals, but only help to
decide how to modify the target according to its type. The target type
meanwhile can be always read from target properties. So this solution is
more consistent.

Change-Id: Ie84a2226ceb71cb5272670e5d43bdfc7a101360a
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-11 13:47:15 +02:00
Sona Kurazyan
c77c5b391e Move Q_STATIC_ASSERT* macros to qassert.h
This requires moving the include statement for qassert.h in qglobal.h
up, outside the #if defined(__cplusplus) check, to make the macros
available when __cplusplus isn't defined.

Also move qt_noop() up, before the include of qassert.h, this will later
go to a separate header.

Task-number: QTBUG-99313
Change-Id: I0f3f1ca77819a86623eebaf8adeba226c190fd37
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-11 09:43:30 +02:00
Sona Kurazyan
43b59a842a Move QT_SHARED, QT_STATIC and QT_CONFIG macos to qtconfigmacros.h
Change-Id: Icf4621fa22f41355f98ed38b47560706258b41b7
Pick-to: 6.4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-11 09:42:03 +02:00
Sona Kurazyan
22b16a1db1 Rename qtnamespacemacros.h -> qtconfigmacros.h
But keep qtnamespacemacros.h for now, some modules include it
explicitly, so need to change those to include qtconfigmacros.h first.

The plan is to move QT_SHARED, QT_STATIC and QT_CONFIG macros there too.

Change-Id: I945b3dfffbd9cd394a6cf42a36df6657d1703d5b
Pick-to: 6.4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-11 09:41:03 +02:00
Giuseppe D'Angelo
b779b8062c QTranslator: generalize a UNIX-only path
QTranslator builds a list of "candidate" names in order to find out
the translation file to load. Part of the name comes from the UI
languages, as determined by the QLocale object passed to load()
(via QLocale::uiLanguages()).

On UNIX this list of languages is processed by adding a lowercase
version of each language. In other words, if the list is something
like:

{"en-Latn-US", "en-US", "en"}

then it is changed to contain:

{"en-Latn-US", "en-latn-us", "en-US", "en-us", "en"}

(The last element is not needlessly duplicated, since it's already
fully lowercase.)

I am not sure why this is done only on UNIX: the commit introducing
this behavior predates public history. If I have to take a guess, it's
done because the language is then used to assemble a file name that
QTranslator tries to open. On UNIX file names are case sensitive, so
if the translation file is called "translations_en_us.qm" it would
fail to load under a "en-US" locale (the "-" -> "_" processing is done
later).

But what about Windows? In principle, turning the names in lowercase
is not necessary as Windows' filesystem is case insensitive; a
translation file called "translations_en_us.qm" will still be loaded
if opened as "translations_en_US.qm"...

... *except* if the file is in the resource system! In that case,
filesystem access is still case sensitive, and will fail to load the
translation file (which instead would load just fine on UNIX).

Plug this silly cross-platform difference by also lowercasing on
Windows.

Change-Id: I2573721e33d9da08f60a5bb56e35e4553cbe4efe
Pick-to: 5.15 6.2 6.3 6.4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-08-10 23:21:55 +02:00
Ivan Solovev
c4fabe37b9 Remove QSqlTableModel::setQuery(const QSqlQuery &)
... and simply use the public methods of the base class instead.

We can't completely remove it, so we just add it to removed_api.cpp

By removing the setQuery() method in the QSqlTableModel class, we
open up name lookup to the base class, where the const ref overload
was already deprecated in 14f9f00fdb,
and the proper replacements were provided.

[ChangeLog][QtSql][QSqlTableModel] The setQuery(const QSqlQuery &)
method is removed, because QSqlQuery cannot be copied correctly.
Use the public setQuery() overloads of the base QSqlQueryModel class
instead. They allow passing of QSqlQuery by rvalue ref, or creation
of the query by specifying query string and database object.

Task-number: QTBUG-105048
Change-Id: I6f47067af6b4769578d4de9dbdbbbc7504ddf4ad
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-08-10 22:38:24 +02:00
Ivan Solovev
2ca3044083 Make QSqlQueryModel::query() return a reference to the const QSqlQuery
Returning QSqlQuery instance by value does not make much sense,
because it cannot be copied correctly. Also, its copy constructor
and copy-assignment operators are deprecated from Qt 6.2.

[ChangeLog][Potentially Source-Incompatible Changes][QSqlQueryModel]
QSqlQueryModel::query() now returns a reference to the const QSqlQuery
object associated with the model.

Task-number: QTBUG-105048
Change-Id: I04a2aa377b17d770d2a9855040f8c730190484d8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-10 22:38:24 +02:00
Ivan Solovev
62859ccaa6 QtSql: establish removed_api.cpp for upcoming QT_SQL_REMOVED_SINCE
Pick-to: 6.4
Change-Id: I6614ed13deee733e0cc53b3d8bb6514b2c000a9b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-08-10 22:38:24 +02:00