... 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>
From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/
Updated license headers to use new LGPL header instead of LGPL21 one
(in those files which will be under LGPL v3)
Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/
Added new header templates and corresponding license files. Unnecessary
ones will be removed later when license header change is done to all
Qt modules
Change-Id: I8c482d81e40c03f0c6395e437f55527617aa6b58
Reviewed-by: Tuukka Turunen <tuukka.turunen@theqtcompany.com>
Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... use QByteArray::append(char*,int) instead.
Also cache the return value of the out-of-line function
xcb_get_property_value_length().
Saves ~120b in text size, and a heap allocation.
Change-Id: I4d1deafdcd3345f2b7dfbf8c45702cfee733a269
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Required to change an erase() loop into std::remove_if to
avoid running into quadratic behavior.
While at it, made QXcbXSettingsCallback a proper struct,
used aggregate initialization, and ported another loop to
C++11 range-for.
Saves ~0.5KiB in text size on optimized GCC 5.3 Linux AMD64
builds, and a lot of heap allocations.
Change-Id: I228bb853519ed2590375dc511e527f47bb8daa34
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This adds a way to resume reading from a stream after a ReadPastEnd error.
This is done by introducing a stream read transaction mechanism that keeps
read data in an internal buffer and rolls it back on failure.
[ChangeLog][QtCore] Added QDataStream startTransaction(),
commitTransaction(), rollbackTransaction(), abortTransaction()
functions to support read transactions.
Task-number: QTBUG-44418
Change-Id: Ibf946e1939a5573c4182fea7e26608947218c2d9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
the presence of a [Paths] section causes QLibraryInfo to derive all
property values according to the Qt default directory layout,
disregarding the compiled-in paths from configure. consequently, we need
to write them all to qt.conf as well.
Change-Id: I3558e9aef1fce956812ea91e216f53bf7934c285
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
there is no point in overriding the built-in defaults with the same
values.
Change-Id: I24f66b86f751f7044625b5256f3d979ece782cf7
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Same as the SSE4.2 implementation: use the (optional) ARMv8 crc32[bhwd]
instruction to calculate hashes for strings. For Aarch64, support for
the instruction is dynamically detected. For a 32bit ARM binary, dynamic
detection is only done when the compiler is explicitly told to target
ARMv8. When telling the compiler to target an other/older version, the
crc32 code is not compiled.
Change-Id: I51ebc1a4545dede4988247e75043f29a64c2a6c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Added a new overload function that allows the developer to
specify the desired precision. Until 6.0, it will require
the symbol and precision to be passed to it. Once Qt is at
version 6.0, it will replace the overload function that
requires a value and optionally a symbol.
[ChangeLog][QtCore][QLocale] Added an overload for toCurrencyString()
that allows the decimal precision to be specified.
Change-Id: I1fb7dde3583f46de2ed20ec2a7abaeca23a903ef
Task-number: QTBUG-46595
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... so we can drop the user-defined copy special member
functions and the destructor.
As a side-effect, enables the move special member functions,
which were previously inhibited by the presence of the
now-removed functions, and makes the copy constructor safe
for self-assignment.
Change-Id: I430f83a6a08b1f5ee94b52f52e4d80fa1139d1c1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Make a private member mutable to enable default assignment operator.
Change-Id: I1216875c186ed800e07c6b41a5bae18c3b71b2fa
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Introduce a transaction mechanism that gives the ability to read the
data atomically. Current implementation supports transactions for both
types of devices. For sequential devices, it records the whole input
stream during transaction. For random-access devices, device position
is saved when transaction starts. If an error occurs, the application
may be able to recover the input stream by rolling back to the start
point.
Also, QIODevice::peek() was rewritten to make use of transactions
internally. The replacement of QIODevicePrivateLinearBuffer by
QRingBuffer is closely entangled with that, which makes it unfeasible
to do separately.
Bump the TypeInformationVersion field in qtHookData, to notify the
Qt Creator developers that the offset of QFilePrivate::fileName was
changed and dumpers should be adapted.
[ChangeLog][QtCore] Added QIODevice's startTransaction(),
commitTransaction(), rollbackTransaction(), isTransactionStarted()
functions to support the read transactions.
Task-number: QTBUG-44418
Change-Id: I3564b343ebeeaaf7c48a1dcdb7ef0a7ffec550f2
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This fixes the problem as long as we have C++ 11's semantics for
in-function statics. The Q_GLOBAL_STATIC_WITH_ARGS() is a non-trivial
wrapper whose destructor gets unloaded with the plugin, leading to a
crash-on-exit if the global it wraps outlives the plugin. The plain
(in-function) static manages to avoid this by avoiding the wrapper.
As the static was only needed in one place, this proves a sufficient
solution to the plugin-unload problem *in this case*.
Task-number: QTBUG-45891
Change-Id: I599fbee0b55ece4dceb4bf7202db374b507f5388
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The same message is already printed on UDP and buffered TCP.
Change-Id: I533baf97fe7e1359a38db3c3eb31d0463fe158e5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The code was checking the write buffer in a branch for unbuffered sockets.
Change-Id: I4dc722e7f182562332c3d167e6ebbab7f53f51e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... such as GCC.
truncate(0) was chosen because it is already used throughout
the function. Using clear(), say, which is inline, produces
slightly more code.
As is, saves 160b in text size on optimized GCC 4.9 Linux
AMD64 builds.
Change-Id: I415d09ad2b4547f1d69f78d85e2aa1c1f9a17ed3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Saves just 168b in text size on optimized GCC 4.9 Linux
AMD64 builds, but most for loops are in non-Linux code.
Change-Id: I4f20a65c2e4953011308ff831c9e8fa37a25274b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>