Commit Graph

45921 Commits

Author SHA1 Message Date
Fabian Kosmale
649d834443 add unit test for QMetaMethod::revision
Change-Id: I724702d8ac9a75fefd848afccf4f4de9fc0ba4af
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2020-06-02 22:42:15 +02:00
Fabian Kosmale
fa987d4441 MetaObject: Store the QMetaType of the methods
This does the analog of 46f407126e for the
methods we care about (signals, slots, Q_INVOKABLEs). In addition to the
actual QMetaType, we store an array with offsets so that we later can do
a mapping from methodIndex to metatype.

The newly added QMetaMethod::{return,parameter}MetaType methods can then
be used to retrieve the metatypes.

This does however require that all involved types are complete. This is
unfortunately not a feasible requirement. Thus, we only populate the
metatype array on a best effort basis. For any incomplete type, we store
QMetaType::Unknown. Then, when accessing the metatype, we fall back to
the old string based code base if it's Unknown.

Squashes "moc: support incomplete types" and  "Fix compile failures
after QMetaMethod change"


Fixes: QTBUG-82932
Change-Id: I6b7a587cc364b7cad0c158d6de54e8a204289ad4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-02 22:42:15 +02:00
Venugopal Shivashankar
5306fdabc1 Doc: Move the overlapping background logo
Setting the logo to position at the top seems
to fix the issue.

Fixes: QTWEBSITE-928
Change-Id: I29336b4a1967a4676695b4f7f8560d01f3cf4fdf
Pick-to: 5.15
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-06-02 20:42:15 +00:00
Topi Reinio
707018b76e Doc: Fix issues with Qt Widgets documentation configuration
Remove '/' as an example directory. We do not want to retrieve the
directory tree of the entire system.

Change-Id: I911f8eea12b4960319a9a4cbea820b910a35aede
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-06-02 19:25:59 +02:00
Friedemann Kleint
13d95e415e High DPI/Windows style: Fix potential crash when drawing buttons of maximized QMdiSubWindow
In QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(),
pass the correct rectangle (reflecting the correction factor)
to the function fixAlphaChannel().

Amends e56b8e1e59.

Pick-to: 5.15
Fixes: QTBUG-84613
Task-number: QTBUG-75927
Change-Id: I5357bb8c55ed26a50cc322ea7a05df4487212fb8
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-06-02 14:50:54 +02:00
Alexandru Croitor
873aa682c5 CMake: Add ${tst_foo}_check target for easy test running
Given a test named "tst_qdrag", you can run "ninja tst_qdrag_check"
to build and run the test.

Change-Id: I47dccb39dd60fca9cb07ff9af9fb739b293c5aaf
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-06-02 12:03:27 +02:00
Dimitrios Apostolou
f19650cf80 Convert Q_ASSERT to Q_STATIC_ASSERT
This is now possible because of the earlier commit that changed the
const arrays in qurltlds_p.h to constexpr arrays.

Change-Id: I37a6a64e250bbe33f7d34b5916595bf6a37aed4a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-06-02 12:01:42 +02:00
Kai Koehne
1e17d0e9d7 Remove whitespace for file names generated from TARGET
Task-number: QTBUG-84492
Pick-to: 5.15
Change-Id: I70e79b7a57949e8dfd3781967e775bdea8822e0c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-06-02 08:07:54 +02:00
Lars Knoll
4c5f6eb74c Stabilize autotest
calling emplace() on a std::vector with a reference
pointing into the same vector is undefined behavior.
Fix this by using a temporary inbetween.

Change-Id: I47c28700dffa2107fb0cba302168c86b659eafb3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-01 20:57:55 +02:00
Lars Knoll
51beb816e8 Support qbswap for all integral types
long and ulong where missing. Generalize the code so that it'll work
for all integral types.

Change-Id: I74591e9c8b375e0ecdcfdd856970ce355eb2d4ce
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-01 20:57:44 +02:00
Lars Knoll
aac39167b7 Add QStringView::split() methods
Since QString::split() is not going away in Qt 6, we should aim
to provide API symmetry here, and ease porting existing code from
QString(Ref) to use QStringView.

This is easier than having to port everything to use tokenize() at
the same time. tokenize() will however lead to better performance
and thus should be preferred.

Change-Id: I1eb43300a90167c6e9389ab56f416f2bf7edf506
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-01 20:43:21 +02:00
David Faure
4f1ebf666e QMimeType::suffixForFileName shouldn't lowercase the file suffix
It was returning a lowercased suffix because it was extracting it from
the pattern (*.txt) rather than from the filename ("README.TXT").

This broke expectations on the application side, since this method is
documented to return a suffix from the given filename.

Ref: https://bugs.kde.org/show_bug.cgi?id=402388

Change-Id: I7dae13db31280249d3f592fa9592c4067804e22d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-01 13:36:05 +02:00
Lars Knoll
b0294bb1c7 Refactor splitString to use QStringView
Instead of a QChar * and a length.

Change-Id: Ic07e92fe0889e57c19ce7c1bf6902f3a598fad05
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-01 00:39:24 +02:00
Giuseppe D'Angelo
529f052add Port QRegularExpression to QStringView, drop QStringRef
The idea is pretty simple -- add QRegularExpression matching over
QStringView. When matching over a QString, keep the string
alive (by taking a copy), and set the view onto that string.
Otherwise, just use the view provided by the user (who is then
responsible for ensuring the data stays valid while matching).

Do just minor refactorings to support this use case in a cleaner
fashion.

In QRegularExpressionMatch drop the QStringRef-returning methods, as
they cannot work any more -- in the general case there won't be a
QString to build a QStringRef from.

[ChangeLog][QtCore][QRegularExpression] All the APIs dealing
with QStringRef have been ported to QStringView, following
QStringRef deprecation in Qt 6.0.

Change-Id: Ic367991d9583cc108c045e4387c9b7288c8f1ffd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-31 21:46:32 +02:00
Kai Koehne
32a39c4ed1 Document how to use CMake for Qt Widgets
Task-number: QTBUG-73058
Change-Id: Ida459635e159334a4ef67979c0d28b1553317ea9
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-05-31 18:44:57 +02:00
Lars Knoll
c84e9c0700 Fix a bogus assert
advances and glyphIndices can be nullptr's as long as numGlyphs
is zero.

Change-Id: I29c3764792c1a0ffaafd3393c82a26af65699ab3
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-31 15:55:57 +02:00
Mike Krus
1d0384a385 Allow module names starting with digits
This was allowed with QMake.

Change-Id: Ia3052cd2086d633a343cfe59afddded2f79fc551
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-31 13:44:15 +01:00
Lars Knoll
6a6314df1e Add QStringView::constData()
This is doing the same as data(), but the method is widely being used in
Qt (e.g. in QString), so this will make it easier to change the type of a
variable from QString(Ref) to QStringView in a source compatible way.

Change-Id: Ic49bef688d3ce3c550336edf90130aa5cac8b497
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-30 23:11:20 +02:00
Lars Knoll
a1056096fc Add support for count() to QStringView
Make the API more symmetric with regards to both QString and QStringRef.

Change-Id: Ia67c53ba708f6c33874d1a127de8e2857ad9b5b8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-30 23:11:09 +02:00
Eirik Aavitsland
2b7b75f721 gif image handler: check for out of range image size
Make the decoder fail early to avoid spending time and memory on
attempting to decode a corrupt image file.

Pick-to: 5.15 5.12 5.9
Change-Id: Ic556d4fbcb6b542fc110d10e48dac1a880e60697
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-30 15:37:12 +02:00
Andy Shaw
f71a400bf6 Android: Clear the clipboard when getting a null mimedata
From API 28 it is possible to clear the clipboard so we should ensure
that this is done if API 28 or later is being used. Otherwise it is not
removed, but that is due to limitations on the Android side.

Pick-to: 5.15
Change-Id: I1fe504d0e566c6923b39b2adf4540619c6b1daf7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2020-05-30 12:49:42 +00:00
Eirik Aavitsland
6a2224fd58 bmp/ico decoder: fail early for unsupported bit depths
All the normal bit depths are supported, so no point in trying to go
through the decoding code path for others. Avoids wide bitshift
warning for claimed depths > 32.

Pick-to: 5.15 5.12
Change-Id: I61b72dbbf9558ca28db46f8168339f8174e56997
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2020-05-30 12:33:08 +02:00
Eirik Aavitsland
30571068b2 Gif decoder: avoid undefined values in enum
The gif standard allocates 3 bits for the disposal method, but values
4-7 are unused.

Pick-to: 5.15 5.12
Change-Id: I0f70b3f87b4cd8e98140c3da476702a22ebe93a9
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2020-05-30 12:32:56 +02:00
Samuli Piippo
10a0dc6600 Return correct threadId in all cases
If the assembler code cannot be used to retrieve the threadId, always
use pthread_self() for it. QObject uses QThread::currentThreadId() and
QThreadData::threadId to match threads, which makes address of the
currentThreadData unsuitable as the thread id.

Reading the threadId from currentThreadData is slower than calling
pthread_self(), as tested on Aarch64 linux and x86_64 QNX.

Change-Id: If9afc8ed2810ad1e04bd42ead8f40b43ef3bac30
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-30 09:55:05 +03:00
Alexandru Croitor
71e3b04282 CMake: Regenerate rest of configure.cmake files
Change-Id: I17cca57c18f33d4283eb6009ba4c5ebb0c1847c3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-05-29 23:23:06 +02:00
Laszlo Agocs
e3361c1614 CMake: Update src\gui\configure.json and the conversion script
The ANGLE removal's manual configure.cmake changes are now replaced
by updating the conversion script's special cases instead.

Change-Id: I06317fe0202b25bd9f9524da14e1bb0ccbb30cc1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-29 23:23:02 +02:00
Alexandru Croitor
a97a8fcc1a CMake: Regenerate src/platformsupport
Change-Id: If7b5359c457edee814dc7d3a71cf47ce052e6c5e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-29 23:22:57 +02:00
Alexandru Croitor
77771116a4 CMake: Regenerate src/plugins
Change-Id: Icceceeb42023e7fa5edf320bb21f03d11bd357b7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-29 23:22:47 +02:00
Alexandru Croitor
a9fbe53966 CMake: Regenerate tools and 3rd party
Change-Id: I38e065cddc954e8594a5dce823c3bb5385a8a1e8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-29 23:22:43 +02:00
Alexandru Croitor
abe3dbe719 CMake: Regenerate src/opengl
Change-Id: I6a648c5fd2fa90e6e70d0ccffb34fd3cb1161e5e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-29 23:22:39 +02:00
Alexandru Croitor
c67c05ee0e CMake: Regenerate src/corelib
Change-Id: I985f9cca78e173f066d65e704c101d499668163a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-29 23:22:35 +02:00
Alexandru Croitor
41b1eaf579 CMake: Regenerate src/gui
Remove the manual modifications, and let the script do its work
and use the .pro file as the source of truth.

Change-Id: I510d5487a326d72a9c19e8148ec1daac9a23394b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-29 21:22:31 +00:00
Lars Knoll
f98fe1ba41 Fix UB in QGraphicsScene::wheelEvent()
operator--() would iterate before begin() if the
list was empty. This is UB, and will crash in Qt 6,
where begin()/end() can return an iterator pointing
to a nullptr if the list is empty.

Change-Id: I39c3a8ebb09fcad75d42019b02426ac5ac05eed9
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-29 23:21:51 +02:00
Joerg Bornemann
d4ff606941 Mark qmake as Qt tool in qmake/qmake.pro
...and re-regenerate qmake/CMakeLists.txt.
This removes one special case and is necessary for a subsequent patch
that changes how pro2cmake converts Qt tools.

Change-Id: Ie87b7841f3c29de3f2c8907e82975b6272f096cc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-29 20:45:09 +02:00
Joerg Bornemann
45fb75a17a CMake: Re-generate qmake/CMakeLists.txt
Change-Id: Ifb1fadbd0f2ea13068085e7e47d0b883efff7380
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-29 20:44:56 +02:00
Joerg Bornemann
1c31f0f554 Fix qmake.pro
The registry.cpp file is in the library subdirectory.

This doesn't contribute to the qmake or CMake build, but it removes the
need for a special case in qmake/CMakeLists.txt.

Change-Id: I66a566f0d1e0b82791822ca55a7de037369536a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-29 20:44:51 +02:00
Lars Knoll
beaef85b8d Add toInt() and friends to QStringView
Make the API more symmetric with regards to both QString and QStringRef.
Having this available helps making QStringView more of a drop-in
replacement for QStringRef. QStringRef is planned to get removed in Qt 6.

Change-Id: Ife036c0b55970078f42e1335442ff9ee5f4a2f0d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-29 19:01:58 +02:00
Mårten Nordheim
bf03396ad8 cmake: Quote the arguments to CMD's 'set' command
This avoids issues with some special characters and spaces.

Change-Id: I6b7cedbe2c9663f62fae104488454faebab52ce0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-29 19:01:58 +02:00
Tor Arne Vestbø
b39f33e311 Move QPlatformBackingStoreOpenGLSupport handling out of platform plugins
Allows them to not depend on QtOpenGL just to provide the default
backing store OpenGL support backend.

Change-Id: I90d6d9247ce76848d9d03e2d512fb736c81488d3
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-05-29 19:01:57 +02:00
Alexandru Croitor
c4e09cf267 CMake: pro2cmake: Check existence of QMLTYPES_INSTALL_DIR
When writing the qt6_qml_type_registration call, make sure to write
the set(QT_QML_MODULE_INSTALL_QMLTYPES TRUE) statement only if an
explicit path was provided via
QMLTYPES_INSTALL_DIR / QT_QML_MODULE_INSTALL_DIR.

This will remove the QT_QML_MODULE_INSTALL_QMLTYPES property from
many examples and tests in qtdeclarative, thus not installing the
.qmltypes file into the Qt prefix, thus polluting it.

Task-number: QTBUG-84403
Change-Id: I5c64d42915896d14f2591cbb64d73d912dbf7c7d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-29 17:17:18 +02:00
Alexandru Croitor
f77c4ebb7d CMake: Check CMAKE_CONFIGURATION_TYPES when doing automoc extraction
Otherwise when configuring a standalone example without specifying a
CMAKE_BUILD_TYPE (so it's empty), building fails because
qt6_generate_meta_types_json_file thinks it's being called with
a multi-config generator.

Change-Id: I360c7dbb19522155d8e72f98836fb663916715a0
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-29 17:17:15 +02:00
Alexandru Croitor
4182cf409e CMake: Use default location for installing metatypes json files
Previously configuring a standalone example that had no explicit
INSTALL_DIR option for qt6_generate_meta_types_json_file would fail.

When no explicit location is specified to
qt6_generate_meta_types_json_file via INSTALL_DIR option, default
to installing into a lib/metatypes location relative to the install
prefix.

This is required for supporting calling
qt6_generate_meta_types_json_file when building standalone applications
or libraries (not part of the Qt build).

Make sure not to install the metatypes.json file for executables.
Install it only for libraries (aka modules).

Task-number: QTBUG-84403
Change-Id: Ie0dd75fca0cde71ccb4eb48030871e72d31d1725
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-29 17:17:11 +02:00
Ivan Tkachenko
a50d7005a5 Cosmetic whitespace / indentation
Split long signature into multiple lines, and indent some existing
misaligned signatures.

Change-Id: Icaed7b703c3f0b20472400b186ac2a28f1ff1dd1
Pick-to: 5.15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-05-29 14:58:43 +00:00
Sona Kurazyan
2f15927f01 Add a way of notifying QFutureWatcher when pause is in effect
Because setting QFutureInterface to paused state does not mean that
the computations that are already in progress will stop immediately,
it may be useful to get notified when pause actually takes effect.

Introduced the QFutureWatcher::suspended() signal, to be emitted when
there are no more computations in progress, and no more result ready
or progress reporting signals will be emitted, i.e. when pause took
effect. Added {QFuture, QFutureWatcher}::isSuspended() methods for
checking if pause took effect.

QtConcurrent will now to send QFutureCallOutEvent::Suspended event
when the state is paused and there are no more active threads.

[ChangeLog][QtCore][QFutureWatcher] Added a new QFutureWatcher::suspended()
signal, to be emitted when pause took effect, meaning that there are no
more computations in progress. Added {QFuture, QFutureWatcher}::isSuspended()
methods for checking if pause took effect.

Fixes: QTBUG-12152
Change-Id: I88f2ad24d800cd6293dec63977d45bd35f9a09f0
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-05-29 16:58:43 +02:00
Cristian Adam
9b0e23ef8a CMake Build: Do not set "lib" prefix for modules (plugins)
CMake sets "lib" as default prefix for Windows-GNU platforms.

Change-Id: I49e3123c385610307c84c584a21f5f3827a6fafd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-29 16:58:43 +02:00
Volker Hilsheimer
743c7234df Export the highlighter function so that we can use it in QtSvgWidgets
That allows us to remove the copy of that function in QtSvgWidgets.

Change-Id: I99d54408781c99b877c4df8fc9fc5f4139dcebb2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-29 16:58:43 +02:00
Volker Hilsheimer
37eb5d38aa Add SvgWidgets library
Change-Id: I243aa35a0628f80219b589a0ba943ec1a25bb972
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-29 16:58:43 +02:00
Edward Welbourne
948511a143 Turn badly-named test into two data rows of another test
Since ancient times, tst_QDateTime::fromString_LOCALE_ILDATE() has
claimed to be Windows-only, although there is nothing MS-specific
about it; its name also purports to implicate locale, which it
doesn't. Turn it into two data rows for the more general
fromStringDateFormat() test, with no extra #if-ery about it.

Change-Id: I239c0f80f8f7fa42d498a0f801cc8edfb1db3d8c
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2020-05-29 16:58:43 +02:00
Edward Welbourne
25823cdeb4 Fix a typo and an odd phrasing
One initializes data "byte by byte" not "byte per byte", at least in
any dialect I'm familiar with.

A byte array can be "created from raw data" but if it was "from a"
thing it'd have to be a datum of some sort.

Change-Id: Id9706b191f08f03418b9ea6f481797d93a278dff
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-05-29 16:58:43 +02:00
Timur Pocheptsov
73158a9cb0 CA fetcher (Windows) - relax the logic a bit
In case a certificate chain is missing an intermediate,
for a certificate having "Authority Information Access"
extension it's possible to fetch this intermediate and
build the chain up to the trusted root. Unfortunately,
it's not always possible to install the root certificate
in the system "ROOT" store and then an application
wants to set it in the socket's configuration,
using setCaCertificates(). But this call also
disables CA fetcher ('no on demand root loading').
It makes sense to relax this logic for such
certificates and try to fetch the intermediate CA
and then have the complete chain verified.

Pick-to: 5.15
Fixes: QTBUG-84173
Change-Id: I5b9b4271767eba6f5fd2b5cf05e942360c6aa245
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-29 16:58:43 +02:00