Commit Graph

60846 Commits

Author SHA1 Message Date
Sami Shalayel
5bb745f62b _qt_internal_create_moc_command: clean up MOC's arguments
MOC was failing to compile due to invalid arguments passed by the CMake
scripts. Notably, because of the "-D" without option that might "eat"
the command behind it.

On Wasm, the empty "-D" argument was eating up the following "-o",
leaving MOC clueless about the "extra" arguments that actually followed
the "-o".

Cleanup the passed arguments in _qt_internal_create_moc_command
to avoid passing -D or -I without macroname or include path.
Also, it seems that -D was passed multiple times: fix the remove
duplicates feature of _qt_internal_create_moc_command to recognize all
duplicates: instead of removing duplicates and then joining the argument
lists together, first join them and then remove the duplicates.

Fixes: QTBUG-111717
Change-Id: Ibf8cd69f162e50afa43bc27e8c242240b92b1a25
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-07 16:48:32 +01:00
Tor Arne Vestbø
4e59a5252c macOS: Use non-native app modal message box from nested event loops
The NSAlert does not stay open when ran from a nested event loop,
so we need to fall back to the cross platform dialog. The window
modal dialog does not have this issue.

Fixes: QTBUG-111524
Pick-to: 6.5 6.5.0
Change-Id: I63fba0a092018bb19edeef78c06587455d752235
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-03-07 14:04:09 +01:00
Piotr Wierciński
4d09152344 Wasm: Hide resizing divs when the window is not resizable
Hide divs that are responsible for resizing the window and changing the
appearance of the cursor on this window if this window is not resizable.

Fixes: QTBUG-111618
Change-Id: I1948eaedf02fdd2a5289ae314521b3fd74ad7811
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-03-07 12:50:41 +01:00
Mikolaj Boc
79cc3ae201 Support filter list for file input when opening a file on WASM
The polyfill for file input on WASM now makes use of the supplied
filter list.
Some changes were introduced in the abstraction for filters so that
they are usable both for the new file API and the legacy file input.

Change-Id: Id6341be4d6a1647e17382d13da7be42491cfaf80
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-03-07 12:50:41 +01:00
Mikolaj Boc
c6183cfc7b Make manual tests use the usual wasm_shell.html
Manual tests are supposed to display UI and be assessed manually, but
currently they use the auto test runner by mistake.
Use the normal wasm shell to fix this and make them work like usual
applications.

Fixes: QTBUG-111753
Change-Id: I9d3c0ad56e913b73737c5b72087e82980989d8b8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-07 11:46:36 +01:00
Eirik Aavitsland
9273bcac7f Lancelot: fix a copy-paste error in the new drawPixmapFragment command
Caused crashes because of uninitialized variable

Pick-to: 6.5
Change-Id: I18f96e47b766415ad49e6a8515bbaa372b122cd3
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-03-07 08:13:55 +01:00
Christian Ehrlicher
12909d7c3d QSqlDatabase: deprecate QSqlDatabase::exec()
The note that QSqlDatabase::exec() is deprecated was added more than 12
years ago so it's time to also mark the function as such.

Change-Id: Ic5e7c31b3ff5b21e16e2640548cba1a4baaeeb1c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-06 23:14:49 +01:00
Volker Hilsheimer
386dcbf6b9 Silence warning about unsafe sprintf, use snprintf instead
Apple lets us know that:
  warning: 'sprintf' is deprecated: This function is provided for
  compatibility reasons only.  Due to security concerns inherent
  in the design of sprintf(3), it is highly recommended that you
  use snprintf(3) instead.

Pick-to: 6.5
Change-Id: I3130b3c7b636466b5e77adc5cb05ad4ce1faee11
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-06 23:14:08 +01:00
Volker Hilsheimer
cacc53e427 Silence warning, initialize variables before using
Pick-to: 6.5
Change-Id: I0e7db95bac48b5d79897402f23157d00c4abbdff
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-06 22:34:39 +01:00
Volker Hilsheimer
73f04faa07 Silence warning about deliberately using deprecated API
We test moc's support for [[deprecated]], so don't warn about it.

Pick-to: 6.5
Change-Id: Ifda2b81c14cb9802db4bb1d0a1eb17d978ad492a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-06 22:34:39 +01:00
Kuntal Majumder
05a7cbef5b Allow building with llvm-clang in macOS
Supressing the linking warnings on macOS are relevant when we are
using AppleClang and not upstream Clang.

The provided arguments do not apply to llvm-ar and llvm-ranlib.

Change-Id: I8b664c01802b47077eb0ab80dab7681ee0bfcaa9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-03-06 21:54:43 +01:00
Alexandru Croitor
a804ac3d88 CMake: Relax example dependencies to be per-repo
When doing a top-level build with ExternalProject examples, it doesn't
make sense to make qtbase examples depend on e.g. qtdeclarative
plugins. Instead the qtbase example should only depend on plugins
built in qtbase.

Create per-repo custom targets that depend on all plugins built within
that particular repo.

Create an additional per-repo target which depends on all
plugins built in that repo, as well as plugins from dependent repos.
Use the latter as a dependency for examples built as part of the
current repo.

Repo dependencies are parsed from dependencies.yaml.

Pick-to: 6.5
Fixes: QTBUG-110913
Change-Id: I149860cc549caf53271c9ea296eb7bac2a663715
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-06 18:54:00 +01:00
Volker Hilsheimer
2e6de6f8b2 Doc: fix links to changed or renamed i18n pages and sections
Pick-to: 6.5 6.5.0
Change-Id: Ibe00b793ae0943cdbbcfa272e5cae4e91da5bf7d
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-03-06 18:52:35 +01:00
Amir Masoud Abdol
93a378b295 Silence a few unused-but-set-parameter warnings in some of the tests
Change-Id: I8cf3e4764ae50011d691dec6f52a355ddfb0ce7b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-06 17:16:14 +01:00
Morten Sørvig
ba724a2ded wasm: set stack size to 5MB again
Recent Emscripten 3.1.27 reduces the stack size to 64KB,
which is way to small for Qt-based applications.

Restore the previous stack size (5 MB) by setting STACK_SIZE.

Change-Id: I6c25e31b32dc1d551fa423655fcef4891830bcd1
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2023-03-06 14:06:07 +00:00
Christian Ehrlicher
28d5da386f SQL/Tests: remove some unused functions
remove toHex() as it's not used at all and qTableName() with two params.
Also remove some SQLite 2 specific stuff

Change-Id: If285febdfbee5833f7174d70f386bd54674bd539
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-06 15:06:07 +01:00
Ulf Hermann
5123645831 QMetaObject: Drop hand-optimization of strcmp
Comparing the first character ahead of a strcmp() call is unlikely to
result in faster code than just calling strcmp() right away these days.
Any compiler worth its salt should have a specialization of strcmp()
that uses platform-specific tricks to produce the best performance.

Change-Id: I80b74e698a6636d056b44cbef372edcb417534eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-06 08:41:19 +01:00
Marc Mutz
b955648224 QDBusError: don't refer to a QT_NAMESPACE'ed get() as ::get()
This code predates the public history. I don't know exactly how this
worked before, but I guess it's because the QT_USE_NAMESPACE in our
headers.

If there's _any_ get() function at the global scope, then name lookup
stops there and considers _only_ that function. And if that happens to
have a compatible signature, good night.

Use unqualified lookup instead. That will find the QT_NAMESPACE one,
ignoring other overloads at global scope. And when non-namespaced,
will emit an ambiguity error in the presence of another matching get()
function at global scope.

Task-number: QTBUG-111598
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Iea141ea543193394ba527b414caf31c1f3a2355b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-05 21:57:21 +01:00
Marc Mutz
28f56f29bb Short live q23::forward_like!
Following https://eel.is/c++draft/forward#lib:forward_like
step-by-step.

Temporarily add a q23utility.cpp to contain the static_assert()
tests. There's no point in establishing a tst_q23utility just to run
six static assertions. Should remove the .cpp again once an in-tree
user exercises the function with the same coverage.

Task-number: QTBUG-111598
Change-Id: Icb18eae089d65ca4e555921dbb71e74a7e255645
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-05 21:57:18 +01:00
Ahmad Samir
4bc0f4fbec QMutex: add missing include
Change-Id: I43dba6811e7a31990e767d7ca13fdd518109217e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-05 14:24:34 +02:00
Ahmad Samir
0f0b9bd2cf QCompilerDetection: fix compiler warning about undefined macro
build/include/QtCore/../../../src/corelib/global/qcompilerdetection.h:546:7:
warning: '__cplusplus' is not defined, evaluates to 0 [-Wundef]
 #  if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
      ^

build/include/QtCore/../../../src/corelib/global/qcompilerdetection.h:648:7:
warning: '__cplusplus' is not defined, evaluates to 0 [-Wundef].
 #  if __cplusplus > 201103L
      ^

Change-Id: I8ed8e0c4b93977238986df0b3339ffae4d1d0fda
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-05 13:22:01 +02:00
Piotr Wierciński
073848f3c4 wasm: fix respecting minimum size of QWasmWindow
Minimum size of QWasmWindow was not properly enforced.
Make sure that minimumu size constraints are respected
when the QWasmWindow is created, resized manually or
changed by setGeometry().

Fixes: QTBUG-111162
Change-Id: I2984b0836b5b53f9163275153d734cb1d81ef3b6
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-03-05 09:31:06 +01:00
Volker Hilsheimer
9e31631557 Doc: fix link to QTest::failOnWarning
Also fix incorrect failOnWarning*s* elsewhere in comments.

Pick-to: 6.5 6.5.0
Change-Id: I0bbc5e71060348153876f3d9a7c77c67f3c2e00d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-03-05 06:00:39 +01:00
Volker Hilsheimer
9ec61d4460 Port QPathClipper test away from home-grown QCOMPARE
Use a scope guard to print debug info in case of an early return.
Silences clang warning about sprintf being unsafe and deprecated.

Change-Id: Idcbfde1a6f2eb1143f51c1e5ecedbf3fe90d8ec8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-03-05 06:00:18 +01:00
Volker Hilsheimer
47df0eb513 Doc: fix QOpenGLWidget::defaultFramebufferObject documentation
Fix the link to QSurfaceFormat::StereoBuffers, and clean the text up
a bit. If everything is a \note, then we might just as well not have
notes, so move the statement about when this function is useful out
of a note, and combine the statements elaborating on ownership and
lifetime of framebuffer and contexts into a single note.

Pick-to: 6.5 6.5.0
Change-Id: I7cb1f9ff78ba760e99d639550130f5c833ad684a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-03-05 06:00:11 +01:00
Volker Hilsheimer
3ff66569ea Doc: Fix syntax error
Amends e0ecb0ded2

Pick-to: 6.5 6.5.0
Change-Id: If315d97e93047a8bece36c727c7646d30eb7458b
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-03-05 06:00:02 +01:00
Thiago Macieira
8413824ca0 qsimd_p.h: remove LZCNT feature from the ARCH_HASWELL list
And for good measure, I'm also removing BMI2. The one we really care
about ensuring gets enabled instead of -mavx2 is FMA anyway.

Complements commit 29d3938aa5 (which in
turn complemented commit a98cf15ed1),
which removed BMI1 because AMD introduced it before AVX2. Looks like
they also introduced LZCNT in some earlier processor too (family 10h) or
GCC 12 began emitting __LZCNT__ for that family -- IIRC the AMD feature
list was bigger than just the lzcnt instruction.

Fixes: QTBUG-111698
Pick-to: 6.4 6.4.3 6.5 6.5.0
Change-Id: I7f354474adce419ca6c2fffd1748f5b24f69a692
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-03-04 10:59:56 -08:00
Thiago Macieira
2a19c7ed13 QNetworkInterface/Unix: replace one Q_ASSERT with static_asserts
This requires compilers with constexpr offsetof(), which Clang seems to
be since at least 3.0 and GCC since 4.7, both of which are way older
than anything we need to support.

Pick-to: 6.5
Change-Id: I7f354474adce419ca6c2fffd1748b3dcfc616f4a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-03-04 10:59:44 -08:00
Tor Arne Vestbø
e2446afaa1 qmake: Resolve target suffix based on Qt build config for static plugins
The qtPlatformTargetSuffix() function is used in various places to
determine the suffix of targets based on the config, which for macOS
will result in a _debug suffix in debug mode.

This becomes tricky when one project built in debug mode tries to depend
on the libraries/plugins of another project (Qt) built in release, as
the qtPlatformTargetSuffix() function uses the current CONFIG as input,
which may be different than the QT_CONFIG (or CONFIG of whatever project
is being depended on).

For libraries this was fixed in 50e664835b
by iterating all known library paths, and trying the CONFIG suffix before
falling back to release version.

For plugins this was never solved, which becomes an issue when linking
to static plugins, either in a fully static build of Qt, or when some
of the plugins are static (permission plugins e.g.).

In this situation, the user project has to have the same configuration
as Qt was built with, to avoid errors like:

 error: no such file or directory: '~/6.x-static/qtbase/plugins/platforms/libqcocoa_debug.a'

To work around this, we assume that a plugin installed into the Qt
tree has the same build configuration as Qt itself, then then use
QT_CONFIG as the determining factor when linking to the plugin.

This still ties the build config of the plugin to the config of Qt,
but relaxes the relationship to the application, allowing it to be
built in either debug or release, which is an improvement to the
current state.

Pick-to: 6.5 6.5.0
Task-number: QTBUG-110356
Change-Id: Icee67fc01313a6c6f34178a6345ccae1b57429d7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-04 16:54:56 +01:00
Tasuku Suzuki
0bbf817589 Fix build with -no-feature-animation
Pick-to: 6.5
Change-Id: Ibd786bc140051ed09d65c6a784ad52c6a1ef7987
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-04 09:45:41 +00:00
Tasuku Suzuki
45df0ed246 Fix build with -no-feature-lineedit
Introduce a new feature for password dialog in cups that needs several widgets

Pick-to: 6.5 6.5.0
Change-Id: I93799b814ac06e661c19cffcd7d3c9bfa56ff814
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-04 09:45:21 +00:00
Edward Welbourne
58f5ec35f1 Doc fix in QIntValidator::validate() and comment on a test
The doc said positive values for a negative range were intermediate
but the code actually rejects them if the value has an overt plus
sign, so make clear that intermediate is only for the case without a
sign. Incidentally comment on a test where it might not have been
obvious to the reader that a space is the locale's digit-grouping
chracter.

Pick-to: 6.5 6.5.0
Change-Id: I3edab74fe8c2cbe8448c0e523676f1fd0d0d8a9f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-03 23:19:23 +00:00
Ahmad Samir
6f9ace5685 QSignalSpy: add wait(std::chrono::milliseconds) overload
Make the wait(int) overload call the new one.

Task-number: QTBUG-110059
Fixes: QTBUG-100041
Change-Id: Ia085453c05e09e219ba56010b2504113bbc1dd34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-03 21:36:55 +02:00
Ahmad Samir
2a495c2596 QTestEventLoop: add enterLoop(std::chrono::milliseconds) overload
Task-number: QTBUG-110059
Change-Id: Ibf1d76afd313e390103be4a22e44af7fb41ace1b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-03 21:36:48 +02:00
Ahmad Samir
855a6cb676 Use utimensat instead of utimes
From the manual page:
Note: modern applications may prefer to use the interfaces
described in utimensat(2).

Change-Id: Ib20d8b9b50626233852ca351452ce90841a39603
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-03 21:36:01 +02:00
Volker Hilsheimer
d48dbafeb2 Doc: fix qdoc warning, explicitly qualify enum type
Pick-to: 6.5 6.5.0
Change-Id: Ie289f2468a3a71d35696907691586a31f70d5b1e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-03-03 20:05:27 +01:00
Volker Hilsheimer
c1cbb12e57 Doc: fix links to qFuzzyIsNull
The function is in the QtNumeric documentation context.

Pick-to: 6.5 6.5.0
Change-Id: Ibc6a8961bc04efd4ab1eb50bb371e6a169d513dc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-03-03 20:05:27 +01:00
Marc Mutz
fd17eaca83 tst_QVariant: check fromValue() with a non-default-constructible type
... by just using fromValue() instead of the QVariant(QMetaType,
void*) ctor.

Code coverage isn't reduced, because fromValue() will, of course, call
that exact ctor itself.

Amends df0085d3a2.

Pick-to: 6.5 6.4 6.2
Task-number: QTBUG-105140
Task-number: QTBUG-111598
Change-Id: I02464803090fa7078947625616e6fc20e623ef31
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-03 20:05:27 +01:00
Marc Mutz
cbb484b713 qstrncpy(): document that we don't implement strncpy() fill-all-[dst,len)
The Windows version didn't, ever since we started using strncpy_s(),
and we might change the non-Windows version, too.

Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Iee1c09674d296be806d4be42b1891940120b4a01
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-03 18:16:22 +00:00
Ievgenii Meshcheriakov
eea83bac26 dbus examples: Remove listnames example
Task-number: QTBUG-111366
Pick-to: 6.5
Change-Id: I5c483cbfec4072dae610c6d98b97d10057ba9ddc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-03 12:46:29 +01:00
Liang Qi
2b94453cbd xcb: ignore the xscreens which don't belong to current connection
This amends 9a4c98e556.

When a X server has multiple xscreens, for example, ":0.0" and ":0.1",
a Qt application, which uses ":0.1" as display, can't use the randr
monitor from other connection(":0.0") to show contents there. Then
we don't need to generate QXcbScreen for them.

Pick-to: 6.4 6.5
Fixes: QTBUG-110898
Change-Id: I04c1512664b763ffabb55b75db4411d100536255
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-03-03 07:42:21 +00:00
Marc Mutz
a53429c1ec [docs] Fix typo in QMessageAuthenticationCode::reset() documentation
Pefer → Prefer

Pick-to: 6.5
Change-Id: Ie9fd09452f5d99d799a045ee59fc11a2b9c5a599
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-02 21:37:10 +01:00
Marc Mutz
50389d4973 Mark QMessageAuthenticationCodePrivate::initMessageHash() as noexcept
It only calls other noexcept functions:
- QCryptographicHash::addData(QByteArrayView)
- xored()

Pick-to: 6.5
Task-number: QTBUG-111688
Change-Id: Idd8c485a48b8243b359638086c373288c1c6f96d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-02 21:37:03 +01:00
Marc Mutz
590172ccc5 QMessageAuthenticationCode: port Private::setKey() to QByteArrayView
The only change is the signature of the function.

Also mark it as noexcept. It calls all functions in-contract and
doesn't allocate memory.

Task-number: QTBUG-111676
Pick-to: 6.5
Change-Id: I505c1f51da704fd46e538a68d6d8703f7cdefbc8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-02 21:36:50 +01:00
Volker Hilsheimer
76c63936d3 macOS: Send a filename QFileOpenEvent if invalid URL, deprecate openFile
When the string we receive from the system doesn't parse into a valid
QUrl (because QUrl requires a valid IDN), then we shouldn't send the
QFileOpenEvent based on that invalid QUrl, but instead pass the string
through as the file name.

The file name is anyway not guaranteed to be path to a file that can be
opened, as per the existence of QFileOpenEvent::open and the repective
documentation stating:
"some files cannot be opened by name, but require specific information
stored in this event."

However, that API is not useful at all, the implementation just opens
the passed-in QFile, using the stored file name. There's no way
to override this, and QFileOpenEvent is a locked class with all data
stored inline. So we can't even redirect to a platform-implementation.
Deprecate that function. Applications should interpret the string
returned by file(), which might not be a path to a local file.

Fixes: QTBUG-98384
Change-Id: Iff75489de9d7c5fc034f44c0bda4963b2efb1925
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-03-02 18:58:03 +00:00
Edward Welbourne
ac6c7aa12f Simplify and relax UTF-8 locale override machinery for Darwin
There's no need to try the various permutations of the language
and region specific locales, as they all point back to the same
CTYPE in /usr/share/locale/UTF-8/LC_CTYPE

In addition, processes started from launchd come with an empty
locale environment (LC_ALL/LC_*/LANG), and hence will default
to the "C"/POSIX locale, even after picking up the environment.
This primarily applies to applications launched from Finder,
but also affects processes launched as background services.
And since a child process will inherit its parent's environment
the empty locale environment is propagated when running apps
from IDEs such as Qt Creator or Xcode, or commands in an SSH
login session (as sshd is a background service), unless the
environment has been explicitly set up by the shell (Zsh).

Since neither of these situations is the result of user
misconfiguration, it makes little sense to spit our a
warning.

We however still warn if we detect that the character
encoding has changed from the default "C" encoding, or
if the encoding is "C", but we detect that the user has
modified any of the relevant locale environment variables,
as this indicates either a change in the system default
behavior, or that the user has explicitly requested a
"C" locale, which is wrong.

Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Fixes: QTBUG-111443
Pick-to: 6.5.0 6.5 6.4 6.2
Change-Id: I6fd14d1f8adddc2914d6ff4d3b5ad34a3871ef82
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-03-02 18:39:10 +01:00
Edward Welbourne
fff9395c28 QCoreApplication::initLocale(): Improve warning on failure
If we fail to set a UTF-8 locale, the warning claims Qt shall use a
UTF-8 locale, for which it reports an empty string, when in fact it
isn't using a UTF-8 locale, although it'll interact with the system as
if it were.

Also, the user is liable to understand "system locale encoding" as
referring to the underlying system rather than whatever they may have
configured in a local shell; and a non-native speaker assures me the
use of "shall" is also apt to confuse; so reword the messages.

As the old locale is only needed for the code path prints the
warning we can defer resolving it until we know we're going to
use it, by querying the locale at that point.

Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Pick-to: 6.5.0 6.5 6.4 6.2
Change-Id: Ie6a6e7a707200e58335fcb64cb1584f0c307895a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-03-02 18:39:10 +01:00
Edward Welbourne
91bea4470e Tidy up QCoreApplicationPrivate::initLocale()'s #if-ery
Explain each exception cleanly and as itself, thereby avoiding the
need for long and tangled #if-ery conditions.

Make sure to setlocale(LC_ALL, "") everywhere we think we have
initialized the locale, including Integrity - it plainly has
setlocale(), since we call it for LC_CTYPE - since we should at least
give it the chance to set its implementation-defined default locale,
instead of the standard-defined POSIX locale in use on entry to
main().

Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Pick-to: 6.5.0 6.5 6.4 6.2
Change-Id: Iab00984ba45dfc9a324b6a3c12e3d330b655a5a9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-03-02 18:39:10 +01:00
Laszlo Agocs
7cf6c57648 Avoid incomplete textures in GL paint engine
...which can happen if the OpenGL implementation reuses IDs
so that a glGenTextures results in the same ID that was used
by a texture destroyed by glDeleteTextures just before.

In this case the lastTextureUsed tracking needs to be aware
and invalidate, otherwise the newly created texture is
assumed to be already existing (the ID is the same as before
after all), and so operations such as setting the minification
filter is skipped (which is fatal with OpenGL given that we
do not use mipmaps).

This is exercised in practice by the drawPixmapFragments test
introduced in the previous patch. On Intel graphics it would
work, but it does not render correctly with NVIDIA due to how
the driver's internal ID handling works.

Pick-to: 6.5.0 6.5 6.4 6.2
Change-Id: Ic2771fe9a2dec7da4aa3804d8498dd89e3c18415
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-03-02 17:39:10 +00:00
Laszlo Agocs
d6c5a2f917 GL paint engine: Fix drawPixmapFragments when using buffer objects
Until recently the buffer object-based code path (so not client-side
pointers) was only hit with a core profile context. This changed at
some point in 6.4 and later to support WebGL (that has no client-side
pointers, unlike OpenGL ES 2.0 it is based on). Now buffer objects
are preferred over client-side pointers, always. Problem is,
drawPixmapFragment() was never functional on this code path, it seems.

Expecting that transferMode() does all the uploadData() needed is wrong.
transferMode() bails out if the mode is the same as before, and that's
exactly what happens when an application calls drawPixmapFragments()
on the painter twice, after each other.

How exactly this works with client-side pointers is not fully clear, but
presumably the data buffer address stays the same so all pointers passed
in to the glVertexAttribPointer calls are valid, and it sources the data
for each draw call (probably), thus the rendering is all correct even
though only the first, not the second, drawPixmapFragment() led to
calling uploadData() internally.

Amends e487b07e18 although this patch on
its own is just as applicable pre-6.4 as well (to fix drawPixmapFragments
when using a core profile context).

Pick-to: 6.5.0 6.5 6.4 6.2
Fixes: QTBUG-111416
Change-Id: I2ad358424e613192a51b99b937aef7660f5dbe08
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-03-02 17:39:09 +00:00