... by replacing them with C++11 range-for loops.
Change-Id: I0561174d9981ee2171c23644b5e7aebeb8c25665
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... by replacing them with C++11 ramge-for loops.
Change-Id: I95a91ac36c2b2bef17bf12cf7f1676653a2d807d
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... 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>
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>
... replacing them with C++11 range-for loops.
Change-Id: I0233bcf874cdadcd7461e11b89f752dabde086c0
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... replacing them with C++11 range-for loops.
Change-Id: I13825a444dee30b56b08f3ad8a7a0e15bf324678
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... 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>
... 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>
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>
... and suggest to use C++11 range-for instead.
Change-Id: If4d4dec1a0cbbc2307ee7d2635f0a8fc3a1ec353
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
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>
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>
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>
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>
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>
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>
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>
... 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
[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>
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>
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>
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>