Commit Graph

40081 Commits

Author SHA1 Message Date
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
Lorn Potter
df9f9fb368 wasm: handle mouse events even when not over a window
If the mouse button is held and mouse moves from over the window, that
window would never register the button up event, and cause issue like
being able to move a dialog around by simply moving the mouse around.

Change-Id: I1363ac9c9f4113a79bf6863668ba74b90b1cea4a
Fixes: QTBUG-75951
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-05-30 18:30:17 +10:00
Martin Smith
8d2df3002b doc: Fix tr() documentation issue
The declaration of tr() in the Q_OBJECT macro interferes with the
tr() declaration in the QObject class. This update fixes that bug
by resetting QT_TR_FUNCTIONS to be empty and by ensuring that the
tr() declaration in class QObject is seen by clang when qdoc is
running.

Change-Id: If55339fc417f3eee1a1e1ce3df75a18af443d630
Task-number: QTBUG-75864
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-06-13 04:52:57 +00:00
Laszlo Agocs
c143161608 Avoid uninitialized texture data in image glyph cache
The problem becomes visible with styled native text materials in Quick,
but only in certain cases: the regions not used by glyphs in the QImage
are undefined (if they are 0 there's no problem) - but the whole
code path is only used when the fbo readback workaround is enabled.

When these conditions met, the styled text materials may sample locations
with uninitialized data in the texture, showing small artifacts around
the glyphs when shifting is involved in the styling.

The non-image based GL glyph cache handles this by an explicit upload
with all 0's when creating the texture - the QImage code path should do
the same then.

Change-Id: I818ee19f87c6a147e42cd3ead39645da4d0fef11
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-05-28 17:48:03 +02:00
Joerg Bornemann
29fa59d244 Fix parallel lex/yacc invocation for debug_and_release builds
[ChangeLog][qmake] Introduced the variables LEX_DIR and YACC_DIR which
determine the location of lex/yacc output. Fixed parallel execution of
lex/yacc for debug_and_release builds.

Fixes: QTBUG-65730
Change-Id: I68c8260a95609e11bb5205a91aff2c098ed7009c
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
 
 
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-06-06 15:21:37 +02:00
Joerg Bornemann
274882a58c De-duplicate elements of QMAKE_DIR_REPLACE[_SANE]
Elements that appear in QMAKE_DIR_REPLACE_SANE must appear in
QMAKE_DIR_REPLACE to be considered due to the algorithm used in
exclusive_builds_post.prf.

Change-Id: Ibce7e6c988b3e8a141075890a2f547eb34090b3a
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2019-06-06 15:21:37 +02:00
Shawn Rutledge
dd3229e672 Remove a few usages of deprecated API
Change-Id: I94bad0b8d3891c6b4a55178836cfff2a4312e330
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-06-13 16:49:41 +02:00
Marc Mutz
d2ed1074d0 tests: remove the last uses of Java-style iterators
... except where they are actually the component under test.

Java-style iterators are scheduled for deprecation.

Change-Id: If4399f7f74c5ffc0f7e65205e422edfa1d908ee8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-06-13 09:40:26 +02:00
Lorn Potter
762d4afdc1 wasm: fix crash in case network js event becomes null or undefined
also fix data progress

Task-number: QTBUG-75489
Change-Id: I5222fda64d258a6ae78ba0ca20194b81c289c27e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-05-27 11:08:47 +10:00
Marc Mutz
18e7e82d3f Remove the last uses of Java-style iterators in QtCore
They are going to be deprecated.

Add a strategic break. This was a pre-existing problem: the comment
claims that h is invalid (though I personally don't see it), but
then goes on to check the loop condition (which, in the mutable
Java iterator case, involves calling h.cend()). We now cache the
end iterator, so if there ever was a problem, it's probably a
lesser one now, but it's still not kosher, and a debug version of
QHash would find it, so break out explicitly.

Saves ~200b in text size on optimized GCC 9.1 Linux AMD64 builds,
ie. ~100b per loop.

Change-Id: I7684485b55fb23a8cf882f89621ebb75a0e607b5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-05-23 10:09:27 +02:00
Marc Mutz
ac608b7bd2 QDebug: add nothrow move special member functions
This requires making QDebugStateSaver hold QDebug::Stream directly, not
QDebug by reference, as the referenced object will have been moved from
when ~QDebugStateSaver executes. The stream object, however, will still
be around.

Change-Id: I0ca2eb60cb9b68ea3835d9a9ff5e295d9b1c5fb5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2019-06-06 22:25:58 +02:00
Friedemann Kleint
8c9e41cc78 Use QSaveFile in MainWindow examples
QSaveFile should preferably be used by editor applications to catch
write errors.

Task-number: QTBUG-60635
Change-Id: Ia609435871b56b45714c3dd3d32bbc85b5cb4dd5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-06-12 09:29:31 +02:00
Marc Mutz
0ad5e16268 QEvdev: use printf-style qCDebug()/qWarning()
Also use qUtf16Printable() and qErrnoWarning (removing explicit errno, where
present).

Saves 6.6KiB in text size on optimized Linux AMD64 GCC 9.1 build across
all .so's that link to QtInputSupport.a.

Change-Id: I1def2cfabd2eed65390099cd1d06f8061a9355be
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-06-11 21:38:47 +00:00
Marc Mutz
c6a3507de2 SecureUDPServer example: use std::unique_ptr instead of QSharedPointer
The only reason the code used QSharedPointer is that it used QVector
to hold a collection of them, and QVector infamously cannot hold
move-only types such as std::unique_ptr.

Fix by using std::vector<std::unique_ptr> instead. Also, pass the
objeccts into non-sink functions by raw pointer instead of shared_ptr.

As a drive-by, replace clear-following-iterate by the for-exchanged
pattern.

Change-Id: I605fbb98af840c1b93eab9e65c07defd6e7b39e1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-15 14:40:23 +02:00
Giuseppe D'Angelo
de82d239f8 Make QColor a literal type
Extracted from the SVG names patch.

It basically just requires adding a constexpr constructor to the
inner union, then sprinkling constexpr on the existing ones.
Do minor refactorings as drive-by.

Change-Id: I60e7a1c9068def3507cb07440450e51673269f84
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-06-12 19:55:17 +02:00