... 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>
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>
Add -stdlib=libc++ when using AppleClang. If CMP0025 is OLD,
the compiler id is 'Clang' for backward compatibility. So, if on a
CI machine running 'Clang', and on APPLE, use the -stdlib=libc++ flag
too.
Change-Id: I4910000ce08bae1201f7fa0e0eb46622bedd5c4f
Reviewed-by: Kevin Funk <kfunk@kde.org>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
These QPairs are larger than a void*, so holding them in QLists
is needlessly inefficient. Worse, the code could come to depend
on the fragile property of (inefficient) QLists that references
to elements therein never are invalidated.
Fix by holding them in QVector instead.
Change-Id: I3c205f5326cfd96482563078bdca1747d718457f
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
We need to have reasonable paths for loading icons and such things, just
as in any other Unix GUI environment. However there is some concern that
it would be too much of a behavior change if there was a theme by default,
so for now it's required to set the env var: QT_QPA_PLATFORMTHEME=generic
That works because QGuiApplicationPrivate::createPlatformIntegration() reads
the env variable and passes platformThemeName to init_platform().
Step 3 in init_platform() does not find a theme plugin by that name
(because QGenericUnixTheme is statically linked via libQt5PlatformSupport.a).
Then in step 4 it iterates the given platformThemeName plus any which
were returned from QPlatformIntegration::themeNames() (which in our case
will be an empty list) and calls createPlatformTheme() with each of
those, until something is returned. So,
QEglFSIntegration::createPlatformTheme() will be called with the
value of the QT_QPA_PLATFORMTHEME env var, and
QGenericUnixTheme::createUnixTheme() will create the generic, KDE or Gnome
theme depending on that value.
Change-Id: Id16b881819ba872830b019ab147b32fbc2156520
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
The type Fetching is larger than a void*, so holding it in QList
is needlessly inefficient. Worse, the code could come to depend
on the fragile property of (inefficient) QLists that references
to elements therein never are invalidated.
Fix by holding it in QVector instead.
Also optimize the append site by liberal use of std::move(). This
code would greatly benefit from emplace_back(), but we can neither
assume it's present in std::vector nor do we require the necessary
C++11 features that would allow us to implement it in QVector, yet
(uniform init and, less so, variadic templates).
Change-Id: I50da0ffd557adff57477245d0e8c1fc1fec1ebc1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
... just so you can observe their absence with QHash::value()
returning nullptr.
Instead, use find() + comparison to end() to detect presence
or absence.
Simplifies quite a bit of code.
Change-Id: Ifd7921bfc8102677ea345ae37d38da31b8105426
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
It failed to copy 'g'.
Fix by letting the compiler generate one.
Change-Id: Ie19fdacb8f27aef821be58c0b727c802d71bfe64
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
It's undefined behavior. Use std::less, which has
defined behavior.
Change-Id: I990d197590cf535c1cb5c055d0b6798e602446dc
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Code like this makes it impossible to provide a templated
QSharedPointer<T>(X*) ctor, so proactively rewrite to use
the proper default ctor, which has the same effect.
Change-Id: I2572e92b12804f873fac4927e93db83f796729f5
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This caused the filename in messages to be one of the other arguments
that were specified instead of the actual filename.
Caused by the fact that mutations are possibly made to `args` in
`parseCmdLine` and thus the amount of items in `args` does not always
match the amount of items in `argv`.
Change-Id: Ief3716dde39dfdc949a5192e7f83d93cf90130f0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
These QPairs are larger than a void*, so holding them in QLists
is needlessly inefficient. Worse, the code could come to depend
on the fragile property of (inefficient) QLists that references
to elements therein never are invalidated.
Fix by holding them in QVector instead.
Change-Id: Ie8d8eff3448ada7aef5dfba7fc701a59821f5b54
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Recursion is alredy prevented by the emittedReadyRead member.
Disabling the read notifications also occurs when:
- a new chunk of data has arrived on an unbuffered socket;
- the buffer size limit has been reached on a buffered socket;
- pauseSocketNotifiers() has been called
Subsequent calls to read() or resumeSocketNotifiers() should re-enable
the notifications independently from possible nesting.
Change-Id: I4587265b8d3ed137516e08fbe92dce2f5eab508c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
Add a function to allow the users to easily run asynchronously Runnables for any thread
directly on Andoroid UI thread.
Change-Id: I631bf8a2c602e038039fec621ec01272af20a400
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>