Commit Graph

26679 Commits

Author SHA1 Message Date
Liang Qi
0a1af55a9b Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/dev 2016-01-26 11:27:37 +00:00
Marc Mutz
b8fb0ee999 uic: eradicate all Q_FOREACH loops [generated code]
... by replacing them with C++11 range-for loops.

Change-Id: I0561174d9981ee2171c23644b5e7aebeb8c25665
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-26 11:23:42 +00:00
Marc Mutz
364e3eb680 rcc: eradicate all Q_FOREACH loops
... by replacing them with C++11 ramge-for loops.

Change-Id: I95a91ac36c2b2bef17bf12cf7f1676653a2d807d
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-26 11:21:48 +00:00
Marc Mutz
956021dbfc qlalr: eradicate all Q_FOREACH loops
... by replacing them with C++11 range-for, or, for loops
over .values(), with explicit iterator loops over the result
of equal_range().

Some fixes here and there to get to mark containers const for
iteration, without having to resort to qAsConst(). Didn't work
everywhere.

Change-Id: Ibc0e71d3b208d118f06e16741af47261ef4b9e15
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-26 11:21:43 +00:00
Marc Mutz
cf9d112d7a qlalr: remove uses of inefficient QLists
For QList<QLinkedList<T>::iterator>, mark the iterator Q_PRIMITIVE_TYPE.
This should be done in Qt itself, but would be binary incompatible.

For two other types that are used as values in QMultiMap, replaced
   foreach (x, map.values(y))
with
   auto range = map.equal_range(y);
   for (auto it = range.first; it != ramge.second; ++it)
       x = *it;
which doesn't require a temporary QList.

Change-Id: I9ddd15dd9b1d5bb3000833d14ed911451a272328
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-26 11:21:37 +00:00
Marc Mutz
18597b2ae2 qdbuscpp2xml: eradicate all Q_FOREACH loops
... replacing them with C++11 range-for loops.

Change-Id: I0233bcf874cdadcd7461e11b89f752dabde086c0
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-26 11:21:25 +00:00
Marc Mutz
3ef7f1615a qdbusxml2cpp: eradicate all Q_FOREACH loops
... replacing them with C++11 range-for loops.

Change-Id: I13825a444dee30b56b08f3ad8a7a0e15bf324678
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-26 11:21:20 +00:00
Marc Mutz
4d3e1cb2b2 qdbusxml2cpp: port classNameForInterface() to QStringRef
... and QStringBuilder.

Found while fixing Q_FOREACH/foreach use in src/tools,
thus contains port to range-for as a drive-by.

Change-Id: I221bb8cb1f0fc3edeabfdb37d5d5a17551ee8d36
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-26 11:21:15 +00:00
Marc Mutz
cf51e2f33f QStringRef: add missing op[]
[ChangeLog][QtCore][QStringRef] Added subscript operator.

Change-Id: Ia85d5efcb7747d2961ba55922ddabe6a46bdf20b
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-26 11:21:09 +00:00
Marc Mutz
1c470f3af0 moc: eradicate all Q_FOREACH loops
... by replacing them with C++11 range-for, or, for loops
over .keys() or .uniqueKeys(), with explicit iterator loops.

Saves 2300b in text size on optimized GCC 5.3 Linux AMD64 builds.

Change-Id: I6e1d4f5e56895dfd74aba21a3d4e913b5825645c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-26 11:21:03 +00:00
Marc Mutz
2c26d519e2 moc: simplify finding required Qt containers
The old code searched for any Qt containers by looking at
- each class definition
  - each property's type
  - each function (signal, slot, method)
    - each argument type
and matching each against "Container<", building
the pattern string each time through the loop.

It would then collect hits in a QSet to be converted
to a QList and sorted at the very end.

The new code pulls the iteration over the candidates
out of all other loops. By doing so, it can stop
looking at classes, properties, functions etc when
it finds the first hit, and it inserts every candidate
at most once.

By iterating over the statically-known list of
candidates, the result is not a sorted set of Qt
containers, as before, but it still has s fixed order
across runs, which was the purpose of the sorting in
the original code.

In the implementation, make liberal use of C++11
range-for, which is safe, as we're passing everything
around as const.

Change-Id: If76dd3f57aa1b544a9cf1de2dca94ca7999220f0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-26 11:20:58 +00:00
Marc Mutz
b8c32f5efc [docs] Gently discourage use of Q_FOREACH/foreach
... and suggest to use C++11 range-for instead.

Change-Id: If4d4dec1a0cbbc2307ee7d2635f0a8fc3a1ec353
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-26 11:20:51 +00:00
Anton Kudryavtsev
520afea6b7 QTzTimeZonePrivate: optimize container usage in init().
Iteration over node-based containers is so slow that the number of passes
should be minimized.

Replace QList with QVector. Saves ~0.2 KBytes in text size with gcc 4.9.

Change-Id: I93298b29b06e4a38a6f716d85f127e0af4385461
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-01-26 09:24:29 +00:00
Lars Knoll
5550e310f9 Remove support for old/deprecated gl function names
These are nowadays standardized.

Change-Id: I3931859bba0b4c34a9336c7f537e3093e07d9b2d
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2016-01-26 07:50:49 +00:00
Anton Kudryavtsev
6ca81d1fd1 QTranslator: don't re-create QString each time through a loop
Just cache it.

Also port to QStringLiteral, because the string is never modified.

Since the string literal is used in more than one function, to
avoid duplication of .rodata, wrap the QStringLiteral in an
inline function.

Change-Id: Ib5aede9f129610c80d122939afc343c938cc8e48
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-01-26 07:34:06 +00:00
Anton Kudryavtsev
037e58fff6 QVariant: replace QLatin1String with QStringLiteral
... in convert() to optimize string creation.

Change-Id: Id012f2f52606c026ed216655ff3ce63bd5154da6
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-01-25 08:36:39 +00:00
Anton Kudryavtsev
7ee1fc4c29 QMimeData: use reserve in formats()
... to optimize memory allocation.

Change-Id: I039a6de6f97858f339b83ca7e3e361963eaa61ee
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-01-25 08:36:36 +00:00
Anton Kudryavtsev
451273523d QMimeData: replace QLatin1String with QStringLiteral
... wherever it allocates memory.

Change-Id: Ice17e39a138ff05b49eb23eecc693d368d0b349e
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-01-25 08:36:34 +00:00
Borgar Ovsthus
fbd6acedac Add TeamCity logging feature to testlib
This allows TeamCity to parse realtime test-results instead of using
post-build XML Report Processing. This does not support logging of
benchmarks.

[ChangeLog][QTest] Added a new logging mode that allow test-results to
be parsed on-the-fly when using Jetbrains TeamCity as CI-server. This
mode is enabled by using the -teamcity option on the command-line.

Change-Id: Ie730beb643043eb0f448f99abe6c0b5ac48aaf03
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-23 18:30:58 +00:00
Thiago Macieira
9eda09f511 Uppercase the verbosity setting enums.
Change-Id: I7a9e11d7b64a4cc78e24ffff142b9996fd77cb10
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-01-22 23:28:14 +00:00
Anton Kudryavtsev
0f51686a69 QVariant: use reserve in convert()
... to optimize memory allocation.

Change-Id: I7f644955be779c3651683401a7985a265b69ca6f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-01-22 10:18:34 +00:00
Tony Sarajärvi
720d1792f2 Remove insignificant from qabstracttextdocumentlayout test
Task-number: QTBUG-28593
Change-Id: If5a102cd1c8cdad6d77cc8dbcece3ac983a8010b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-01-22 09:13:27 +00:00
Tony Sarajärvi
870e68cd75 Remove insignificant flag from qglyphrun test
Task-number: QTBUG-28593
Change-Id: I04e73947c7f131bdb4341c224fb008b26be22c22
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-01-22 09:13:20 +00:00
Thiago Macieira
cfe891eeb8 Add Intel copyright to files that Intel has had non-trivial contribution
I wrote a script to help find the files, but I reviewed the
contributions manually to be sure I wasn't claiming copyright for search
& replace, adding Q_DECL_NOTHROW or adding "We mean it" headers.

Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-21 22:44:21 +00:00
Thiago Macieira
23bd4651c7 Update the Intel copyright year
Not that we require it, but since The Qt Company did it for all files
they have copyright, even if they haven't touched the file in years
(especially not in 2016), I'm doing the same.

Change-Id: I7a9e11d7b64a4cc78e24ffff142b4c9d53039846
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-21 22:44:16 +00:00
Jani Heikkinen
ad38ece3c8 Updated license headers
From Qt 5.7 -> examples are lisenced under BSD license, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/

Updated license headers to use new BSD header instead of LGPL21 one
(in those files which will be under BSD)

Change-Id: I3ad61caaf07802eb9da7d29eca3fe49d8a51b6a8
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-21 18:55:32 +00:00
Jani Heikkinen
f776595cc1 Updated license headers
From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some
exceptions, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/

Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one
(in those files which will be under GPL 3 with exceptions)

Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-21 18:55:18 +00:00
Jani Heikkinen
18455d5585 Fixed qtbase tests to pass with updated license header
Change-Id: I996a1c3713d0799504bd98ffcdfdc7841c88182a
Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
2016-01-21 18:55:03 +00:00
Marc Mutz
5a30884c57 Document qAsConst(), turning it into public API.
[ChangeLog][QtCore] Added qAsConst().

Task-number: QTBUG-50548
Change-Id: Id25592c821808596c6a5768a42b76c1db569f490
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
2016-01-21 09:41:19 +00:00
Liang Qi
158a3a4159 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/corelib/io/qiodevice_p.h
	src/corelib/kernel/qvariant_p.h
	src/corelib/tools/qsimd.cpp
	src/gui/kernel/qguiapplication.cpp
	tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp

Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
2016-01-21 08:17:21 +01:00
Jani Heikkinen
7b2fb038ae Merge "Merge remote-tracking branch 'origin/5.5' into 5.6" into refs/staging/5.6 2016-01-21 04:27:06 +00:00
Thiago Macieira
26ece94a68 Move QIpPacketHeader to the header where QNetworkDatagramPrivate will be
Change-Id: I14839ba5678944c2864bffff1417a1d4b790f9c3
Reviewed-by: Richard J. Moore <rich@kde.org>
2016-01-21 01:06:18 +00:00
Marc Mutz
198768cbba QWidget: fix expensive iteration over QMap::keys()
... with iteration over the hash itself.

Can't keep the call to ungrabGesture() in the loop,
because it removes the current element from the very
hash being iterated over. Instead, inline the call
and optimize based on the context:

- don't remove element by element, but clear the
  hash completely at the end.
- drag the check for QGestureManager::instance()
  out of the loop.
- drop the check for presence of the key in the
  hash, since it would be always true.

Change-Id: I6bf7cc8a59a51ccc8046a5b6d1cab5784e79fd55
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-01-20 21:17:53 +00:00
Edward Welbourne
9c0de96454 Make some initializers be declarations.
This shortens an earlier over-long line of declarations and makes
visible that these are declare-and-initialize.

Change-Id: I39fa9613196c34f7e2b2da04da729324d7f83a55
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-01-20 17:13:04 +00:00
Edward Welbourne
57e024cc81 Avoid shadowing a name (and use the outer variable an extra time)
QDateTimeParser::parseFormat()'s top-level scope has a const int max;
this was shadowed by a short-lived max in an inner scope; and the
outer scope's max could be re-used one more time after that to save
re-evaluating the same unchanged expression it held.

Change-Id: I9f07452bb0b4e5ff4bcf6396d42d1419de6276fa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-01-20 17:12:58 +00:00
Edward Welbourne
aa196457da Avoid dereferencing before the start of a string.
A check for a backslash before a quote neglected to pretest that the
quote wasn't the first character in its string.

Change-Id: Ib5226836d1111e37bed984938f7c667be59eb1c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 17:12:48 +00:00
Edward Welbourne
d8c0bd4207 Make it clearer what's happening with a fall-through.
An if () {...}'s close-brace was hiding on the end of a break; line,
an idiom used in several places for braces that existed to contain a
case (for the sake of local declarations).  This made it hard to see
that there was an if() whose else was the resulting (commented)
fall-through.  So put that close-brace on the comment's line and make
the comment clearly indicate it's an else.

Change-Id: Ie7e7c7063bef96536d6231297b083fc384f2363e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 17:12:36 +00:00
Edward Welbourne
1967accb64 Expand springForward_data() to cover a few more time-zones.
The important one is EET, for the benefit of our CI system; but other
European zones and the USA's coastal zones likely have enough hackers
in them to make this worth checking.

Change-Id: Idcc703bce29808e1a0a6279680cc8d3cbed38dac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 17:11:58 +00:00
Edward Welbourne
f7d9e34b96 Be fussier about setting tst_QDateTime's globals.
Time zones change on the whim of politicians.  Consequently, we can
seem to be in CET/CEST or on UTC (because we tested sample dates when
our zone coincided) when we aren't (i.e. we're in a materially
different zone at the time probed by some particular test).  Make the
initialization of the globals that test this more robust against
governmental meddling and document the unfixable problem with Algeria:
a DST transition *on the epoch*.

Change-Id: I17c5c81d339b80af12f4ffab367e28052dd6c2fa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 17:11:49 +00:00
Edward Welbourne
722df6e0a2 Nomenclature corrections relating to CET.
There are several European time zones; the only one relevant to the
tests here is CET.  They won't work with WET, GMT or EET.  So name
them and related variables for CET, not for Europe.

CET's summer-time isn't called CST; and the (existing) spring forward
test works only in CET/CEST, not elsewhere in Europe.

Change-Id: I55c7544bf792de7495700b749b935ec534831d8b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 17:11:33 +00:00
Friedemann Kleint
191858abe8 QMainWindowLayout::unplug(): Prevent unplugging when the widget is not a window.
Task-number: QTBUG-50490
Change-Id: Icf02e2316bbad0794bd5ac6dccd857bfb28a498b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-20 13:25:57 +00:00
Kevin Funk
8dad3bf212 Fix toDisplayString(QUrl::PreferLocalFile) on Win
When using QUrl::PreferLocalFile we do want to strip the leading slash,
as toLocalFile() would do as well.

Behavior change by means of an example:
  QUrl url(QUrl::fromLocalFile("C:/file.txt")
  url.toLocalFile() --> "C:/file.txt"

Before:
  url.toDisplayString(QUrl::PreferLocalFile) --> "/C:/file.txt"

After:
  url.toDisplayString(QUrl::PreferLocalFile) --> "C:/file.txt"

Task-number: QTBUG-41729
Change-Id: I7d425541f6077ebcf3fcf46feeb7e0f03a0d7fe2
Reviewed-by: Dominik Haumann <dhaumann@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 13:24:53 +00:00
Robert Loehning
49a61f35f3 Add manual test for shortcut using implicit shift
In German layout, "Ctrl+/" is "Ctrl+Shift+7".

Change-Id: I50f3d77c4c76e7eb7cffe31283a3b73074324fea
Task-number: QTBUG-47122
Task-number: QTBUG-50360
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2016-01-20 12:50:11 +00:00
Eskil Abrahamsen Blomfeldt
4de1d0cb28 Android: Fix some QGraphicsScene tests
1. Use qrc for test data so that it can be found on all platforms.

2. Skip a test which does not work on platforms where show() implies
showMaximized(), as it depends on the window size being 150x150.

3. Skip test for hover event which depends on having a valid
mouse cursor position.

4. Skip a couple of tests that fail on some Android devices.
It's not worth spending a lot of time investigating this at the
moment.

Change-Id: Icb2b7f1d82981546a2154a76535b95606d7f40da
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2016-01-20 07:48:34 +00:00
Marc Mutz
a63a506d54 QSslContext: provide sharedFromConfiguration()
It's a version of fromConfiguration() that returns the QSslContext
instance in a shared instead of a naked pointer.

Use it in QSslSocketBackend.

The idea here, of course, is to use QSharedPointer<T>::create(),
which co-locates the refcount with the payload in a single memory
allocation, instead of QSharedPointer<T>(new T), which causes
two allocations.

Change-Id: Ia5396fb3b291f2912fca5cd97e0aa1e45e065e55
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 07:44:08 +00:00
Thiago Macieira
d6bb01e177 Force inclusion of <atomic> on QNX systems.
It's documented to exist in QNX 6.6, which is the minimum required
version for Qt 5.7 anyway.

http://www.qnx.com/developers/docs/660/index.jsp?topic=/com.qnx.doc.dinkum/topic/cpp11/index.html

Change-Id: I7e6338336dd6468ead24ffff141133a2d524f148
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-19 23:41:55 +00:00
Thiago Macieira
7ffcafd1b5 Remove all the atomic code besides MSVC and std::atomic
[ChangeLog][Important Behavior Changes] Starting with Qt 5.7, Qt
requires a C++11 compiler with support for C++11 atomics. This affects
user code too: Qt headers no longer compile with a C++98 compiler. The
minimum compiler versions for this release are:
 * Clang 3.4 (found in XCode 5.1)
 * GCC 4.7
 * Microsoft Visual Studio 2012

Change-Id: Ib056b47dde3341ef9a52ffff13ef1f496ea9363f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
2016-01-19 23:41:52 +00:00
Marc Mutz
57671bebbc QGraphicsAnchorLayout: remove a misguided use of QLinkedList
QSimplexConstraints are held in QList everywhere, yet one
single function, getGraphParts(), used a temporary
QLinkedList. It did so because the function repeatedly
walks the list, erasing elements from it until no more
elements have been removed.

Thus, in O-terms, QLinkedList is the correct choice here.
Sadly, O-notation completely ignores the per-element cost,
and this is where QLinkedList suffers. By the time a QList
has shifted all of its elements left once, the QLinkedList
probably has just finished allocating its first node.

So, use a QList instead.

That, however, turns the it = erase(it) loop quadratic, so
re-formulate the processing part as a lambda and use
std::remove_if. Don't even erase until we know how many
items to erase.

As a benefit, we save the final conversion of the remaining
items back to a QList, and we can use QList::op+ to build
the initial list, reducing the number of allocations
performed by that container to one.

Also saves ~770b in text size on optimized GCC 5.3 Linux
AMD64 builds.

Change-Id: Iecf9e7961dd2b6b20039b9b0d472e32b3fae6994
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-19 21:38:24 +00:00
Marc Mutz
7a17340636 QSslContext: separate creation and initialization
This is in preparation of providing a named constructor that returns
a shared instead of a naked pointer.

Change-Id: I23aed950facac9d0b053321e75b61df7df8a6605
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-19 21:38:19 +00:00
Timur Pocheptsov
b530ca770f tst_qtextcocumentlayout::blockVisibility - make the test more robust
The test inserts strings "0" ... "9" into the text document,
takes the half of resulting document's size, makes half of
lines invisible and compares sizes. On OS X 10.11 after inserting
"4" the width changes, so making "4" invisible also reduces the width
and QCOMPARE(currentSize, previosHalfSize) fails. Instead of digits,
insert the same string "A" 10 times.

Change-Id: Ie88a0442703f98949cea9bcdb694cecee59695f3
Task-number: QTBUG-49848
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-01-19 14:48:47 +00:00