Commit Graph

47036 Commits

Author SHA1 Message Date
Alexandru Croitor
ca103f357c CMake: pro2cmake: Reformat files using black
Change-Id: Ic06840f9877d6b863f48a5eb97fcd6735ab9bde8
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-07-31 12:55:33 +02:00
Alexandru Croitor
e755ce99d9 CMake: Regenerate load(qt_app) projects
To use the new qt_internal_add_app function.

Change-Id: I9776ce18c3a8b01f1a42e8da346cfd0a98374ef8
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-07-31 12:55:33 +02:00
Alexandru Croitor
d65283ebd0 CMake: Teach pro2cmake to convert load(qt_app)
Changes pro2cmake to handle load(qt_app) projects and write out
qt_internal_add_app calls.

Also adds handling of macOS and Windows specific resource files for Qt
apps only.

Task-number: QTBUG-85757
Change-Id: I994d8d19ab2ae366a985cab7894b97d6a278a56f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-07-31 12:55:32 +02:00
Alexandru Croitor
b3b1e47378 CMake: Introduce qt_internal_add_app
This new function is meant to be used where load(qt_app) is used.

It delegates functionality to qt_add_executable, while handling
some additional behavior via a finalization function (mostly handling
of macOS Info.plist files and icons, as well as Windows icons and
resource files)

It uses a new PlatformAppInternal interface target.

Task-number: QTBUG-85757
Change-Id: I1a2d5851b137fcd4a6323e0e06fb154f91619800
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-07-31 12:55:32 +02:00
Alexandru Croitor
704e215295 CMake: Regenerate projects
Change-Id: Iac12acd07513e790e531ae93366fdae70c1c61a5
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-07-31 12:55:32 +02:00
Fabian Kosmale
cb80720287 Expose QMetaTypeInterface::alignof in QMetaType
We already have the information in the QMetaTypeInterface, and provide
functions to access sizeof. Adding alignof support seems natural, and
should make it easier to handle over-aligned types.
This should also be helpful in QVariant.

Change-Id: I166be76f4b7d2d2e524a3a1e513bd2f361e887c1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-31 09:46:54 +02:00
Thiago Macieira
61ccfefb25 Fix warning in QStringView::compare(QChar) on qsizetype->int
size() - 1 is converted to int as the result, but size() is a qsizetype
and could be bigger than INT_MAX. So rewrite to not depend on the cast.
This was introduced on b2f79cceb1.

I could have replaced size() - 1 with int(size() > 1) - 1, but that's
even more complex. To simplify, I split the function in two while
retaining the C++11 constexpr requirements.

Bonus: removes the use of the ambiguously-named "empty()" function that
looks like a verb.

Fixes: QTBUG-85665
Pick-to: 5.15
Change-Id: Ieffc3453b88c4517a1dbfffd162338fdb084a376
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-30 20:29:23 -07:00
Thiago Macieira
caa40f57d4 QLocale: update qt_asciiToDouble to use qsizetype
No need to change the output variable from int to qsizetype. That would
complicate the use of libdouble-conversion, which uses ints.

Change-Id: Iea47e0f8fc8b40378df7fffd1624bfdba1189d81
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-31 03:29:11 +00:00
Edward Welbourne
2ab4fe2ac8 Be clearer about the locale-aware comparison QString supports
The docs didn't make clear that there's a case where a rather poor
locale-aware compare may be in use - which turns out to be in use on
Android.

In the process, stop duplicating (in two slightly different variants)
the same paragraph in many places when we can use a \sa to refer to a
sub-section of the class doc.

Pick-to: 5.15
Task-number: QTBUG-63518
Change-Id: I5a41b0a269e477e74236131310992e70462734d7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2020-07-30 13:15:42 +02:00
Allan Sandfeld Jensen
a57419b10d Document run-time acceleration of using the conversions functions
Pick-to: 5.15
Change-Id: I985b93135b9d8fdfdd64e9183b23cbf8a7b4e3eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-30 09:52:24 +02:00
Tor Arne Vestbø
7940851863 Fix no-PCH build on Apple platforms
Change-Id: I5257af8079e6b2f26893d1bc44adb48ad4a1684b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-29 20:34:17 +02:00
Tor Arne Vestbø
47cb6ad698 Don't capture this explicitly in tests
Some compilers implicitly captures, and will warn about the unused capture.

Change-Id: Ib5e1cc3956c7eb0dc87cee834cce8a2b3dd0d30b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 18:34:16 +00:00
Tor Arne Vestbø
3d03f4e989 Register QPlatformBackingStoreOpenGLSupport when needed
Static builds can not rely on a constructor function in the QtOpenGL
library, as that will be linked out unless something in the application
pulls it in.

Instead we export a helper function that clients that depend on
OpenGL support in QPlatformBackingStore can use to bring it it.

Change-Id: Ic54058bf413a476287884c78df5624b862f97695
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-07-29 20:34:15 +02:00
Volker Hilsheimer
d14cf6d3d9 QFileInfo: Fail faster when stat'ing filepath on a disconnected drive
The Windows implementation of QFileSystemEngine tries hard to fill the
metadata for a file, even if GetFileAttributesEx returns with error.
This is good in many situations, but when the error code indicates that
the drive on which the file resides has been disconnected, then we
should fail quickly.

Task-number: QTBUG-6039
Pick-to: 5.15
Change-Id: I7574c5a2e524e913306d0b470b4f227416442c13
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-07-29 20:03:50 +02:00
Alex Trotsenko
8969070cfd QEventDispatcherWin32: redesign event notifiers activation
The previous implementation multiplexed callback-based event
notification into a single proxy event (cf. 85403d0af), which was
in turn object-waited for (this was the case since the beginning
of public qt history). It makes more sense to multiplex into a
posted message, because that also works with foreign event loops
that do not know anything about our event objects.

Task-number: QTBUG-64443
Change-Id: I97945ac8b5d7c8582701077134c0aef4f3b5a18f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 18:34:34 +03:00
Alexandru Croitor
9d55d6b45b CMake: Fix building debug apps with qmake on Windows
Our CMake build system only generated working .prl files for
the Release configuration in debug_and_release.

This caused a linking failure when building a Widgets example that
links against qtmain, specifically

qtmaind.lib(qtmain_win.cpp.obj) : error LNK2019: unresolved external
symbol __imp_CommandLineToArgvW referenced in function WinMain

The symbol is located in shell32.dll, which was not linked in, because
there was no qtmaind.prl file.

The fix to generate per config prl files is a bit complicated, because
add_custom_command does not support generator expressions in OUTPUT
and DEPENDS.

Instead we pre-generate 2 files per config, one with the preliminary
prl file content and another file that contains the final prl file
path (via generator expression).

Then we iterate over all configurations and create custom commands
with well known paths, and the final prl file is created by the script
called by the command.

Amends 06557312d2

Task-number: QTBUG-85240
Change-Id: I413b705bc69732b0cbe1ee8cd089a1aef19365db
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-07-29 17:33:15 +02:00
Alexandru Croitor
7b9904849f CMake: Fix _nolink targets to be optional on the consumer side
On Windows, if Qt is built with Vulkan support but the user's machine
does not have Vulkan, it should still be possible to configure and
build an application (if the application does not use Vulkan of
course).

When Qt is built with qmake, the special windows_vulkan_sdk.prf file
makes sure not to export build time Vulkan include headers into the
generated .pri files. The same file also tries to find the include
headers via an environment variable. If it isn't set, it just adds a
bogus "/include" include path, which doesn't fail a user's application
build.

This wasn't the case for an application built with CMake, because the
exported Vulkan_nolink target uncodinitionally referenced Vulkan's
target properties. Which means that if the Vulkan package was not
found, the application failed to configure.

To mimic qmake's behavior, make sure to query the target properties
only if the Vulkan target exists, via the TARGET_EXISTS generator
expression.

Apply the same logic to all _nolink targets. This might not be
entirely correct in all cases, but we can revise this behavior later
after more feedback. At the very least it allows building non-Vulkan
based applications.

Task-number: QTBUG-85240
Change-Id: Iffbb03a84e8637ed54d0811433e66fe6de43d71f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-07-29 17:33:14 +02:00
Laszlo Agocs
071fc289c4 Re-enable tst_qrhi on Linux
Not sure why this was disabled in the first place.

Change-Id: I66329b55fd46d03fd96818c6c7004718ddea5c79
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-29 15:04:19 +02:00
Alexander Volkov
2b781fd678 Revert "Add missing override" for 3rdparty vk_mem_alloc.h
This partially reverts 9bad3508fc.
Disable -Wsuggest-override for gcc when including the header
instead.

Change-Id: Id2507ce731da62bbd64aa6477b181735ba62adc1
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-07-29 15:35:01 +03:00
Tor Arne Vestbø
e7ade60925 Add missing override in tst_QSortFilterProxyModel
Change-Id: I8ffe92cd5a68bf86688e1d942d079ac6ff115d11
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:48 +02:00
Tor Arne Vestbø
b535a67910 Fix warning when comparing qsizetype to size_t
Change-Id: I4ea7ccb4daf05c735c831964f94c120d179521dd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 12:33:33 +00:00
Tor Arne Vestbø
9023791a45 Fix warnings about unused expression results in tests
Change-Id: I401ec8a3742a5bb51a1b8b291c53395c3880117c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:29 +02:00
Tor Arne Vestbø
6f17509ad9 Fix warnings about unused members in tests
Change-Id: I741cf08c26f8a2e297926cc01968ff09e70462a2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:24 +02:00
Tor Arne Vestbø
dfeedc17a2 Disable deprecation warnings in some tests
The tests are testing deprecated functionality, which we
still want to test.

Change-Id: Iad6ed35800896170c17fe019c7a6ecda22398ac3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:23 +02:00
Tor Arne Vestbø
57337f21c7 Add missing braces when constructing BigConvertible in tst_qvariant
Change-Id: Ia571e8950aa28721080dc7434921b79ffda913f4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:20 +02:00
Tor Arne Vestbø
f8d1e16da0 Add missing enumeration case in tst_QMacStyle::setSize
Change-Id: Iade36b03c6f8bdaa8feb82ef89744a399f92e21d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:19 +02:00
Tor Arne Vestbø
9b8695998b Add proper dependencies for doc snippets
On iOS the plugin is statically linked into the app. We need to wait
for the plugin library to build before we can build the snippets.

Change-Id: I79c89c5615f16d63a46c25481c9a40bf2b4a7eaa
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
2020-07-29 14:12:54 +02:00
Tor Arne Vestbø
7fdb47862c iOS: Add Metal framework as dependency
Change-Id: I7d8d8cef8252a65378b24af1ade87bb484d5fa68
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-29 13:54:26 +02:00
Tor Arne Vestbø
19d32f0a5f Add QOperatingSystemVersion support for macOS Big Sur
Pick-to: 5.15
Pick-to: 5.12

Change-Id: Ide57f675b20b08210f301da5177df45d008423c4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-07-29 13:25:28 +02:00
Tor Arne Vestbø
3e71e2e851 Fix build of testlib doc snippets
The file src_qtestlib_qtestcase was built twice,
causing duplicate main symbols

Change-Id: I18750b87eee27603d9f56129fd6c30fddf4a4828
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
2020-07-29 13:22:12 +02:00
Oliver Wolff
e9056a5c0a Update sync.profile with recent module hierarchy changes
These platformsupport modules were moved into gui or opengl or
removed completely. They are no longer needed in sync.profile.

Fixes: QTBUG-85784
Change-Id: I5ca141c6f612bdd3e63c4eaf375b7ef2f6a1314c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-29 10:54:59 +02:00
Friedemann Kleint
ed114b728d Windows: Prevent event processing during QDesktopServices::openUrl()
The platform implementation uses the Win32 API ShellExecute(),
which may spin an event loop to do COM processing, causing things
like QMetaCallEvent being processed. Run it in a thread
to suppress this.

Pick-to: 5.15
Fixes: QTBUG-85676
Change-Id: I240ca78b41b39ded22e466662ffce8e9b03c10a2
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-07-29 08:22:18 +02:00
Lorn Potter
44d4bc6d90 wasm: fix setTransferTimeout
WebAssembly does not need the http feature, but these functions were
hidden behind that feature.

Fixes: QTBUG-83867
Pick-to: 5.15
Change-Id: I7cd9aa73003f45ccbc2613c67c21e4067d6edddd
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-07-29 09:09:03 +10:00
Lorn Potter
762b5f09a6 wasm: fix network headers logic
Fixes: QTBUG-85083
Pick-to: 5.15
Change-Id: Iaf0f3365ee20fe257f3edac0e1105bdfcc5ba0da
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-07-29 09:09:00 +10:00
Allan Sandfeld Jensen
d782df4861 Make qfloat16 helper functions consistent with float/double versions
Infinite is only when the mantissa is 0, everything else is NaN.

std::isnormal returns false on zero.

Pick-to: 5.15
Change-Id: I897fc0dc3b8a9c557bb1922ea7ca8df501e91859
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-28 18:12:07 +02:00
Thiago Macieira
f16613f7ef QLocale: fix conversion of "\0" to double
That is not a valid conversion. An empty string is a valid conversion; a
string containing a null should fail.

Change-Id: Iea47e0f8fc8b40378df7fffd1624c088f3bd1b14
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-28 08:54:06 -07:00
Thiago Macieira
f50945b8fd QLocaleData: remove unused internal function
Pick-to: 5.15
Change-Id: Iea47e0f8fc8b40378df7fffd1624bf3469e66c90
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-28 08:54:03 -07:00
Thiago Macieira
efd3c7bf24 QByteArray::toDouble: fix buffer overflow reads on fromRawData()
If Qt was not compiled with libdouble-conversion, sscanf() requires
null-termination, which fromRawData() does not require. This could be
fixed by making QByteArray pass a reallocated copy if it is operating on
raw data, but fixing qt_asciiToDouble() means we catch all cases and we
optimize for the common case of not-horribly-long strings.

Fixes: QTBUG-85580
Pick-to: 5.15 5.12
Change-Id: Iea47e0f8fc8b40378df7fffd16246f6163b01442
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-28 08:54:02 -07:00
Shawn Rutledge
c13ce05482 Export the QMutable* event classes
They are needed often in Qt Quick.

Change-Id: I8f68798042dd7440958c8bc2b8fe7021af8ec34d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-07-28 17:32:14 +02:00
Timur Pocheptsov
c9a702a04d QSslSocket (OpenSSL, Windows) - make sure we ignore stale fetch results
The CA fetcher on Windows works on a separate thread, it can take
quite some time to finish its job and if a connection was meanwhile
closed (via 'abort', 'close' or 'disconnectFromHost') but the socket
is still alive/re-used - we don't want to be fooled by the previous
fetch 'finished' signal, only if it's fetching for the same certificate.

Change-Id: Ibd0a70000ad10cff10207d37d7b47c38e615d0f1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-07-28 15:35:41 +02:00
Friedemann Kleint
964f5757ea Windows QPA: Move some internal functions to the new interface
Move createMessageWindow(), the GPU detection for qtdiag and the async
expose setting (used by Active Qt) from QWindowsNativeInterface to
QWindowsApplication.

Remove unused registerWindowClass() and use logFontToQFont() directly from
the font database.

Task-number: QTBUG-83252
Change-Id: I9c72351970b47457d08125557c2580016c66e586
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-28 13:21:10 +02:00
Friedemann Kleint
2405aa9d67 Windows QPA: Move mime-type related classes to the new interface
Move QWindowsMime (which was a public class in Qt 4 and moved to the QPA
plugin in Qt 5) to the platform namespace and add register functions to the
native application.

Move in test code from QtWinExtras.

Task-number: QTBUG-83252
Change-Id: Iaac440e2d5cb370110919921b1eeb779600b5b65
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-28 13:20:23 +02:00
Timur Pocheptsov
904eaec9de QSslSocket (OpenSSL) - fix a minor type error
Change-Id: I76bf6c7d47c7d29228837bbb139a7f6a32de0e5e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-07-28 12:38:30 +02:00
Timur Pocheptsov
1482739002 QHostAddress: resolve API issues marked with ##Qt6
Also, remove the deprecated function and its auto-test.

Change-Id: If04a54c4b91e0f76523960c7b1a5bcb8fe883ac6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-28 12:38:15 +02:00
Alex Trotsenko
83f00b8229 QNativeSocketEngine/Win: fix write() in case of splitting
When a first call to ::WSASend() consumes less data than requested, we
are trying to make a second call, leaving 'bytesToSend' unmodified.

Instead of setting a new value for 'bytesToSend', it seems reasonable
to break the loop, if the system buffer overflow detected.

Pick-to: 5.15
Change-Id: I8038e95c20221518955efe786f2d0dadb98360fa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-28 10:40:18 +03:00
Fabian Kosmale
30395e9185 tslib: Add missing override annotation
Else developers fail to compile due to the newly added
-Wsuggest-override

Change-Id: I1fdcab794a8639a7cf2f6712e9ede6f25f7d3f69
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-28 09:29:33 +02:00
Allan Sandfeld Jensen
f26147b493 Replace Q_ALWAYS_INLINE with static inline
Static inline on functions serves the same purpose of keeping non-
inlined instances from different binaries from being mixed, and has the
benefit of being available across compilers.

Change-Id: I12467f6d887471d8fd70ff4623c473c2a5a45664
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-28 08:39:42 +02:00
Peng Wenhao
59e3073b1c Close memory leak in QTestLib support for string to numeric testing
QTest::toString allocates memory by calling qstrdup; that memory must
be freed by the caller.

Change-Id: I9724db0c617884cf08592968b1411f002ef23204
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-28 13:36:31 +08:00
Giuseppe D'Angelo
b71c8eb386 QCompleter: fix an out of bounds access in a QMap
If the iterator points to the map's begin(), then one can't
decrement it. Split the check and the decrement.

Change-Id: I3d816f13d0bcacc8253ba6d223bc83c874e5efb5
Pick-to: 5.15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-27 23:02:33 +02:00
Thiago Macieira
a77c159044 QWindowsServices: ungarble the URL
QUrl::toString always encodes as UTF-8, regardless of what the local
encoding is. So this produces garbage on Windows (and any non-UTF-8
system, but those don't exist any more outside of Windows, by
definition). So use %ls to keep the UTF-16.

Task-number: QTBUG-85745
Pick-to: 5.15
Change-Id: Iea47e0f8fc8b40378df7fffd162584f98e5bd633
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-27 13:39:38 -07:00