Commit Graph

26468 Commits

Author SHA1 Message Date
Marc Mutz
e0c8316e17 QUrlQuery: remove misleading comment
The 'itemList' is a QList and is not maintained in sorted order.

Change-Id: I8f221281803ff0e9caa054007bee3058214f2f30
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-04 06:10:51 +00:00
Marc Mutz
b20de8a23d QTranslator: Extract Method is_readable_file from find_translation()
The old code re-used a QFileInfo object, repeatedly
setting new file names with QFileInfo::setFile(QString).

But QFileInfo::setFile() simply assigns itself a
new QFileInfo object:
    *this = QFileInfo(...)
so it's just as efficient to re-create a new QFIleInfo
object for every file name under test.

To avoid extra {} for object lifetime scoping, factor
the repeated evaluation of isReadable() && isFile()
into a small helper function, which also creates and
destroys the QFileInfo object.

The deeper significance of this change is that it
avoids implicit sharing of 'realname', which is
permanently modified. A later patch will make
changes that make 'realname' re-use its capacity
through the lifetime of the find_translation()
function, and sharing the variable implicitly will
nip any auch attempts in the bud.

Force the compiler to not inline the new function.
There's really no point in spending ~0.5KiB in text
size on inlining the code; the miniscule speed
improvement is dwarfed by the memory allocation of
the QFileInfo ctor, anyway.

As a consequence, this change even saves 96b in text
size on optimized GCC 4.9 Linux AMD64 builds, even
though that wasn't even the goal.

Change-Id: I08c5cbb7b6f1ba59440a1597e28d962ce63a7c65
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-04 06:10:45 +00:00
Thiago Macieira
b08d84d39e Autotest: Make sure that we can place calls with disabled delivery
This often happens in applications. Besides, we are expecting at least a
call to RequestName to happen.

Change-Id: Ifd2454ffba454fd591d0ffff1425a84563267d19
Reviewed-by: David Faure <david.faure@kdab.com>
2016-01-03 19:16:33 +00:00
Marc Mutz
5f542f3cca QDBusArgument: remove useless op<< overloads
... and remove misleading comments (these are overloads, not specializations).

The QList overloads do nothing different from the generic container
overloads. Remove them.

Only leave the QVariantList overload, because that converts to
QDBusVariant before serializing. Which means that this should
probably be templated on the container type, otherwise you get
different behavior for QList<QVariant> and, say, QVector<QVariant>,
which is surely wrong.

Change-Id: I215ba9891235b51304c2ed4041d3dbd003d69581
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-03 18:46:27 +00:00
Dmitry Shachnev
7e132066c1 QNativeSocketEngine: fix undefined variable on FreeBSD
Change-Id: I192e20eef4db27fc19ec9a6e517ae5c8cb88897c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-01-02 14:56:15 +00:00
Marc Mutz
04e76ec857 QUnixPrintWidget: fix some poor uses of the QComboBox API
- populate the widget with addItems(QStringList) instead of
  looping over addItem(QString)
- Use findText() instead of looping over itemText(int).
  QComboBox::findText() delegates searching to the model
  (via QAbstractItemModel::match()), so is potentially
  much faster. I say potentially, because match() isn't
  properly reimplemented in most models, yet. But that is
  something to fix in the models.

Change-Id: I6e52cf5af810ab7869c0270504a241868a5ca281
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-02 10:44:23 +00:00
Thiago Macieira
0828d4e8ea Autotest: test both libdbus-1 load failure and connection failure
Change-Id: I39cc61d0d59846ab8c23ffff14242294649c1a45
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2016-01-02 02:06:10 +00:00
Thiago Macieira
9510d99f08 Autotest: Mark D-Bus tests that don't connect to the bus as parallel
There's no problem running them in parallel.

Change-Id: I39cc61d0d59846ab8c23ffff142420a127ab6968
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2016-01-02 02:05:52 +00:00
Thiago Macieira
1f6fa1f37a Suspend processing of some messages in the default busses by default
To retain a bit compatibility with applications developed in the last 9
years that expect that QDBusConnections won't process their events until
the event loop runs, we now suspend the handling of incoming messages
in the two default buses (and only in them) and resume when the event
loop starts. This is required because the new threaded QtDBus would
otherwise process incoming messages that the application didn't expect
it to.

For example, if the application first acquires names on the bus and only
after that registers objects with QtDBus, there's a small window in
which the name is acquired and visible to other applications, but no
objects are registered yet. Calls to those objects may be received,
would then be processed in the QDBusConnectionManager thread and fail.

The work around is to disable the actual handling of method calls and
signals in QDBusConnectionPrivate::handleMessage. Instead, those
messages are queued until later.

Due to the way that libdbus-1 works, outgoing method calls that are
waiting for replies are not affected, since their processing does not
happen in handleMessage().

[ChangeLog][Important Behavior Changes] QtDBus now uses threads to
implement processing of incoming and outgoing messages. This solves a
number of thread safety issues and fixes an architectural problem that
would cause all processing to stop if a particular thread (usually the
main thread) were blocked in any operation. On the flip side, application
developers need to know that modifications to a QDBusConnection may be
visible immediately on the connection, so they should be done in an
order that won't allow for incomplete states to be observed (for
example, first register all objects, then acquire service names).

Change-Id: I39cc61d0d59846ab8c23ffff1423c6d555f6ee0a
Reviewed-by: David Faure <david.faure@kdab.com>
2016-01-02 02:05:45 +00:00
Thiago Macieira
8d195c0d57 Add a default argument to QDBusPendingCallWatcher::finished signal
So we can do
  connect(&watcher, SIGNAL(finished()), receiver, SLOT(foo()));

Change-Id: I39cc61d0d59846ab8c23ffff14241d33fecf2d53
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2016-01-02 02:05:07 +00:00
Thiago Macieira
fd3ea7004d Remove unused member variable QDBusConnectionPrivate::timeoutsPendingAdd
They're never pending, since we add them immediately since commit
186d881440.

Change-Id: I39cc61d0d59846ab8c23ffff14241be6785ad5a0
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2016-01-02 02:05:01 +00:00
Marc Mutz
be94e009ae QFileDialog: optimize string handling in qt_tildeExpansion
- Instead of QString::split()-ing the path, just to inspect the
  first item in the list returned, simply find the location of
  the first separator and work with that.
  -> saves creating a QList, and its QString elements
  -> saves attempted detaches of that list when calling
     first()
- When extracting the user name, don't do it in a QString, do
  it in a QStringRef.
- When constructing the result, don't use QString::replace(),
  use QStringBuilder with a QStringRef into the original string.
- Eradicate the out parameter, it is easily calculated from the
  return value.
- Don't calculate userName on VXWORKS and INTEGRITY, where it
  is not used. Requires a different #ifdef sequence. Fixed
  preprocessor directives' indention as a drive-by.

Costs 84b in text size on optimized GCC 4.9 Linux AMD64 builds.

Change-Id: I61f1e8d558db7fb0c5c1170bdfd6f5ac1f1a9e62
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-01 23:32:13 +00:00
Thorbjørn Martsum
024a52d0d1 QHeaderView - fix broken stretchLastSection
In setStretchLastSection we restore a default section size
if we no longer use stretch. That size was however not
sufficient - we should restore the actual size.

Furthermore we should also always stretch the last section
(last visible index) - and not leave a section with a
huge size and stretch another.

This patch refactors stretch handling and keeps track
of the last section and its size in eg. moveSection,
swapSection, hideSection, showSection etc.

There is an auto test showing and guarding its behavior.

[ChangeLog][QtWidgets][QHeaderView] Fixed some issues
(e.g QTBUG-39010) with restoring of section size after
a section is no longer the last visible section
(in stretchLastSection mode).

Task-number: QTBUG-39010
Change-Id: Id47075b5a9dfeb250027374ecbd10eb8babbf9ef
Reviewed-by: David Faure <david.faure@kdab.com>
2016-01-01 12:56:29 +00:00
Frank Meerkoetter
1568b09f1c Correctly flag WinPhone
Fixes coverity CID21703.

Change-Id: If9587c7cc49768066273a97fc56c3a662104f439
Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
2016-01-01 12:46:11 +00:00
Marc Mutz
9059931cd2 QStateMachine: replace a Q_FOREACH with QSet::op-=
Both 'configuration' and 'pendingErrorStates' are
QSet<QAbstractState*>, so we can use QSet::operator-=
to subtract one from the other. No need to loop
over QSet::remove() here.

Nevermind that QSet::operator-= is really poorly
implemented atm. That needs to be fixed in QSet.

Change-Id: I3f3172ce9a485c4c2abf7d19b831fb0dc1ea61b1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-31 18:44:53 +00:00
Marc Mutz
eb9fdf7c07 QAbstractModelPrivate: de-inline functions
These functions have no business being inline.

Change-Id: Ib565fb4870f886be133e9360155bd514935e5e72
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-31 18:44:49 +00:00
Marc Mutz
e9ec0ff4bb QTimeZone: replace a Q_FOREACH loop with QList::op+=
Change-Id: I6d2cede8126346f7cd4425dafc07c794c2a7bc1d
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-31 18:44:45 +00:00
Frank Richter
50a8fdfd73 QPlatformTheme: Resync StandardPixmap with QStyle::StandardPixmap
Change-Id: I17a91c378175dbbe8066bccb94cc93f0a1fd3d71
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
2015-12-31 18:03:42 +00:00
Marc Mutz
1f7dcbfd7d QtXml: replace a QStack<QString> with std::stack<QString, QStringList>
A QStringList is almost as efficient as a QVector<QString>.
More importantly, the QStringList case can share code with
the myriad of other QStringList users, in particular
because std::stack is but the thinnest of wrappers around
its underlying container.

Saves more than 1KiB in text size on optimized GCC 4.9
Linux AMD64 builds.

Change-Id: Ia9c1f8b8c6d3b619f587a0cc0f662462d1b6bdc5
Reviewed-by: David Faure <david.faure@kdab.com>
2015-12-31 09:29:53 +00:00
Robin Burchell
cbc4750f52 QSocks5SocketEngine: Always try to connect in connectToHost unless already connecting.
Otherwise, connectInternal becomes a no-op after an initial connection attempt
has been made (making the socket effectively useless if that connection attempt
fails).

A workaround is to close() the socket, which worked by virtue of
QAbstractSocket's close() disconnecting (which ultimately calls
resetSocketLayer, and destroys the socket engine instance) - meaning that the
next connection attempt would have a fresh socks instance to try out the
connection with.

Reported-by: Gabe Edwards <gabe.edwards@me.com>
Change-Id: Iab1e84af6d4248fd75a6dfe5e79a3c73129aae0b
Reviewed-by: Richard J. Moore <rich@kde.org>
2015-12-30 20:14:19 +00:00
Błażej Szczygieł
a6b2a4642f Fix incorrect screen number reported by QDesktopWidget
Screens connected to separate graphics cards are detected as
separate screens which don't have offset. This patch fixes obtaining
the screen number by QWidget: it uses the screen assigned to the root
widget. The patch also assigns a proper QScreen to each QDesktopWidget
screen().

It also fixes closing a popup menu by clicking on another screen.

Task-number: QTBUG-48545
Change-Id: I3d76261c0c067293d39949c4428b2d8dfd085dc7
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2015-12-30 13:36:39 +00:00
Rolland Dudemaine
79a03c8457 Move the QVariant declaration up in the file.
This is especially necessary for the GHS toolchain which otherwise
chokes on the lack of some local definitions made by the
Q_DECLARE_SHARED macro.

Change-Id: Ie4e355226e4a66e1589e1d422d3a622b11bd9aef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-12-30 12:57:20 +00:00
Marc Mutz
96dc9a19ae QUrlQuery: fix a very expensive always-true check
In a non-const function, if (d), d being a QSharedDataPointer,
will resolve to if(d.data()), which detaches and returns a
pointer to an unshared copy of the data. Thus, the test if (d)
is always true.

Fix by explicit use of constData(), as in other QUrlQuery
functions.

Change-Id: Ib926abdcdb069d69e34c3202c4cf451b7fc6a329
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-30 12:05:59 +00:00
Marc Mutz
5c81863019 moc: replace a QStack<QByteArray> with std::stack<QByteArray, QByteArrayList>
A QByteArrayList is almost as efficient as a QVector<QByteArray>.
More importantly, the QByteArrayList case can share code with
the myriad of other QByteArrayList users, in particular
because std::stack is but the thinnest of wrappers around
its underlying container.

For moc, saves almost 1KiB in text size on optimized GCC 4.9
Linux AMD64 builds.

For qdbuscpp2xml, which re-uses moc code, saves ~1.6KiB.

Change-Id: I861e92b3c79e47e0ce892ccf54c9041182aaf212
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-30 12:05:16 +00:00
Marc Mutz
08adcc62a7 QComboBox: use NRVO from QAIM::match() and prevent a detach attempt
Receiving the QStringList return value through RVO instead of
move-assigning it saves 48b in text size on optimized GCC 4.9
Linux AMD 64 builds.

Marking the QStringList const saves another 112b because the
following first() doesn't need to attempt a detach.

Change-Id: If6f25399e80de12114ce41c557bff6ee8c24938b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-30 12:05:09 +00:00
Marc Mutz
d681107f1f Add qHash(std::pair)
We already include <utility> in <qglobal.h>, so we might
as well provide a qHash() overload for std::pair.

[ChangeLog][QtCore] Added qHash(std::pair), defined in
<QHashFunctions>.

Change-Id: I0f61c513e82e05ce9d2e56bcf18f3be9e2da4da9
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-30 11:37:53 +00:00
Frank Meerkoetter
982fefe69d Cleanup memory owned by QTestTablePrivate
Since 7a42c8c15c QTestTablePrivate no
longer cleans up the memory it holds in dataList. This will make tools
such as valgrind/address-sanitizer generate a lot of noise about
directly or indirectly leaked memory.

Change-Id: Ic0900ecdd7b76cda9f5366f3950bccde2f1b244c
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-12-30 10:02:48 +00:00
Marc Mutz
ad74c95399 Optimize string building in QCommandLineParserPrivate::helpText()
- Don't detach QCoreApplication::arguments() by calling first(),
  call constFirst()
- Use
    QString foo;
    foo += initial;
  instead of
    QString foo = initial;
  where 'foo' receives more appends later (does not force an
  initial capacity that is known to be too small).
- Use QStringBuilder more
- Don't use QStringLiteral in QStringBuilder expressions
- Reserve optionNameList. Its max. size is known ahead of time.
- Don't create optionNameStrings for hidden options.
  The result was never used, they just served as placeholders
  for the lock-step iteration that followed and wrapped the text.
- Don't create a QStringList to join(), append to the result
  string directly.
- Cache the return value of option.valueName().

Not only is this faster, it also saves more than 2KiB in text
size on optimized GCC 4.9 Linux AMD64 builds.

Change-Id: Id1d88f3c36a521ac71f3a7436810ed31319077ae
Reviewed-by: David Faure <david.faure@kdab.com>
2015-12-29 19:02:18 +00:00
Marc Mutz
db0453742c QTimeZone: don't iterate over QHash::keys()
... iterate over the hash directly.

Prevents hash lookups and the creation of a temporary QList.

Saves over 376b in text size on optimized GCC 4.9 Linux
AMD64 builds.

Change-Id: I7f1a22da33b94bc91bec89f62c471f8279a5d702
Reviewed-by: Sérgio Martins <iamsergio@gmail.com>
2015-12-29 19:02:11 +00:00
Thiago Macieira
83da3e5eda Change a QList of pointers to QVector
QList of pointers is optimum, but QVector should provide the same
performance (we aren't using the beginning-of-list feature that QList
has and QVector doesn't).

But since we're using QVector elsewhere, this should be better.

Change-Id: I39cc61d0d59846ab8c23ffff14241c6715e2eb00
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2015-12-29 12:31:38 +00:00
David Faure
72b4f0d474 QMimeDatabase: follow symlinks when checking for FIFO etc.
This was documented, but not what the code did.

Task-number: QTBUG-48529
Change-Id: I4849778c61dcae13be27c62b24717693c0c07d78
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-29 11:06:13 +00:00
Marc Mutz
c6177dcccf QMimeDatabase: return a sorted list from d->mimeTypesForFileName()
All but one of the callers sorted the list in at least one
code path, with code paths that use the list unsorted looking
suspiciously non-deterministic. The one caller that doesn't
sort the list doesn't use it at all (but uses the out parameter,
which none of the other callers do, suggesting that the function
be split into two at some point).

Change-Id: I178c1476919e4877ef4f4a3cc8934dbd04bd7a58
Reviewed-by: David Faure <david.faure@kdab.com>
2015-12-29 10:58:44 +00:00
Kevin Funk
9871c3d8bd CMake: Add -fPIC to CXX flags only where necessary
Before this patch, Qt5Core_EXECUTABLE_COMPILE_FLAGS was populated with
-fPIC unconditionally. This causes warnings on MSVC, since the compiler
does not understand this flag.

In fact, -fPIC is only required in case an older release of CMake is
being used and the compiler is GCC 5.x (according to documentation), so
let's really add it just in this case.

Task-number: QTBUG-47942
Change-Id: I9d09b8b257a0647235d6d781ee5c023af34f8f88
Reviewed-by: Stephen Kelly <steveire@gmail.com>
2015-12-28 22:39:58 +00:00
Harald Fernengel
959f09bbc5 Remove CMake warning
CMP0054 changes CMake behavior wrt. interpreting quoted arguments in
if() statements. This change ensures that CMP0054 dev warnings are
never emitted no matter how polluted the environment, e.g. even
if the variable ${5.5.1} is defined and no matter whether CMP0054
is set to OLD, NEW or undefined.

Change-Id: Iee008497b333e2db23fb1adbf8b02252314ffa8a
Reviewed-by: Kevin Funk <kfunk@kde.org>
Reviewed-by: Stephen Kelly <steveire@gmail.com>
2015-12-28 22:37:22 +00:00
Marc Mutz
e979f87217 QLoggingRegistry: don't iterate over QHash::keys()
... but use the new key_iterators instead.

Saves creating a temporary QList just to iterate over it
and ~1.3KiB in text size on optimized GCC 4.9 Linux AMD64
builds.

Change-Id: Id5223fc5fcb4a4e7c012718c1bb2674b8ea0439d
Reviewed-by: Sérgio Martins <iamsergio@gmail.com>
2015-12-28 14:30:38 +00:00
Marc Mutz
17504a7b32 QTextStream: use new QString::resize(int, QChar) for padding
Change-Id: I17c90ea32614c45f038f5f3386749dfa74bad438
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-12-28 09:15:31 +00:00
Marc Mutz
8f166ccf40 QString: add resize(int, QChar)
This will be used in QTextStream to speed up padding processing.

[ChangeLog][QtCore][QString] Added resize(int, QChar) overload.

Change-Id: Id51f8cdacb167310157100b05cacf20e9a5d2716
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-28 09:14:59 +00:00
Marc Mutz
050b682412 QDBusIntegrator: fix quadratic behavior
Calling QVector::erase(it) in a loop consitutes quadratic
behavior (O(N) function called O(N) times).

Fix by using std::remove_if(), which is linear.

Change-Id: I39c11231d604bc2d9506427bc3411b71d71b5569
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-27 14:25:40 +00:00
Frank Meerkoetter
4501e25a51 Fix double close.
resetTty() already does close the fd.
Fixes coverity CID89074.

Change-Id: I2d5fe9bf40b03ed5c249713c64f1dc2ae58ea84b
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2015-12-26 10:45:42 +00:00
Marc Mutz
1663bdbf15 QGLShaderProgram: replace a Q_FOREACH with qDeleteAll()
Change-Id: I81a7a3accdcbd3229aeb1dc6fcda5b4ae5cd1a7b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2015-12-26 07:46:15 +00:00
Marc Mutz
6c28efb58b QGLShaderProgram: hoist some constant expressions out of a loop
d->programGuard and its ID don't change when calling a
GL function, so check them only once, before entering
the loop, instead of once per iteration.

Cache d->programGuard->id().

Change-Id: I398da7a76823b2eb854b7b9d5af512adf9969fc9
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2015-12-26 07:46:09 +00:00
Allan Sandfeld Jensen
b1c156d692 Default to OpenGLES when building with -opengl es2
Fixes the xcb_glx plugin to follow the -opengl configure option for
default surface types. This makes it match closer to xcb_egl behavior
and makes the default match QOpenGLContext::openGLModuleType.

Change-Id: Iea3f8069fffefa46a32945eeeea1312566df129f
Task-number: QTBUG-50015
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2015-12-25 14:02:08 +00:00
Frank Richter
3118f0b6b0 QCommonStyle: Multiple icon sizes for more Windows stock icons
Change-Id: I842270b922e019bdef0bb65efaf4a08db10c511e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-24 13:40:16 +00:00
Frank Richter
8d59ef4b79 QWindowsTheme: Preferably obtain stock pixmaps via SHGetStockIconInfo
Change-Id: I5dd958ce572a34f5ccf0d9df2a93486cc68c527b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-24 13:40:05 +00:00
Alex Trotsenko
27479c1323 Enable a test for QFilePrivate::fileName offset on 32 bit Linux
Change-Id: I3577ff7126263ddbe4b7714095480e6f1da7b661
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-12-23 14:36:15 +00:00
Marc Mutz
b78097b22d QtPrintSupport: eradicate all Q_FOREACH loops
Saves more than 2KiB in text size on optimized GCC 4.9 Linux
AMD64 builds, iow: ~0.5% of the total library size.

Change-Id: I84e1dc208da13eefdf1573c9b7ac7c9d76a7f5c7
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-23 09:38:38 +00:00
Marc Mutz
2d4295f167 QGraphicsView: replace some Q_FOREACH loops over const locals with C++11 range-for
This needs to be handled a bit carefully, because Qt containers
will detach upon being iterated over using range-for.

In the cases of this patch, that cannot happen, because all
containers are local and marked as const (either by this patch
or before).

Separate patches will deal with other situations.

Range-for loops are much more efficient than foreach loops.

This patch shaves ~1.8KiB of text size off an optimized Linux
AMD64 GCC 4.9 build.

Change-Id: I5c58658937ac4323594161bf94a2fce3c5667914
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-23 09:14:07 +00:00
Marc Mutz
4e628397b0 QGraphicsView: replace some Q_FOREACH loops over rvalues with C++11 range-for
This needs to be handled a bit carefully, because Qt containers
will detach upon being iterated over using range-for.

In the cases of this patch, that trivially cannot happen, because
all containers are marked as const when being assigned the rvalues
previously found on the rhs of the Q_FOREACH. The new code thus
does exactly what the old code did: take a const copy, then iterate
over it.

Separate patches will deal with other situations.

Range-for loops are much more efficient than foreach loops.

This patch shaves almost 4K of text size off an optimized Linux
AMD64 GCC 4.9 build.

Change-Id: Ida868b77d078cbfa0516d17e98e6f0a86fcdb7a3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-23 09:14:03 +00:00
Marc Mutz
a2d218cc41 tst_collections: "explicit instantiation of 'NS::QList' must occur in namespace 'NS'"
Probably correct.

The question is just why this code has survived for so many years.

Change-Id: Iaf01850476f9b066243abebb9ee6c5928d7ada19
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-12-23 08:35:49 +00:00
Marc Mutz
29ddfc3be7 tst_collections: "explicit instantiation of 'NS::QList' must occur in namespace 'NS'
Probably correct.

The question is just why this code has survived for so many years.

Change-Id: Iaf01850476f9b066243abebb9ee6c5928d7ada19
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-12-23 07:27:39 +00:00