Commit Graph

27619 Commits

Author SHA1 Message Date
Marc Mutz
85c2a128ef QtWidgets: eradicate Q_FOREACH loops [rvalues]
... by replacing them with C++11 range-for loops.

This is the simplest of the patch series: Q_FOREACH took a
copy, so we do, too. Except we don't, since we're just
catching the return value that comes out of the function
(RVO). We can't feed the rvalues into range-for, because
they are non-const and would thus detach.

Saves 2.2KiB in test size on optimized GCC 5.3 Linux AMD64
builds.

Change-Id: I914aa20fe65577b2e32ea7ea89d51a8d003a57ba
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-28 10:50:18 +00:00
Marc Mutz
e1c2bfa53b QtWidgets: eradicate Q_FOREACH loops [QVarLengthArray, std containers]
Q_FOREACH over a QVarLengthArray or std containers
is a particularly bad idea (because of the deep
copy that Q_FOREACH then performs).

Use C++11 range-for (without qAsConst(), because
neither QVLA nor std containers are CoW).

Saves 5.7KiB in text size on optimized GCC 5.3
Linux AMD64 builds.

Change-Id: I4c1fb0b488bb08726912528b559840a45c1397df
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-28 10:50:08 +00:00
Boris Pek
a17a7d37c2 Update QMAKE_LIB in win32-g++ mkspec
`ar' tool from latest binutils shows warning:
ar error: `u' modifier ignored since `D' is the default (see `U')

Warning message includes word "error" so QtCreator processes it as
error in UI.

`ar' command-line option `u' might be dropped safely because it is
unnecessary. Option `c' is added to suppress extra `ar' warnings.

Other build systems are also affected. For example, automake:
https://bugzilla.redhat.com/1155273

Change-Id: Ia378b720503d93b0c0c12ae7a5f38f4d7c32eee5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-02-27 08:09:15 +00:00
Friedemann Kleint
c3761bf6a7 tst_QDialog::snapToDefaultButton(): Do not check on exact cursor position unless hint is set.
Given the flakyness of cursor positioning, loosen the check to only verify
that the cursor is outside the window. The hint is only active on Windows
depending on a system setting.

Task-number: QTBUG-51516
Change-Id: I474d251cc41e68f182baf8dba84eaf38d914d7ee
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-26 19:17:19 +00:00
Marc Mutz
1d8030cc64 QtWidgets: prevent detach attempts from first()/etc. use [dialogs, kernel, util, widgets]
The algorithm used was:
- If possible, just declare the container const
- Otherwise, for first()/last(), use constFirst()/constLast()
  and for front()/back(), to not destroy the use of the STL
  API subset, use qAsConst()

Did some caching of function returns here and there, and
converted one 0 to nullptr as a drive-by.

Also saves almost 4KiB in text size on optimized GCC 4.9
Linux AMD64 builds.

Change-Id: I04b7bfd68dc85c22de247cb65a310e1cbbca1e8c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-26 18:56:43 +00:00
Friedemann Kleint
bc5917a10a Fix warnings about constructor initialization order in tst_QObject.
tst_qobject.cpp: In constructor 'DispatcherWatcher::DispatcherWatcher(QEventLoop&, int*, int*)':
tst_qobject.cpp:5871:10: warning: 'DispatcherWatcher::m_statusAboutToBlock' will be initialized after [-Wreorder]
tst_qobject.cpp:5870:10: warning:   'int* DispatcherWatcher::m_statusAwake' [-Wreorder]
tst_qobject.cpp:5815:5: warning:   when initialized here [-Wreorder]
tst_qobject.cpp:5870:10: warning: 'DispatcherWatcher::m_statusAwake' will be initialized after [-Wreorder]
tst_qobject.cpp:5869:17: warning:   'QEventLoop* DispatcherWatcher::m_eventLoop' [-Wreorder]

Amends change c5d4972577.

Task-number: QTBUG-18434
Task-number: QTBUG-32859
Task-number: QTBUG-36434
Change-Id: I03a9c872469334741a26b4dc1783a36d48f1556f
Reviewed-by: Paolo Angelelli <paolo.angelelli@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-26 17:37:32 +00:00
Marc Mutz
9c63ad562b qmake: restore nothrow move special members
The user-defined copy assignment, copy constructor
and dtor inhibit the move special member functions.

Implement them manually.

Change-Id: I0d38d7cf6c9611e13b5b081d734d01d6fe4d5276
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-26 16:57:26 +00:00
Tony Sarajärvi
12705f70c9 Blacklist a font dialog test that fails
This test has failed already in openSUSE 13.1 where
it has been marked as insignificant. Incorrect font
size is returned from a font dialog in tst_qfontdialog.

Task-number: QTBUG-46056
Change-Id: I7b5841e90d4cbe9d9573b46ec7dec64432160473
Reviewed-by: Akseli Salovaara <akseli.salovaara@theqtcompany.com>
2016-02-26 10:57:50 +00:00
Tony Sarajärvi
78904a38f6 Blacklist tst_QStyleSheetStyle::hoverColors as it is flaky
Task-number: QTBUG-51400
Change-Id: I29793b2da26951ace3a32df7e5e0d0a2dfdac759
Reviewed-by: Akseli Salovaara <akseli.salovaara@theqtcompany.com>
2016-02-26 10:57:45 +00:00
Friedemann Kleint
9f134750a1 QPlatformWindow::screenForGeometry(): Do not call mapToGlobal() on top level geometry.
Use mapToGlobal() only for foreign windows passing relative coordinates.
Amend change 9915630d08.

Task-number: QTBUG-50206
Task-number: QTBUG-51320
Change-Id: Idee60cc8ea8004c0355ce78a00f807798836b49c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-02-26 09:48:39 +00:00
Anton Kudryavtsev
13bcdc0f50 ItemModels: replace QLatin1String with QStringLiteral
... wherever it allocates memory.

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: If4fca7443b3150b1c8360c850da32f5c567c1065
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-26 09:28:47 +00:00
Edward Welbourne
45ae0cb780 Remove a mis-placed QSKIP().
It made us skip the rest of the test, not just the small set of
sub-tests that were conditioned by the if () in whose else it sat.

Change-Id: I5e914e0aeb9d5ba44b21966d071aaccbc590365d
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-02-26 09:22:35 +00:00
Marc Mutz
0a8fd9c620 tst_qguimetatype::flags(): port to QTypeInfoQuery
QTypeInfoQuery was introduced for 5.6 to decouple isStatic
and isRelocatable so old code continues to work. But since
this test still uses !isStatic to mean trivially-relocatable,
it will fail as soon as one of the checked types is marked as
Q_RELOCATABLE_TYPE instead of Q_MOVABLE_TYPE.

Incidentally, such a change is in the pipeline for Qt 5.7/5.8,
so fix the test by porting to QTypeInfoQuery. Do this in 5.6,
because that's when QTypeInfoQuery was introduced.

Change-Id: I06f815f26ca9b430e124c4a2f8de2a729999762b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-26 09:12:23 +00:00
Kai Koehne
c320d5221f Win: Prevent crash in qt_message_fatal()
The source argument can be nullptr, e.g. if debug information
has been stripped out.

Task-number: QTBUG-51195
Change-Id: Ie229c82278c420200cad33c19e8c3f52ab7f12c3
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-26 08:41:39 +00:00
Friedemann Kleint
4905bf0654 Windows Accessibility: Fix warnings as shown by Qt Creator's Clang based code model.
Introduce C++ casts and add some conversions. Where possible, increase
const-correctness. Remove trivial conversion function
BSTRToQString().

Task-number: QTBUG-50804
Change-Id: I1820d4693db8bc0dfa6c4a5fecd768cf64a4405c
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-02-26 08:24:38 +00:00
Friedemann Kleint
403b7d4a21 Windows Accessibility: Refactor code creating COM arrays.
Introduce a convenience function for allocating arrays and use
algorithms.

Task-number: QTBUG-50804
Change-Id: Iead75f8297923fd13efcfc7987f76262777d074b
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-02-26 08:24:34 +00:00
Friedemann Kleint
7984f24b1f Fix potential crash in QWindowsIA2Accessible::QueryInterface().
QWindowsIA2Accessible does not implement IAccessibleRelation (found
when replacing the C-style casts by static_cast<>). Remove the
corresponding branch.

Task-number: QTBUG-50804
Change-Id: I80901634044f85e413666f34b91be2e6ad70da91
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-02-26 08:24:31 +00:00
Friedemann Kleint
d1dfcc776f Windows QPA: Apply scaling when fixing maximized/frameless geometry.
Task-number: QTBUG-8361
Task-number: QTBUG-51327
Change-Id: I590702df8f6313701fe69d0873657c6af53fee16
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
2016-02-26 08:24:27 +00:00
Friedemann Kleint
cf846d6a8a Fix QHighDpi::fromNative(QRect, QScreen *, QPoint).
Call fromNative() instead of toNative().

Task-number: QTBUG-46615
Change-Id: I1e648a2680126d1f560e71573f7346b053fe676b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-02-26 08:24:24 +00:00
Friedemann Kleint
827420c4c6 Windows QPA: Fix scrolling down with mouse wheel.
Use GET_WHEEL_DELTA_WPARAM() instead of HIWORD and casting.

Fix breakage introduced by b20548f999 .

Change-Id: I11bd97d73c12d72e824e3f769e9c402975f27d48
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-02-26 08:24:21 +00:00
Friedemann Kleint
ea757da436 QWindowsTheme: Run SHGetFileInfo() in a thread.
Windows 10: SHGetFileInfo() (as called by item views on file system
models has been observed to trigger a WM_PAINT on the mainwindow
for totally obscure reasons, causing a recursive repaint. Suppress
this by running it via QThreadPool.

Task-number: QTBUG-45298
Task-number: QTBUG-48823
Task-number: QTCREATORBUG-14888
Change-Id: I7479102b9b8fb0771681260298c3d735e66f220f
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-02-26 07:17:00 +00:00
Friedemann Kleint
c0963486ce QScreen::grabWindow(): Scale the coordinates.
The coordinates need to be scaled before calling QPlatformScreen::grabWindow()
On return, set a devicePixelRatio on the pixmap.

Adapt the QWidget test to scale the grabbed pixmaps.

Fixes pixeltool displaying the wrong part of the screen when High DPI scaling
is in effect.

Task-number: QTBUG-46615
Change-Id: I12de7df0da669230cf0fae74f4a42d43f061d5ff
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-02-26 07:16:48 +00:00
Kai Pastor
44357dbe42 QMacPrintEngine: Really set the printer resolution
As already reported in 2009 (Qt 4.6) QPrinter never actually set the
printer resolution. This change adds the necessary call to
PMPrinterSetOutputResolution (available since OS X 10.5).

[ChangeLog][QtPrintSupport][OS X] QMacPrintEngine now really sets the
printer resolution.

Task-number: QTBUG-7000
Change-Id: I3e851b62e1a7ed78564a8a6fd576b0a18d7eff63
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
2016-02-25 18:42:47 +00:00
Jan Arve Sæther
debc44cf11 Add missing initializations in QWheelEvent
Change-Id: I77f014934b97aa6729d568996f0e6c03feb44588
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2016-02-25 18:39:21 +00:00
J-P Nurmi
45feee5f93 Fix QDBusPlatformMenu::menuItemAt()
Other platform menu implementations check that the index is not out of
bounds, so make QDBusPlatformMenu::menuItemAt() do the same.

Change-Id: I1d2e42681f2dbfff8b80044141d620bddbc3b6aa
Task-number: QTBUG-51372
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
2016-02-25 18:33:34 +00:00
Jake Petroules
fcfe2a5f67 Also search the main bundle plugin path for plugins on Apple OSes.
The default value of QLibraryInfo::PluginsPath is $prefix/plugins,
where $prefix is the path to the bundle's contents directory
(for example, .../foo.app/Contents/ on OS X, or .../foo.app/ on iOS).

On Apple platforms the directory is actually called "PlugIns".
Plugins could previously be loaded on OS X by coincidence, but
if the system is using an HFS+ Case Sensitive filesystem (and this
is ALWAYS the case on iOS-like operating systems), the case
mismatch would cause plugins in an application bundle not to be
found/loaded.

This change allows plugins to be located in application bundles
on Apple platforms regardless of the HFS+ case sensitivity mode
and without needing to specify a qt.conf file.

Change-Id: Ie0a0f7448fbf5fb410aa77944ba0d01895bb05e3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-02-25 16:52:38 +00:00
Simon Hausmann
38944d662e Fix syncqt.pl not respecting #pragma qt_no_master_include in files with Windows line endings
We need to do the same chop trick that we do further down the file.

Change-Id: If4f832f375a11473e66adfcfa76a3b4504b3d406
Task-number: QTBUG-51324
Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-02-25 16:25:37 +00:00
Thiago Macieira
469e293286 Fix crash when a standard bus isn't available
Commit 1f6fa1f37a added a way of
suspending delivery of messages to standard buses when they connect and
resuming delivery when the main loop starts. As a side-effect, we caused
an attempt to do dispatching even after the connection failed. The D-Bus
library doesn't like that.

Task-number: QTBUG-51299
Change-Id: I0c94a5c2846b48c8aea7ffff143564f7fcede890
Reviewed-by: David Faure <david.faure@kdab.com>
2016-02-25 16:25:29 +00:00
Liang Qi
3ed944b843 Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/dev 2016-02-25 12:23:23 +00:00
Timur Pocheptsov
26961e32f3 QCocoaKeyMapper - correctly update key layouts
QCocoaKeyMapper has 2 bugs:
- fails to update layouts even if input source changed
- while looking for the possible keys it clears bits for
  neededMods thus making later shortcut match impossible

Change-Id: Ie230b973acd5ca6f50b97ca4901ede61b581d273
Task-number: QTBUG-50865
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-02-25 11:38:18 +00:00
Friedemann Kleint
e695b92464 QWindow: Use scaling when calling QPlatformWindow::mapTo/FromGlobal().
The platform window API uses native pixels.

Task-number: QTBUG-50206
Change-Id: I1385d34bb0eacd61d77cad483e2a863d129ed129
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-02-25 11:20:18 +00:00
Friedemann Kleint
b690fe7cfa Add We-mean-it comment to qnetworkdatagram_p.h.
Fix warning:
WARNING: qtbase/src/network/kernel/qnetworkdatagram_p.h does not have the "We mean it." warning

Change-Id: I65fc2dc9129b194b08865e3486fae4d0cad3f3d3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-25 10:20:54 +00:00
Allan Sandfeld Jensen
3126fa227b Improve QCOMPARE output of char comparisons
Make actual and expected values of char tests more useful by using
C syntax. This means we can actually read non-printable characters.

Task-number: QTBUG-51294
Change-Id: I031e15916a2882c0499b6217ae1649d4eea09eb4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-02-25 09:45:30 +00:00
Liang Qi
5439451def Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	mkspecs/features/qt_module.prf
	src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm

Change-Id: I7912c23b02b186831f0e465dbe5d1f9936205439
2016-02-25 09:55:25 +01:00
Erik Verbruggen
de9de96d81 Add QResource to the bootstrap library
It's very useful for bootstrapped tools to be able to include resources.
Those can now be accessed through the QResource API.

Change-Id: Ie8247877a9a4a81cec006bab2b58331270487aef
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-25 08:20:07 +00:00
Tony Sarajärvi
d8f4d4452d Adjust tst_qabstracttextdocumentlayout for border cases
OpenSUSE 42.1 failed this case for some reason. With this change
the test tests the anchor from the middle of the string instead
of looking for it from the end.

Task-number: QTBUG-51345
Change-Id: I2fc7496399f46926f261c7a1f48756bfaf782f7b
Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-25 07:37:49 +00:00
Friedemann Kleint
28ee76fd0b QtPlatformHeaders/Windows: Add function to set window activation behavior.
The Windows OS by default does not activate windows when the calling
process is not active; only the taskbar entry is flashed as not to
distract the user.
Nevertheless, for some use cases, it is desirable to activate the window
also in the inactive state.
Introduce an enumeration specifying the behavior to QtPlatformHeaders
and employ a workaround using the Win32 API AttachThreadInput() to attach
to other processes while setting the foreground window to achieve
the AlwaysActivateWindow behavior.

Task-number: QTBUG-14062
Task-number: QTBUG-37435
Change-Id: I79cb6cd3fab29d55b5d3db7f9af01bbaa5096a37
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-02-25 07:17:43 +00:00
Anton Kudryavtsev
97965a0908 QtGui: use reserve to optimize memory allocation.
Change-Id: I34a571b67840557de19ab496cadebd698c7f4f6a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-25 04:56:31 +00:00
Marc Mutz
8dc024adc6 QtCore: replace QStringLiteral with QLatin1String when appending
It makes little sense to use QStringLiteral for strings which are
immediately appended to, or which are appended to other strings,
because no dynamic memory allocation is saved by doing so. But if
the only advantage of QStringLiteral does not apply, all its
disadvantages dominate, to wit: injection of calls to qstring dtor,
non-sharability of data between C strings and QStringLiterals and
among QStringLiterals, and doubled storage requirements.

Fix by replacing QStringLiteral with QLatin1String.

Saves 1156B in text size on stripped optimized Linux AMD64 GCC 4.9
builds.

Change-Id: If805e431f570ec1d2ac62c548f516f1b17390c3a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-25 02:21:07 +00:00
Jake Petroules
4e551aeb0e qmake: Fix name of header-only modules when doing simulator builds.
This solves an issue where header only modules in a simulator build with
frameworks on Apple platforms would result in a module like
"QtZlib_iphonesimulator.framework" being created. This patch removes
the "_iphonesimulator" infix from the name.

Change-Id: I60e818042d776cc6ac430413ccea1be1a1a1e48b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-02-25 01:16:52 +00:00
Jake Petroules
c5001b9db3 qmake: Fix unwanted concurrency in simulator_and_device builds.
Change-Id: Ia73fe903e5157fb1262878ede1fb1cc1af1c80f4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-02-25 01:16:48 +00:00
Marc Mutz
8b5651eb41 QtNetwork: don't use Boyer-Moore for single-character needles
Using Boyer-Moore for single-character search strings makes
no sense since there can be no skipping beyond the normal
sequential search anyway.

So, port to QByteArray::indexOf(char).

Change-Id: I848e2ceea5ceafd0ebae402798b410f682348a75
Reviewed-by: Richard J. Moore <rich@kde.org>
2016-02-24 23:29:48 +00:00
BogDan Vatra
3376e67abe Perfect (almost) Qt on Android splash screen.
There is no need to show the splash image immediately when the
application starts, because it will be removed shortly in
QtActivityDelegate.java, therefore show the splash in
QtActivityDelegate.java.
This patch also adds a new option to AndroidManifest.xml which keeps
the splash screen visible until user to decides to hide it,
by using the QtAndroid::hideSplashScreen() function.

Change-Id: I8a29a5a757d626c4c9d6a2748a60ca3091ebf82d
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-02-24 17:19:38 +00:00
Marc Mutz
c05f2985eb QMimeTypeParser: scope a variable better
The variable being a QVector, this means replacing
default construction followed by one move-assignment
per loop iteration with a StartElement state with
RVO-catching a return value.

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

Change-Id: I618d31ad0816f9ad1a89a6b2e39481258f1e0878
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-24 17:14:30 +00:00
Marc Mutz
aca859cbc4 QMimeTypeParser: don't use the heap to create QMimeMagicRules
The function createMagicMatchRule() returned a heap-allocated
QMimeMagicRule, and the caller code did not check the return
value for nullptr, but copied the rule into a container before
deleting the original again.

Fix by returning by-value instead. Every C++ compiler will
use RVO for this. On top, add an optimistic std::move()
when inserting the rule into the container (currently QList,
so no rvalue-push_back, yet).

While touching the return value, also remove an unholy
out-parameter with just local effects by returning a Result
struct instead. The rest of the code remains full of out-
parameters, of course.

Add one Q_UNLIKELY and two qUtf16Printable() as drive-bys.

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

Change-Id: I4374ab41f38502cd5c64ac37d106ca4bc6e00327
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-24 17:14:25 +00:00
Marc Mutz
a4dee8e274 QMimeTypeParser: use QStringBuilder more
Replace QString::arg() with QStringBuilder, use QStringLiteral
where appropriate, and remove it where it isn't (e.g. in
QStringBuilder expressions).

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

Change-Id: I2471c849db79f477677213f9a155053248800590
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-24 17:14:20 +00:00
Marc Mutz
71b106ab43 QMimeTypeParser: use QStringRef more
Keep the return values of QXmlStream*::value() around as QStringRefs
for as long as possible. Avoids conversions to QString, among other
things, for:

- comparison to another string
- conversion to int
- conversion to UTF-8 or Latin-1 byte arrays

Add a pair of Q_UNLIKELY as a drive-by.

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

Change-Id: I17d440a11aeb8675979483f89e66d0a088ccc605
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-24 17:14:15 +00:00
Marc Mutz
215bda50f9 QtGui: replace QStringLiteral with QLatin1String when appending
It makes little sense to use QStringLiteral for strings which are
immediately appended to, or which are appended to other strings,
because no dynamic memory allocation is saved by doing so. But if
the only advantage of QStringLiteral does not apply, all its
disadvantages dominate, to wit: injection of calls to qstring dtor,
non-sharability of data between C strings and QStringLiterals and
among QStringLiterals, and doubled storage requirements.

Fix by replacing QStringLiteral with QLatin1String.

Saves 104B in text size on stripped optimized Linux AMD64 GCC 4.9
builds.

Change-Id: I36b6a9bb1963b69361cc3a3db0971e1db92f0080
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-24 17:14:12 +00:00
Marc Mutz
68a85a03f9 QtWidgets: replace QStringLiteral with QLatin1String when appending
It makes little sense to use QStringLiteral for strings which are
immediately appended to, or which are appended to other strings,
because no dynamic memory allocation is saved by doing so. But if
the only advantage of QStringLiteral does not apply, all its
disadvantages dominate, to wit: injection of calls to qstring dtor,
non-sharability of data between C strings and QStringLiterals and
among QStringLiterals, and doubled storage requirements.

Fix by replacing QStringLiteral with QLatin1String.

Saves 288B in text size on stripped optimized Linux AMD64 GCC 4.9
builds.

Change-Id: Ie632f25883163f57991264b29e8753fe4c4f738e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-24 17:14:07 +00:00
Mark Brand
3ca2eea00d QSqlDriver:sqlStatement: respect generated flags for WHERE too
Change-Id: I90034cd1a8dc0473c36d788c6737493a51641b02
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
2016-02-24 16:38:17 +00:00