Commit Graph

45264 Commits

Author SHA1 Message Date
Volker Hilsheimer
eb3b37de83 Remove deprecated members from QtWidgets/itemviews classes
Cleaning up those that are trivial to remove because they have direct
replacements.

Change-Id: Ie9fecd8c4822ed1a8f378b210cc4c4d9a10f7e36
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-04-17 20:49:36 +02:00
Volker Hilsheimer
bd49862e8e Remove deprecated QTest::qWaitForWindowShown overload for QtWidgets
Not used anywhere in qtbase or other modules, so trivial to remove.

Change-Id: I98575e77f181e617675e536ff0dd67ac93a2f0f5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-04-17 20:49:18 +02:00
Volker Hilsheimer
714409b23c Remove deprecated members from QtWidgets/widgets classes
Cleaning up those that are trivial to remove because they have direct
replacements.

The QLabel changes to the pixmap/picture getters provide the following
migration path:

QPixmap *ppix = l->pixmap(); // up to 5.15, warns in 5.15
QPixmap pval = l->pixmap(Qt::ReturnByValue); // new in 5.15, works in 6
QPixmap pixmap = l->pixmap(); // from Qt 6 on

The overload with argument can be deprecated after the first LTS or
so.

Change-Id: I8494ceeea55b2aeda0bd340640ad95cb7c91f7d6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-04-17 20:49:06 +02:00
Joerg Bornemann
30141b2fb7 CMake: Fix location of module .pri files for non-prefix builds
In a non-prefix build, the module .pri files must end up in the
mkspecs/modules subdirectory of qtbase's build directory.

Change-Id: I241f4e274d31de7c1e3c2fa8e5e26fb8747f11c5
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-17 20:42:44 +02:00
Joerg Bornemann
9b45ca7411 CMake: Port the 'cross_compile' feature
Change-Id: Iccd1d55e95797740a4a8689462ce9ab1e49a62c1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 20:42:42 +02:00
Joerg Bornemann
2e89c61f58 CMake: Write QT_BUILD_PARTS to qmodule.pri
Change-Id: I4bddba38b51df3c70780d94f64a31b3040cb0bc8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 20:42:37 +02:00
Joerg Bornemann
9fc13a1188 CMake: Write PKG_CONFIG_EXECUTABLE to qmodule.pri
Change-Id: Ide61cc93d44c659740b72d085fb8b15684bc64fa
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 20:42:35 +02:00
Alexandru Croitor
59756b7183 CMake: Generate qmake pri information for building with qmake
Implemented some necessary functionality to generate correct .pri
information, so that qmake can build modules.

Task-number: QTBUG-75666
Change-Id: I63281adfef3d01385928b1d8c4be0b32ac97c4d7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 20:42:18 +02:00
Joerg Bornemann
bfcf36d459 CMake: Generate qmake .prl files
This commit also adds a qt_finalize_module function that is called for
every Qt module after all link dependencies have been added.

Change-Id: I489d188d05e368208a8a62828bb12fb395df54bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 20:42:10 +02:00
Joerg Bornemann
6f5c91e985 configurejson2cmake: Remove mention of the system-xcb feature
This feature was removed in commit 60588e1a.

Change-Id: I061410dfab13a2210474014892d1bc828a5b21cf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 20:41:44 +02:00
Assam Boudjelthia
cc106ce565 Android: update Android specific variables docs
Android variable are missing from the list of QMake variables...

Task-number: QTBUG-80390
Change-Id: Ic10f96687334eea99c0302d7137685b1bf6e56c6
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2020-04-17 17:27:36 +03:00
Eskil Abrahamsen Blomfeldt
bad2ac47f8 Resolve OpenGL version functions in thread-safe manner
In 73f3f501f3, the classes were
moved out of Qt Gui, and a mechanism to attach them to the
QOpenGLContext was implemented using a QMap and a connection
on destroyed to delete it.

This solution was not thread-safe, so the suggestion was to either
add a mutex or to make an opaque pointer for the storage in the
(thread-affine) QOpenGLContextPrivate.

I decided to go with the latter. A solution using hash lookups
and mutexes seems to complex when the only benefit is to avoid
forward declarations from Qt Gui to Qt OpenGL in private API.

Especially since this dependency already exists with
the "textureFunctions", which serve the same purpose,
although the destructor is being passed in as an explicit
function pointer there, probably because the ambition was
to use a forward declaration rather than a superclass.

Fixes: QTBUG-82742
Change-Id: I5c6b82c5b33d9cb73ad1ec05d3fc3e87a9eae4cf
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-04-17 16:00:43 +02:00
Alexandru Croitor
d6272d774c CMake: Make sure not to use the Qt prefix for standalone tests
We don't want people accidentally installing tests into the
Qt prefix.

Change-Id: Ic99492559875f753897a83af162253cac846a8a5
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 15:59:33 +02:00
Alexandru Croitor
f4cd66ff0a CMake: Handle super build non-prefix install prefix correctly
The install prefix in such a case is the qtbase build dir,
and not the qt6 top-level build dir. This caused issues with
certain incorrect paths being generated, including a broken
qt-cmake-standalone-test script, as well as upon reconfiguration
determining that a non-prefix build should be installed.

The fix for a non-prefix build is to check explicitly for
the qtbase build dir. This works both for super and non-super
builds.

Task-number: QTBUG-83496
Change-Id: Ida2393176c4c81da767023ff48159afdedfb0a19
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-17 15:59:30 +02:00
Alexandru Croitor
67ee92f4d8 CMake: Handle automatic rpath embedding correctly
Instead of using CMAKE_INSTALL_RPATH to embed an absolute path
to prefix/libdir into all targets, use the more sophisticated aproach
that qmake does.

For certain targets (modules, plugins, tools) use relative rpaths.
Otherwise embed absolute paths (examples, regular binaries).
Installed tests currently have no rpaths.

On certain platforms rpaths are not used (Windows, Android,
iOS / uikit).

Frameworks, app bundles and shallow bundles should also be handled
correctly.

Additional rpaths can be provided via QT_EXTRA_RPATHS variable
(similar to the -R option that configure takes).

Automatic embedding can be disabled either via QT_FEATURE_rpath=OFF
or QT_DISABLE_RPATH=ON.

Note that installed examples are not relocatable at the moment (due
to always having an absolute path rpath), so this is a missing feature
compared to qmake. This is due to missing information on where
examples will be installed, so a relative rpath can not be computed.

By default a Qt installation is relocatable, so there is no need to
pass -DQT_EXTRA_RPATHS=. like Coin used to do with qmake e.g. -R .

Relative rpaths will have the appropriate 'relative base' prefixed
to them (e.g $ORIGIN on linux and @loader_path on darwin platforms).
There is currently no support for other platforms that might have a
different 'relative base' than the ones mentioned above.

Any extra rpaths are saved to BuildInternalsExtra which are re-used
when building other repositories.

configurejson2cmake modified to include correct conditions for the
rpath feature.

It's very likely that we will need a new qt_add_internal_app()
function for gui apps that are to be installed to prefix/bin.
For example for Assistant from qttools. Currently such apps
use qt_add_executable().
The distinction is necessary to make sure that relative rpaths are
embedded into apps, but not executables (which tests are part of).

Amends e835a6853b

Task-number: QTBUG-83497
Change-Id: I3510f63c0a59489741116cc8ec3ef6a0a7704f25
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-17 15:59:25 +02:00
Sona Kurazyan
e6d880e511 Move larger code examples in QFuture docs into snippets
Change-Id: I77b943124ac9c82f54b0c38e9437b9415604c21a
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
2020-04-17 15:38:43 +02:00
Sona Kurazyan
339dd743a9 Add an example of error handling of QFuture without using exceptions
Also fixed a few unrelated typos in docs.

Task-number: QTBUG-83236
Change-Id: I776cda8f0ef4de6c4a93e94092dc19e94d1884c8
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2020-04-17 15:38:34 +02:00
Mårten Nordheim
5c04b83715 QSocketNotifier::activated(QSocketDescriptor...) doc fixup
We agreed to make the type internal but somehow it slipped my mind to
actually label them as such.

Task-number: QTBUG-70441
Change-Id: Id90521ecc09bfa1db29601b96ba70bcdcb64d458
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-04-17 15:25:12 +02:00
Edward Welbourne
300aaec2f9 Fix digit grouping when digits are surrogat pairs
This is a follow-up to commit ed2b110b6a
to fix indexing errors. Added the test that should have accompanied
that commit, which found some bugs, and refined the Indian number
formatting test (on which it's based).

Make variable i in the loops that insert grouping characters in a
number be consistently a *character* offset - which, when each digit
is a surrogate pair, isn't the same as an index into the
QString. Apply the needed scaling when indexing with it, not when
setting it or decrementing it. Don't assume the separator has the same
width as a digit.

Differences in index no longer give the number of digits between two
points in a string, so actively track how many digits we've seen in a
group when converting a numeric string to the C locale. Partially
cleaned up the code for that in the process (more shall follow when I
sort out digit grouping properly, without special-casing India).

Change-Id: I13d0f24efa26e599dfefb5733e062088fa56d375
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-04-17 13:43:50 +02:00
Eskil Abrahamsen Blomfeldt
ad5aee2e34 Get rid of QT_OPENGL_ES*
The QT_OPENGL_ES* macros are leftovers from an earlier,
ad hoc configuration system, which has since been
replaced by QT_CONFIG. To clean things up in Qt 6,
we use the new way instead.

Task-number: QTBUG-83467
Change-Id: I578dc7695bff9d5ee303b22e44f60fee22fe0c28
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-04-17 11:50:24 +02:00
Eskil Abrahamsen Blomfeldt
009d583eef Minor tidying for header guard in qopenglversionfunctions_p.h
The original was too close to QOPENGLVERSIONFUNCTIONS_H for comfort
so to avoid future confusion or errors, just use the convention
of matching the file name.

Change-Id: I57fcc4da239ddec329f75ac29b254b5909c39bf0
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-04-17 11:49:50 +02:00
Lars Knoll
90f17d8584 Clean up memory
And remove a test failure when compiling with asan enabled.

Change-Id: I2b8e676665572adcbbac6a910983d5b209bf6d23
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-04-17 11:24:35 +02:00
Simon Hausmann
f395cedc5b Simplify signature of untyped property bindings
Instead of requiring the implementation to do the compare dance, let's
do this in the library. This reduces the amount of duplicated code
slightly and makes it easier to generate binding code from qml files.

Change-Id: Ia3b16cf9769e74d076b669efe4119ab84af3cdf0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-04-17 11:24:10 +02:00
Simon Hausmann
4857f0ebd7 Make it possible to take bindings from properties without private headers
Passing the QExplicitlySharedDataPointer by reference may lead compilers
to wanting to have visibility to the destructor of the contained type
(QPropertyBindingPrivate), which is not public. Fortunately
QExplicitlySharedDataPointer is safe to use with raw pointers and those
can be safely forward declared.

Change-Id: I131ab6363eaee10b6dce196fb2c769e09a5c9557
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-04-17 11:24:10 +02:00
Kimmo Ollila
23a6479715 Add mkspec for INTEGRITY Qualcomm SA8155P ADP
Change-Id: I3430868fb88f357c3d2d1d3cd8e00088aa26649c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-17 10:22:02 +03:00
hjk
300bd7fff8 rcc: Always seed the hash with 0
That was already done to pass the auto tests, but the randomization also
bites for reproducible builds.

Change-Id: Ibf4da513059deb5a806d2ac1a83c1994edf09d4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-04-17 09:02:22 +02:00
Alex Trotsenko
6ce4c7d002 QEventDispatcherWin32: relax memory ordering on setting wakeUps flag
There is no need in 'acquire' operation for the next reasons:

  - wakeUps is simply used as an atomic boolean that does not require
    ordering with other loads or stores;
  - any of testAndSet...() always gets a latest version of wakeUps.

Change-Id: Ica38fc62bc181166995946dee9d6887c71d87cec
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-04-17 06:36:03 +00:00
Lars Knoll
fd550c943f QString::from/toLocal8Bit: Assume locale is utf8 if we don't have codecs
If there is no text codec support, assume local8bit is utf8, not latin1.
This is in line with what 99% of all modern systems do.

Change-Id: I35ebcd43ef3572a25f549a8375857dcabcfec4ca
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-16 23:15:10 +02:00
Lars Knoll
0b12b7f518 Fix compilation with QT_RESTRICTED_CAST_FROM_ASCII
Fix the QString constructor used for restricted casts
from char *.

Change-Id: Id7e71f6d0bcd4627bb44b2bd6d6790be2b6ed976
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-04-16 23:15:05 +02:00
Lars Knoll
83f5c3c26a Remove QString::from/toAscii()
These methods have been deprecated since 5.0

Change-Id: I3ceed57a364ea59a63ccc51452ab3b4da7140ce4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-16 23:14:57 +02:00
Robert Loehning
33b1662f16 Fuzzing: Add fuzz target for QCborStreamReader::next
Change-Id: I8e7d90d89b66395370809935b1cb5bf144bded49
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-04-16 21:12:00 +02:00
Volker Hilsheimer
ea7cc7f6f9 Remove deprecated members from QtWidgets/kernel classes
Cleaning up those that are trivial to remove because they have direct
replacements.

Change-Id: Ie8ac02c3d6273110f1f11e17fdeae496bc66321f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-04-16 16:53:50 +02:00
Volker Hilsheimer
09dd94091f Remove deprecated members from graphics view classes
Change-Id: Ia192de674b1085edcf4a88cdeada6df89b442ddd
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-04-16 16:53:33 +02:00
Volker Hilsheimer
90295dcd03 Remove deprecated QStyle enum values
Change-Id: I7eba336017844c06b2976df53d440e167abd7894
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-04-16 16:53:18 +02:00
Volker Hilsheimer
0c65176847 Docs: show more relevant and correct way of using Q_FLAG
The snippet didn't quote the QLibrary header correctly, and didn't
register the flags type, but only the enum type with the meta object
system.

Update example to use QItemSelectionModel instead as a more relevant
class for readers, and restructure the text a bit.

Change-Id: I572e2aaac4601087e7aa6d2ea7a8f8fd65d82539
Fixes: QTBUG-83474
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2020-04-16 13:52:12 +02:00
Mårten Nordheim
487dd80bce Introduce QSocketNotifier::activate(QSocketDescriptor, QSN::Type)
The pre-existing overload passes an int, but this can mean the
descriptor gets truncated in compilations where the descriptor
is 64-bit.

The old overload with int is visible when querying the metaobject system
so string-based connects still work as before, and connecting to it will
produce a deprecation warning in the output.
At the same time the PMF-based connect will, on recompile, pick the
QSocketDescriptor overload. As an added improvement it also comes with
the notification type, removing the need for separate slots where the
code would be mostly shared anyway.

The QSocketDescriptor type can be implicitly converted to and from
qintptr to ensure existing code still compiles. It can also be
constructed from Qt::HANDLE on Windows.

In this same patch I also update the existing string-based connects in
this module, which then includes updating the parameters for some slots
as well.

[ChangeLog][QtCore][QSocketNotifier] Added
QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type).
This replaces the activated(int) signal which in 64-bit environments
could truncate the socket descriptor. If you use "activated" with the
string-based connect() then you need to update the parameter type of the
signal and slot if it had one. If you use it with the pointer to member
function based connect() then all you need to do is update your slot's
parameter type if it has one. If you need to compile your source code
with multiple versions of Qt then connect() to this function using
pointer to member function and update the slot's parameter type if
needed.

Task-number: QTBUG-70441
Change-Id: Ic43d6bc4c5bcb4040867b2ffad8d36fb01eed8af
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-04-16 13:52:11 +02:00
Edward Welbourne
b34158d7a1 Fix display-name calls in QAndroidTimeZonePrivate::init()
Following up on commits 4fa8dfee5d and
c20c7efea9, where I apparently got the
call to Java's getDisplayName() method wrong. Use the same code as our
own displayName() method used for this, pulled out as a function to be
shared by the two callers.

This requires a locale and it's not immediately obvious which to use,
so try the three most plausible candidates: C locale because IANA IDs
are typically in it; default because that's most likely what language
a user-supplied locale name might be in; and system because the name
may have come from the system, not the user.

In the process fixed some loops that didn't visit all the values they
thought they did.

Fixes: QTBUG-81975
Change-Id: I7867ca6f46951315a41c389107439acb439eaf08
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2020-04-16 13:52:11 +02:00
Timur Pocheptsov
8ddffc6ba4 OpenSSL: handle SSL_shutdown's errors properly
Do not call SSL_shutdown on a session that is in handshake state (SSL_in_init(s)
returns 1). Also, do not call SSL_shutdown if a session encountered a fatal
error (SSL_ERROR_SYSCALL or SSL_ERROR_SSL was found before). If SSL_shutdown
was unsuccessful (returned code != 1), we have to clear the error(s) it queued.
Unfortunately, SSL_in_init was a macro in OpenSSL 1.0.x. We have to
resolve SSL_state to implement SSL_in_init.

Fixes: QTBUG-83450
Change-Id: I6326119f4e79605429263045ac20605c30dccca3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8907635da5)
2020-04-16 11:26:04 +02:00
Volker Hilsheimer
fe4a5a27e0 Remove deprecated members from dialog classes
And a few cleanups of out-dated comments and dead code.

Change-Id: I59c6b9129a21b8953626cb63c3ebbf9b6c49a657
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-04-16 11:05:28 +02:00
Volker Hilsheimer
f728429335 Remove deprecated QWizard member
Change-Id: If6a0125ab9eba5f1b5040adb2e087003b45f5b3d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-04-16 11:05:28 +02:00
Johan Klokkhammer Helsing
73f3f501f3 Move versioned OpenGL functions from QtGui to QtOpenGL
The context—which lives in QtGui—now knows nothing about versioned functions.

This changes the public API for getting version functions for a context.

[ChangeLog][QtGui][OpenGL] QOpenGLContext::versionFunctions() has been removed.
QOpenGLVersionFunctionsFactory::get() from the QtOpenGL module should be used
instead.

Previously one would call

    context->versionFunctions<QOpenGLFunctions_4_0_Core>();

Which now becomes

    QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_4_0_Core>(context);

The rest of the API should be identical.

Since glgen no longer compiles, and the links to its input (gl.spec and gl.tm)
are dead, I've edited the previously generated files manually. If glgen is
fixed, it should be quite easy to make it generate the new way.

Task-number: QTBUG-74409
Change-Id: I800527e0af16a79005b276eeb74417770193c62f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-04-16 07:14:51 +02:00
Lars Knoll
ca635c659c Run those autotests with cmake
They seem to work just fine.

Change-Id: I8cf3e682e158c67367d76fe68f5829df67d1e449
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-15 18:55:52 +01:00
Lars Knoll
bc726ed5d9 Compile fixes for clang10
Fix some warnings that are flagged as errors on clang10.

Change-Id: I906634c8b2bd94db42d74a7f3d10efb086e373cc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-04-15 19:55:06 +02:00
Lars Knoll
e80544ebca Port QNetworkProxy over to use QRegularExpression
The windows and macOS implementations where still using QRegExp
in one place.

Change-Id: Iaf6c6ead10f7f061ff0edce889abe18751b9d308
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-04-15 19:54:09 +02:00
Tor Arne Vestbø
8138c812cb macOS: Remove a bunch of dead (forward) declarations
Change-Id: I402668a17b48c164658f775bacd832615a6d2587
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-15 17:33:06 +02:00
Leander Beernaert
30f69f7ff6 CMake: Add library mapping for xcb-fixes
Change-Id: Ida893674fa0782446acdac4ee5dfec4849d4605f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-15 16:25:19 +02:00
Leander Beernaert
812cc76b02 CMake: Update pro2cmake and friend to convert QtVirtualkeyboard
Expand $$MODULE_BASE_DIR to ${QT_BUILD_DIR}.

Add library mappings for Hunspell.

Add test mappings for QtVirtualKeyboard regarding 3rdparty Hunspell and
T9Write.

Change-Id: Ief007456d0471cbcf9a03d819291edec5f63680f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-15 14:15:52 +00:00
Giuseppe D'Angelo
bb0a616260 QObject: overhaul narrowing detection
Use P0608's trick to detect convertibility without narrowing;
and now that we can depend on C++17, use its features.

First, this moves the burden of detecting a narrowing conversion on
the compiler, rather than us maintaining a complicated series
of checks. Of course, this exposes

* bugs in compilers (e.g. GCC < 9 thinks that float->bool is not
  narrowing;

* behavior still not (widely) implemented (pointer to bool
  conversions are narrowing, P1957);

* interesting compiler choices, e.g. GCC 9 thinks that unscoped
  enumerations are non-narrowing convertible to a datatype big
  enum to contain all the _enumerators_, even if the underlying
  type of the enum (and/or its sizeof()) is wider than the target
  datatype.

Second, it allows to detect conversions that have a narrowing
conversion as an intermediate step. Given a type like

  struct Bad { operator double() const; };

then an object of type Bad is implictly convertible to a type
like int via a narrowing conversion. Therefore, a connection
is possible between a signal carrying a Bad and a slot accepting
an int. We can now detect and block this.

Tests regarding scoped enumerations have been dropped,
for the simple reason that a scoped enumeration is not
implictly convertible to an integral type, so we don't have
that detection (it would constantly fail). Scoped enumerations
do not take part in narrowing conversions anyhow, cf. [dcl.init.list].

[ChangeLog][QtCore][QObject] The detection of narrowing conversions
when calling QObject::connect() when
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT now takes also
into account user-defined implicit conversions that undergo
through a narrowing conversion.

Change-Id: Ie09d59203fe6283378b36dfbc54de1d58098ef51
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-04-15 15:20:45 +02:00
Fredrik Orderud
1bee5937bc Windows: Make QStandardPaths::writableLocation low-integrity aware
Return %USERPROFILE%\AppData\LocalLow instead of %USERPROFILE%\AppData\Local
when running in a low-integrity process.

[ChangeLog][QtCore][QStandardPaths] When used in a low-integrity process
on Windows, QStandardPaths::writableLocation returns respective low-integrity
paths.

Fixes: QTBUG-83453
Change-Id: Ie5e4625a34d08e4ef54be4ba45b2dae9e60feb63
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-15 13:18:48 +00:00
Allan Sandfeld Jensen
c7e8ee4e62 Fix image scaling on WASM platform
Apparently it has trouble with multi-threading from the main thread.

Change-Id: Ib544d69270c2780d4a42bde6fd7f491e32f29cd2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-04-15 15:00:13 +02:00