Commit Graph

40095 Commits

Author SHA1 Message Date
Samuel Gaist
2d72bf6019 Remove unused QRegExp include
There's no use of QRegExp here therefore remove the include

Task-number: QTBUG-72587
Change-Id: If281c34d202c9fae4e548c8293443cc0dc283de0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-10 19:25:12 +00:00
Samuel Gaist
928c3e4a68 test: migrate QTextDocumentFragment test to QRegularExpression
This is part of the migration of qtbase from QRexExp to
QRegularExpression.

Task-number: QTBUG-72587
Change-Id: I18fb17dd2f5f7c70b5c6564b876fc2138c430176
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-06-10 09:20:55 +02:00
Samuel Gaist
94495c814f test: migrate collections test to QRegularExpression
This is part of the migration of qtbase from QRexExp to
QRegularExpression.

Task-number: QTBUG-72587
Change-Id: Iff9d4be685bf360ad921e29a82cb878ae5c46180
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-10 19:24:05 +00:00
Samuel Gaist
4aec51e39f test: migrate QStateMachine test to QRegularExpression
This is part of the migration of qtbase from QRexExp to
QRegularExpression.

Task-number: QTBUG-72587
Change-Id: If5d5a9d1c3f094d554110ada3b259f4d863e7121
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-10 19:23:42 +00:00
Samuel Gaist
fd58792ef8 test: migrate QLibrary test to QRegularExpression
This is part of the migration of qtbase from QRexExp to
QRegularExpression.

Task-number: QTBUG-72587
Change-Id: I60ffa6df83aaf520730cfbb1dd3f18a2d2e19977
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-10 19:22:55 +00:00
Samuel Gaist
c0f0e94db5 test: Fix QRegularExpression feature config check
The check to disable the test was the one for QRegExp. This patch fixes
that.

Change-Id: I8783f582998cdd6ffe5dc5dafb3d53d56cd91213
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
 
 
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-10 19:29:19 +00:00
Samuel Gaist
826b262fa6 test: migrate QItemSelectionModel test to QRegularExpression
This is part of the migration of qtbase from QRexExp to
QRegularExpression.

Task-number: QTBUG-72587
Change-Id: Ibbd161700bf9e75736652b99dfa1ffd47e584249
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-06-10 19:29:44 +00:00
Samuel Gaist
0389a459bb test: migrate QStandardPaths tests to QRegularExpression
This is part of the migration of qtbase from QRexExp to
QRegularExpression.

Task-number: QTBUG-72587
Change-Id: Ie89641601763ff41eee5356a4b5ddee7ef810fbc
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-06-10 21:34:38 +02:00
Samuel Gaist
cc843c36ea test: add missing QRegularExpression specific QDataStream tests
This patch adds the missing tests for the QRegularExpression class to
the QDataStream tests. Only QRegExp was tested until now.

Task-number: QTBUG-72587
Change-Id: I68ad1500ecbb041bbc6fbdff04b99171530cc0fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-10 19:22:20 +00:00
Samuel Gaist
20c6242c52 test: migrate highdpi manual test to QRegularExpression
This is part of the migration of qtbase from QRexExp to
QRegularExpression.

Task-number: QTBUG-72587
Change-Id: I0bb1d1409cb0c8f38b7582bb5ce6bbc2b047b6fc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-06-10 10:16:52 +02:00
BogDan Vatra
743bc1254c Android: Fix resources folder
Resources are usually needed to add extra stuff to apk lib/<arch> which normally
are stripped by gradle.

Change-Id: Id96ce246fdc2a4606e39ecfb75d5b3294aad3c08
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-05-29 09:42:53 +03:00
Rolf Eike Beer
60932f69cc QTimeZone: avoid needless QString instances
Change-Id: I250bfb58c04b2c013285c8ebd6db1f964f0b7b29
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
 
 
 
 
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-19 09:30:12 +02:00
Simone Gaiarin
c826e67765 QAction: add exclusionPolicy property
When set to ExclusiveOptional, the new exclusionPolicy property let the
user uncheck the active checkable action in an exclusive group.

[ChangeLog][QtWidgets][QActionGroup] Added new exclusionPolicy
property. Set it to ExclusiveOptional to allow unchecking the active
checkable action in an exclusive group.

Change-Id: I61a9885cfd076d631cddf8c08313e4b488e5dc38
Fixes: QTBUG-71160
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-03-19 13:46:43 +01:00
Laszlo Agocs
b17e05729e vkmemalloc: Disable SRWLOCK for mingw
...until some day someone investigates what is exactly the problem with the
sdk that ships with mingw.

Task-number: QTBUG-76424
Change-Id: I64869a4fbb07a64cfc1430234d732e143fefe720
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-06-18 08:53:56 +00:00
Anton Kudryavtsev
55240bcdf3 QStringView, QLatin1String: add lastIndexOf methods
While touching the code, factor out internal methods
to avoid needlees latin1->utf16 conversion.

[ChangeLog][QtCore][QLatin1String] Added lastIndexOf().

[ChangeLog][QtCore][QStringView] Added lastIndexOf().

Change-Id: I1c624f00e4ed10111e0d00b86daff7904eeed176
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-18 14:48:50 +03:00
Friedemann Kleint
eed9a8fbd3 Add accessors for QWindow and QScreen to QWidgetPrivate
Rewrite the existing accessor QWidgetPrivate::windowHandle() to
accept a mode enumeration that has an "Any" convenience.

Based on that, add QWidgetPrivate::associatedScreen(), which is seful
in many places where scaling is performed.

Prototypically simplify the code.

Task-number: QTBUG-62094
Task-number: QTBUG-73231
Change-Id: I516288363d329bce9bc94e4951106f9357bc6cde
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-06-18 10:15:26 +02:00
Marc Mutz
cd563b3497 QNetworkConfiguration: remove unused member 'serviceNetworkMembers'
It's never set anywhere, neiher in QtBase nor in any other Qt module.

So, remove.

Change-Id: If616d350a1c1c74f6f3e87f8cd98ccb3bff5cf70
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2019-06-14 21:38:56 +02:00
Marc Mutz
a44a3a4999 QString: towards QStringView::arg() pt.2: port internal machinery to QStringView
This involves replacing the use of QStringRef with QStringView and
replacing int indexes and sizes with qsizetype ones.

Since we use QStringView now, where mid() is cheap and well-defined,
remove the offset and length parameters that used to be Part ctor
arguments, and use mid() in the caller.

Change-Id: I08f3cd467b7b935f734b73d15eb8564b7deaa87e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-06 18:47:25 +02:00
Marc Mutz
54bf20af5d QString: towards QStringView::arg() pt.1: modernize some code
Replace explicit iterator loops with ranged for loops.

Also remove the pointless detach() of the QString result, caused by
calling mutable data() instead of using the old trick of const-casting
constData().

Change-Id: Ia7e2cb2926dc30b4dba33200b17697fd33d22446
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-06 18:30:40 +02:00
Marc Mutz
d0b3aaecd9 Make QIPAddressUtils::toString() const-correct for IPv6
The IPv4 overload takes a IPv4Address, which is just an quint32, so it
doesn't matter whether clients call it with a const or a mutable
argument.

The IPv6 overload, OTOH, took a IPv6Address, which is a typedef for
quint8[16]. This allows users to pass a quint16[16], but not a const
quint8[16], because that would lose the const. The function, however,
doesn't modify the argument, so it could be const.

Make it so, even though, due to the typedef, it looks like a redundant
top-level const.

Change-Id: I0506f6f9026ad616c4450fceb45fea137ac27692
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-15 18:40:37 +02:00
Marc Mutz
f2bd46d1df Fix deep-const-correctness of qGetPtrHelper() for smart pointers
The function qGetPtrHelper() is mainly used to implement d_func() within
the Q_DECLARE_PRIVATE() macro. The whole purpose of d_func() is to
propagate const deeply. But if a smart pointer implements this by itself,
then the old version of qGetPtrHelper(), by taking the Ptr as a const-&,
would always return a const payload pointer, which would fail in the
following reinterpret_cast in d_func() to mutable payloads.

This was found while experimenting with making QExplicitlySharedDataPointer
deep const-correct, and I have no explanation why it seems to have worked
with QSharedDataPointer, which is deep-const-correct already.

Change-Id: Iee2e8fcce89c58ba2af7818de6f79ed39c5a4030
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-15 18:40:24 +02:00
BogDan Vatra
079dafc42f Run prebuilt android test APKs
androidtestrunner now checks is the apk is build and if it is, it will skip the build phase.
Now we can build the apks in parallel (which takes most of the time) and run them sequentially.
This way running tests on Android is much faster.

Change-Id: I82f34723ac08f7728cc0daab3366e03821335eed
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-06-13 07:26:20 +00:00
Giuseppe D'Angelo
d73497cf77 QObject/QWidget::setParent: add assertions to prevent loops
It is perfectly possible to accidentally create a parent/child
loop. This can happens by direct means (a->setParent(b);
b->setParent(a);), or some more subtle means, e.g.

class MyClass : public QObject {
   MyClass() : QObject(this) {}
};

Since this is UB, add a few robustness checks to make sure the
code above crashes right away (at least in debug builds).

Change-Id: I6583c8514b4c1f8a90677b04c77b8e8f0c15dba3
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
2019-06-07 10:43:16 +02:00
BogDan Vatra
9dec965248 Say hello to $ make apk
Now creating an .apk it's easier than ever.
"$ make apk" is all you need to run to create an apk for your application.

[ChangeLog][Android] Introduce "make apk" target, an easy way to create an apk.

Change-Id: I12565e7ed32beb42da40d8ce42a52339038be950
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-06-06 15:31:29 +03:00
BogDan Vatra
0ad4da0c64 Android: Nuke ant support
Ant is history for so many years, yet we forgot to remove it from
androiddeployqt.

[ChangeLog][Android] Remove ant support from androiddeployqt

Change-Id: I093295e18e8710c565e9d101e21c49b3c62f6322
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-06-06 15:25:12 +03:00
BogDan Vatra
a5e03f59f4 Say hello to androidtestrunner
androidtestrunner is a tool needed to run qt tests on Android.
Now you can run tests as simple as you run them on Linux, macOS,
Windows.
"$ make check" it's all you need to run tests on the default android
device.

ANDROID_DEVICE_SERIAL env variable can be used to use a specific android
serial.

Use cases:
$ make -j1 check
-j1 is needed to make sure we don't run multiple tests in parallel.

$ ANDROID_DEVICE_SERIAL="emulator-5554" make check
Run the test on "emulator-5554"

$ make TESTARGS="-- -xml" check
Switch to xml output. All params after -- are passed to test
application.

$ make TESTARGS="-- -o out.xml,xml -o out.txt,txt -o -,tap -vs" check
Create two files out.xml and out.txt in the current folder and print
"tap" format to stdout and enable logging of every signal emission.

[ChangeLog][Android] Make it easy to run Qt tests on Android.
"$ make check" is all it's needed to run a test on an Android device.

Change-Id: I1a7f64b62608f7367b5a6aabf5d6c6e7e50242e6
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2019-06-06 15:25:07 +03:00
Christian Ehrlicher
784c94c727 Replace QPainter::initFrom() with begin()
It's deprecated since e56401818b
but still needed for QWidget rendering - therefore move it to
QPainterPrivate.

Change-Id: I35880ffa22830c2921c6675b1acf7e4ca38601db
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-06-13 21:23:22 +02:00
Marc Mutz
779f1ff9fa QEvdev: remove m_deviceDiscovery members
They were never referenced outside the classes' ctor and, worse,
remained uninitialized if the specification string contained devices.

Change-Id: I977a156acf10190428da00fe128fee70cff8f98d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-06-13 08:48:26 +02:00
Marc Mutz
f1404c0ed1 QEvdev: Extract Method parseSpecification()
All four manager classes contained roughly the same code in their
ctors that parsed out devices from a colon-separated string.

Extract shared code, and port the parsing to QStringRef (later to be
ported to QStringView).

Saves ~2.4KiB on optimized Linux GCC 9.1 AMD64 builds across all
.so's that link to libQtInputSupport.a.

Change-Id: I3db826ee2b422cfc02f8d49bd21985a03b6c0935
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-06-13 08:48:26 +02:00
Marc Mutz
e01e848df4 QMimeType: towards re-entrancy: do not cache iconName made from mimetype name
To not write into a shared object without mutex protection. If the
stored icon name is empty, just calculate a new one on each call.

Task-number: QTBUG-45684
Change-Id: I01dfb6697b5275e69451da91fdc7346f40bc424e
Reviewed-by: David Faure <david.faure@kdab.com>
2019-06-16 16:56:35 +02:00
Marc Mutz
3bc10fb9bb QEvdev: Replace manual memory management with unique_ptr
Make create() return, and m_mice/m_keyboards/etc store, handlers by unique_ptr.
In most cases, we can't use qt_make_unique(), since the ctor we're calling is
marked as private.

Since QHash can't hold move-only types, use a std::vector<{QString, unique_ptr}>
instead. As this pattern repeats in all four QEvdev*Manager classes, create a
small class template.

Saves almost 6KiB on optimized Linux AMD64 GCC 9.1 builds across all .so's that
link to QtInputSupport.a.

Change-Id: I8f62b6b629d6e1855314c0a4fb4fc069db9ae0ce
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-06-12 13:43:52 +02:00
Marc Mutz
12938ba70b QMimeType: make deep const breakages explicit
QExplicitlySharedDataPointer is propagating const in my tree, and I will be proposing
this for inclusion into Qt 6, so proactively fix the breakage here.

QMimeType is known to be non-reentrant (QTBUG-45684), and this patch doesn't fix it.

Change-Id: If68b148c44439d76ab1d95e8db93b90d12650e51
Reviewed-by: David Faure <david.faure@kdab.com>
2019-06-16 16:06:57 +02:00
Giuseppe D'Angelo
a2632f90db QGradient: add a last-enum enumerator to the presets
It's needed to prepare qtdeclarative for the upcoming patch that
won't make QGradient accept illegal presets any more.

Change-Id: I4ca929e75214ebe24c7d762d0c37ca254c640c57
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-06-14 16:26:27 +00:00
Marc Mutz
cbd5a2dcb8 AtSpiAdaptor: eradicate remaining Q_FOREACH loops
... and replace them by C++11 range-for loops.

Change-Id: I6975121f606ec1fcda7a624b02a68edf829bb70b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-06-13 22:53:04 +02:00
Marc Mutz
3f5d27bfda QEvdev: Extract Method updateDeviceCount()
The code is noisy and repeats, so wrap it in a function.

Change-Id: I5e6e924e22b0bc631eb8176de96c49066b1c9029
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-06-11 23:30:05 +02:00
Marc Mutz
d6cd1a3c2b QUrl: replace manual memory management of QUrlPrivate::Error with unique_ptr
Change-Id: I837866dbeff4b3f4ba4eb5b564041fecbd59e70e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-06-12 17:59:58 +00:00
Marc Mutz
c4a94edbbc QMessagePattern: replace manual memory handling with std::unique_ptr
Dealing with 'tokens' is straight-forward.

With 'literals', it is not quite so straight-forward, because the
ownership chain here is two levels deep. But it's still worthwhile,
because it replaces quite error-prone code with code which may be a
bit more verbose, but is totally safe.

As a drive-by, moved initialization of the fromEnvironment member to
the body of the ctor in order to avoid code-churn (I needed to touch
the ctor-init-list anyway).

The QMessagePattern dtor is now empty and consequently defaulted.

Change-Id: Iadb25e7aba1c5a94fd9068be7ae03f17e975328b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-06-13 22:12:00 +02:00
Morten Johan Sørvig
6faa4d4a87 QFuture: Wait for result on iterator advance
Wait for the result at the target index if the future
is running and the iterator index is past the current
result count.

Determine if there is a result at the target index
after waitForResult() returns, and return -1/end if
not.

Also support decrementing the end iterator. In this
case wait for the future to finish in order to get
the final result count.

Task-number: QTBUG-59811
Change-Id: I8fcc711bab2e72c3c5196a55b794d25e18bb324d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-13 10:41:25 +02:00
Andreas Hartmetz
486c55d743 constify, and micro-optimize not detaching
Change-Id: I08c3c35e27a2b5e816a1532d0bd7cc09459800ab
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2019-06-10 14:44:26 +02:00
Liang Qi
c0ae93fdf9 Merge "Merge remote-tracking branch 'origin/5.13' into dev" 2019-06-14 13:45:18 +02:00
Liang Qi
b1a216649e Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
	qmake/generators/makefile.cpp
	qmake/generators/unix/unixmake2.cpp
	src/corelib/thread/qthread_unix.cpp
	tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp

Change-Id: I1df0d4ba20685de7f9300bf07458c13376493408
2019-06-14 13:45:18 +02:00
Qt Forward Merge Bot
1632786f00 Merge "Merge remote-tracking branch 'origin/5.12' into 5.13" 2019-06-14 01:00:09 +02:00
Qt Forward Merge Bot
2a9cf3aeab Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I53a50669face6f68ddc046fd2102de8c1f888b4b
2019-06-14 01:00:09 +02:00
BogDan Vatra
0676645318 Android: Fix build with NDKr20
In NDK r20 clang adds -lc++ library automatically which leads to link fails.

[ChangeLog][Android] Fix NDK r20 linking.

Task-number: QTBUG-76293
Change-Id: I6675180a3555d1ad9047d7a9ce1c03333cf0ab35
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-06-13 07:14:54 +00:00
Friedemann Kleint
2e20ae3c1b uic: Fix some clang warnings
- Use range-based for
- Use isEmpty() instead .size(), streamline code
- Fix warnings about class definitions, use Q_DISABLE_COPY_MOVE
  and '= default' for trivial constructors

Change-Id: I76255fd9d80c3faffebda9a438e86e918c16d289
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2019-06-06 11:08:01 +02:00
Friedemann Kleint
5343a7018e uic: Replace 'typedef' by 'using'
Apply Fixits by Qt Creator with some amendments.

Change-Id: I152cb5935ff7d649de297b010b9253c625c7da84
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2019-06-06 10:57:04 +02:00
Friedemann Kleint
2f84ec4bcd uic: Introduce nullptr
Apply Fixits by Qt Creator.

Change-Id: Ic2d65b2604d1d71d910773e02bcdf2466f49e52c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2019-06-11 09:05:38 +02:00
Friedemann Kleint
38f1a36f60 Windows QPA: Fix clang warnings about repetitive type names
Fix warning like:
warning: use auto when initializing with new/reinterpret_cast to avoid duplicating the type name [modernize-use-auto]

Change-Id: Ieb7f052919173f6923e68de9f9e849dee45e36e7
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-06-13 10:04:44 +02:00
Laszlo Agocs
7f7eaf1cad Add VulkanMemoryAllocator
The Vulkan backend of QRhi relies on vk_mem_alloc.h from AMD in order
to get a stable, performant, and tested GPU memory allocator. It is not
unthinkable that we will move away from this in the future, especially
considering that a potential future D3D12 backend may need a similar
solution, but until then this will do.

Change-Id: I198a898f216d0795b4bf339ccea80b0cd2efbabc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-06-12 12:42:38 +02:00
Laszlo Agocs
53599592e0 Introduce the Qt graphics abstraction as private QtGui helpers
Comes with backends for Vulkan, Metal, Direct3D 11.1, and OpenGL (ES).

All APIs are private for now.

Shader conditioning (i.e. generating a QRhiShader in memory or on disk
from some shader source code) is done via the tools and APIs provided
by qt-labs/qtshadertools.

The OpenGL support follows the cross-platform tradition of requiring
ES 2.0 only, while optionally using some (ES) 3.x features. It can
operate in core profile contexts as well.

Task-number: QTBUG-70287
Change-Id: I246f2e36d562e404012c05db2aa72487108aa7cc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-06-13 10:13:45 +02:00