Commit Graph

28396 Commits

Author SHA1 Message Date
Anton Kudryavtsev
b75fe73700 QStandardItem: enable NRVO for gcc
Change-Id: I5a5ad039e1df8f040b77ff783a4f0e1213a0f286
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-18 11:41:42 +00:00
Kai Koehne
13c198cedb Doc: Fix snippet to use initializer list
We can expect C++11 now, and using an initializer list
is much shorter.

Change-Id: I6424d24ce7660b342a629e836b94d62c8868a44d
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-07-18 11:12:46 +00:00
Anton Kudryavtsev
337a7e96b6 QStandardItem: use reserve() to optimize memory allocation
Change-Id: I09df41f6beaaeecc818f11a01206e9e4583fd93f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-18 08:17:21 +00:00
Anton Kudryavtsev
e46e112eb1 Optimize string usage
Use QStringBuilder more.
Use QL1S directly, without QString construction.

Change-Id: Iad844391367681fc1013b9725403d009e7c346e6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-15 08:23:04 +00:00
Olivier Goffart
120ba68882 QReadWriteLock fast path for tryLock without timeout
When one tries to lock without a timeout, there is no need to allocate
a QReadWriteLockPrivate as we will not wait on it.

Change-Id: I37c96a7fbc0c66fbdffe372f6089708cb2466fe3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-15 06:33:56 +00:00
Thiago Macieira
a372cf5a80 Enable -WX (warnings are errors) for MSVC 2015
Change-Id: Ib57b52598e2f452985e9fffd1458b565f9bda0f8
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2016-07-15 01:54:06 +00:00
Marc Mutz
5d935dca0c Remove (private) QString::expand(), port to (new) QString::resize(int, QChar)
We cannot really remove the function, since it's called from
inline code (QCharRef::op=(QChar)), but we can schedule it for
removal in Qt 6, and inline it into existing in-tree callers.

Change-Id: I3499f101dcb5ae908726b3673bf3526a04408db6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-14 06:54:16 +00:00
Thiago Macieira
aca0e367be Fix the Q_ATOMIC_xxx_IS_www_NATIVE macros with C++11
When I introduced this code in Qt 5.0, I made INT and POINTER be
SOMETIMES_NATIVE, but then later I made the specific sizes be
ALWAYS_NATIVE. That doesn't make sense.

Instead, use the macros from the C++11 <atomic> header.

Note that the member isXxxxNative() functions should not have been
constexpr. That's a defect I introduced in Qt 5.0.

Task-number: QTBUG-51315
Change-Id: I0c94a5c2846b48c8aea7ffff1436013e8686c153
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-07-13 21:15:30 +00:00
Marc Mutz
5c46d07a7c Optimize QString::insert()
When the insertion position is not beyond end(), call
resize() instead of expand(), which fills the new size
with spaces, which, however would just be overwritten
by the following memmove().

Add some Q_UNLIKELY to indicate that we strongly
expect the resize() case to be the more common.

Change-Id: Iaf3215dd53c2cbd18f2fd8a5f80af8f6844944da
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-13 06:33:07 +00:00
Oliver Wolff
49f9328175 configure.exe: Show error on "-target xp" option
The option was removed in dev but should have been removed in 5.7. In
order not to complicate merges most of the code that was removed in dev
has been kept as is and only the "bare minimum" was removed.

Task-number: QTBUG-54674
Change-Id: I5118fe344de014bdcf008cccfe9eca112896d23a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-12 14:10:38 +00:00
Nico Vertriest
7cfdbe5102 Doc: corrected link to Qt Widgets Examples
qwidget.cpp:498: warning: Can't link to 'Qt Examples'

Change-Id: I5eed4ac4fd5514a1e1ff7130997df8449d5c5e7f
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
2016-07-12 09:09:06 +00:00
Tim Blechmann
8ba3fee610 QWindowsOpenGLTester: fall back to built-in blacklist if buglist file cannot be resolved
if the environment variable is set, but the buglist file cannot be found,
we should fall back to the built-in buglist instead of not using any.

Change-Id: I370a1f21238efd155b46f0e7071734f5d3c6c343
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-07-12 07:33:31 +00:00
Nico Vertriest
4f6c6ef65f Doc: added doc for parameter isMask
Error message: Undocumented parameter 'isMask' in QIcon::setIsMask()

Change-Id: If16d232b6856ff6d5104ac7c32d3b8c0ac4081f9
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2016-07-11 09:10:06 +00:00
Thiago Macieira
a2ff5afffa Correct indentation in qsettings.cpp
Introduced in 9c49d8c411, despite my
pointing out.

Change-Id: Ie585843cfb684bc3b6e3fffd14600c99f7fde591
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
2016-07-11 06:33:26 +00:00
Anton Kudryavtsev
9c49d8c411 QSettings: optimize string usage
Use QStringBuilder and QString::asprintf more.
Use += operator to reserve extra capacity for
possible free following append/prepend/+= call.

Change-Id: Ia534bec28cb96b688a68a5051a855cda1eb5db4b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-09 08:37:10 +00:00
Anton Kudryavtsev
2788fccd29 Use QStringLiteral more judiciously
Replace it with QL1S in QStringBuilder expressions
and in overloaded functions.

Replace patterns 'QString::number() + QStringLiteral'
and 'QStringLiteral + QString::number()' with
QString::asprintf.

Saves some text size.

Change-Id: Ib39b2332264dfc3df04e77f2c101b47a1030cef4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-08 06:43:02 +00:00
Friedemann Kleint
145d8462e3 Windows QPA: Accept foreign windows when checking for wheel receivers
After change 14efcaa392, foreign
windows no longer have a corresponding QWindowsWindow. This should
not block wheel events when checking for blocking modal windows.

Amends change 14efcaa392.

Task-number: QTBUG-54430
Change-Id: I1ac87445844946bafc214024e27da08c4f884d79
Reviewed-by: Tim Blechmann <tim@klingt.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-07-07 16:56:27 +00:00
Anton Kudryavtsev
5dc739ba9b Replace QString::trimmed() with QStringRef::trimmed()
... where it's possible. Reduce allocations.

Change-Id: I023adfd316f94948fe50749f60bf55748dca56e2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-06 18:30:26 +00:00
Anton Kudryavtsev
802c31bdbd QDateTimeEdit: de-duplicate calls and cache results
Change-Id: I32162846f5f412c7563e66015ea371f9a1af7748
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-06 14:18:08 +00:00
Thiago Macieira
b6345a515b QStorageInfo: update the algorithm for ignored filesystems on Unix
Use the criterion that GNU coreutils' df uses: if the total size of the
filesystem is zero, then it's pseudo. After all, if it contains files in
a zero-sized volume, it has to be pseudo; if it contains nothing, then
it's not very useful anyway.

This would have caught most Linux pseudo-fs anyway, but the mount point
check beforehand allows us to skip quite a few statfs() syscalls.

The new algorithm also solves the following cases which had been
mistakenly interpreted:
 * fuse and ZFS (source devices don't usually start with /)
 * pseudo-fs that were mounted from a device starting with /
   (the source device is usually ignored by the OS)

This change is not testable automatically. Manual testing shows it still
reports the same entries it used to on Linux, plus now shows FUSE
(sshfs) mounts.

Task-number: QTBUG-54235
Change-Id: Ib57b52598e2f452985e9fffd1459f06dcefcc5c6
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-06 03:59:50 +00:00
Thiago Macieira
5fcac27359 Remove support for MSVC < 2013 in ANGLE
I'm also removing win32-msvc20xx mkspecs, so this would be dead code.

Change-Id: Ib57b52598e2f452985e9fffd1459e59f142c7a39
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-07-06 03:57:49 +00:00
Alex Trotsenko
cddb344f3e QSslSocket: reset connection parameters on disconnect
Otherwise socketDescriptor(), localPort(), localAddress(), peerPort(),
peerAddress(), and peerName() remain uncleared until close() is called.

This could take place when the connection is closed by the remote
endpoint or the user calls disconnectFromHost(). After disconnecting,
connection parameters are no longer valid, while I/O device is still
opened and may have pending data for reading. Usually, the user reads
all incoming data and closes the device independently.

Change-Id: Ic898851c39137faf64019949910f0d94ebb79df7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-05 19:21:06 +00:00
Timur Pocheptsov
6c935dc74f Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7 2016-07-05 20:51:40 +00:00
Anton Kudryavtsev
b073ba57f8 Widgets: use const (and const APIs) more
For CoW types, prefer const methods to avoid needless detach()ing.

Change-Id: Ia6cad50a10facf6fd4f73d1390edb8642a0aed32
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-05 18:58:51 +00:00
Anton Kudryavtsev
f217894152 QDateTimeEdit: remove homebrew 'reverse' algorithm
Use std::reverse

Change-Id: Ia922f3e05e100587f0e7bc91bb1a95679bc03896
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-05 18:58:39 +00:00
Anton Kudryavtsev
3a33ee78c9 Tools: replace QString::trimmed() with QStringRef::trimmed()
... where it's possible. Reduce allocations.

Change-Id: I9908d9d65177d116a8a54146274a74edb801543e
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-05 18:58:27 +00:00
Anton Kudryavtsev
5392259ce6 QXml: reduce allocations in extractEncodingDecl
Replace QString::left() with QString::leftRef().
Use QStringLiteral more.

Change-Id: Ibcecc666d034a5e1fe963119483030ab397b16b1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-05 18:57:35 +00:00
Friedemann Kleint
e7d4760314 Testlib: Format QRegion in QCOMPARE
Output regions as a compact list of rectangles:
QRegion(2 rectangles, 50x200+100+200, 200x50+10+10)

Change-Id: I62e42bd30897a1d31b28e0cbd6afe7fa8ecf2664
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-05 18:49:19 +00:00
Kevin Funk
6583720aa4 Revert "CMake: Add imported target for qdoc."
This reverts commit dc0ae02ebc.
qdoc is a binary built inside the qttools repository, thus it should be added
to the respective ConfigExtras.cmake.in there instead.

Task-number: QTBUG-54446
Change-Id: I182e5889af164a89c68226a91abc4d9962a508ea
Reviewed-by: Volker Krause <volker.krause@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-05 14:40:29 +00:00
Edward Welbourne
b5695bd5be Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: Ibd81cd1df4a0650d93fcb556a57be90be2e1f569
2016-07-04 15:58:39 +02:00
Ralf Nolden
b7744e0b05 Replace LLINDEX macro not present on all BSDs with the code
FreeBSD < 10 doesn't have the LLINDEX macro either in net/if_dl.h, so besides
OpenBSD yet another condition to declare the LLINDEX macro for systems where
it isn't present does make it more complicated than replacing its usage with
the actual code.

Change-Id: I7e8ef3e265564526e05ec3115f9fa765d399f045
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-03 10:54:42 +00:00
Giuseppe D'Angelo
daade9b90d QEventLoop: better describe the exception safety of Qt
1) In general it's unsafe to let exceptions propagate through Qt code,
so document that.

2) Add a note that overriding notify() makes sense only in Qt 5, in Qt 6
it's going away.

3) The advice applies also to applications not using QApplication, but
just QCoreApplication.

Change-Id: I4f6e74c53da757faf2eeaa9de226ceba55c52536
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
2016-07-02 19:36:10 +00:00
Thiago Macieira
3b5db8f3a6 Examples: Fix stringification of the Qt version
(QT_VERSION % 0xffff00) is useless for now, as QT_VERSION < 0x1000000
(for now). The author of this code probably meant to use bitwise-AND.
But even that is unnecessary as the right shift discards the lower 8
bits anyway.

Change-Id: Ie585843cfb684bc3b6e3fffd145d533b05288dfc
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-07-02 16:38:39 +00:00
Thiago Macieira
946c1a578a Fix build: ftok(3) requires sys/ipc.h
Task-number: QTBUG-54069
Change-Id: Ib57b52598e2f452985e9fffd1457fa9c7ad3bac0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-07-02 16:37:03 +00:00
Thiago Macieira
4f3eb66173 QUrl: Test that we do correctly accept valid schemes
... and reject invalid ones. There was one error: we accepted schemes
starting with pluses, dashes and dots.

Change-Id: Ie585843cfb684bc3b6e3fffd145cfe12227ec4ad
Reviewed-by: David Faure <david.faure@kdab.com>
2016-07-02 16:36:50 +00:00
Thiago Macieira
cf9b445ed4 Fix the naming of an LLVM tool in common/clang.conf
Probably was copied from the gcc equivalent.

Change-Id: I87e17314d8b24ae983b1fffd14535b9d7f616a1b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-07-02 16:35:01 +00:00
Olivier Goffart
9cb8ca2b55 Allow to drag a QDockWidgetGroupWindow into one of its QDockWidget
This fixes the 2. of QTBUG-52108

Change-Id: Id887f470c7822f6b264d6b739e8658d9809f6609
Task-numer: QTBUG-52108
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-07-02 13:07:29 +00:00
Olivier Goffart
27df6cb32d Fix the QMainWindow context menu when there are floating tabs
If QMainWindow::GroupedDragging is enabled and there are QDockWidgetGroupWindow,
we should still show actions for these QDockWidgets in the context menu

Addresses point 4. of QTBUG-52108

Task-number: QTBUG-52108
Change-Id: I11ae401c4fe15e213b0f26e7579634e2062e953c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-07-02 13:07:21 +00:00
Urs Fleisch
3d621af54b xcb: Send also "text/plain" when a "text/uri-list" is dropped.
This will allow dropping of files from Qt applications to applications
like Skype, which only accept "text/plain", but not "text/uri-list" or
"text/x-moz-url".

Task-number: QTBUG-53238
Change-Id: I01bca5c8e20647cedfc9323f542ab07f0cc48658
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2016-07-02 09:03:43 +00:00
David Faure
1af4916e11 QTime: restore Qt3 compatibility in the QDataStream operators
A Qt5 program writing a null QTime() using setVersion(QDataStream::Qt_3_3),
and then a Qt3 program reading that, would lead to a weird QTime,
with isNull=false, isValid=false, hour=1193, minute=2, second=47, ms=295.

This commit restores interoperability, by writing out the expected value
(0) for a null QTime rather than the -1 value used by Qt4 and Qt5.

Change-Id: Icde468a8f6fc9434ef7018296725819b44d672af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-02 08:13:44 +00:00
Thiago Macieira
840729a931 QDateTime: use the more efficient currentMSecsSinceEpoch()
... instead of creating a QDateTime object.

Change-Id: Ib57b52598e2f452985e9fffd145a36911de4fa9a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-02 07:51:11 +00:00
Thiago Macieira
d9b545152d QFormLayout: Remove internal, unused functions
Found by the Intel Compiler 17 Beta on Windows:

qformlayout.cpp(68): error #177: function "<unnamed>::FixedColumnMatrix<T,
NumColumns>::addRow [with T=QFormLayoutItem *, NumColumns=2]" was declared but never referenced

Change-Id: Ib57b52598e2f452985e9fffd1458f6a3c3a609dc
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-07-02 07:51:07 +00:00
Alex Trotsenko
3c93286f08 QDataStream: unify deserialization of containers
Serialization of the Qt container classes is accomplished by breaking
up the data into primitive units. On the receiver side, these units
should be read atomically to guarantee integrity of the container.

Deserialization procedures for QHash and QMap were already implemented
in accordance with this strategy and have the following behavior:

 - a previously latched error status is saved for the caller. This
   overrides possible different errors in the current read. This
   is consistent with the treatment of primitive types.
 - if an error occurs during the deserialization, the container is
   cleared.

To make the API consistent, this patch adjusts the behavior of QList,
QLinkedList, QVector, and QSet deserialization. On the implementation
side we accomplish this with a private StreamStateSaver RAII class that
consolidates the handling of the stream status for all containers.

[ChangeLog][Important Behavior Changes][QtCore][QDataStream] Incomplete
reads of Qt containers are now handled same way as for primitive types,
meaning that previous errors are latched.

Task-number: QTBUG-54022
Change-Id: I5c77257fe2a4637e8a7e6cf3cd43091c8469340e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-01 16:08:41 +00:00
Kai Koehne
9964b850ad Doc: Improve QJsonDocument::fromJson documentation
Be explicit on how to check whether parsing succeeds.

Change-Id: I44f408cb6e5a830826b84dfb3a8af331f03e58cc
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-07-01 14:55:29 +00:00
Andy Shaw
c3f645a24a Windows: Add support for the PdmDevicePixelRatioScaled metric
Change-Id: If65018a86e386a54f40ee12e81b5137e3412d655
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2016-07-01 11:42:52 +00:00
Friedemann Kleint
fbe67f06bc Diaglib: Build DebugProxyStyle only when QtWidgets are used
Change-Id: Iba1ca731ac569db12211a93f65583d73ffcfce91
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2016-07-01 09:25:42 +00:00
Ralf Nolden
cc42979e46 NetBSD: add QMAKE_RPATHDIR for standard QMAKE_LIBDIR
NetBSD is heavily dependent on using rpath, so we need to add the
lib dir QMAKE_LIBDIR and QMAKE_LIBDIR_X11 to QMAKE_RPATHDIR
explicitly to avoid linker errors. See http://www.netbsd.org/docs/elf.html
for more info.

Change-Id: I225143d5e2d9a125060b14e3a8a7953927d63b33
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-01 07:53:07 +00:00
Giuseppe D'Angelo
890edc45d8 QSslSocket: improve documentation of the supported protocols
1) To describe a protocol version we should use an "ordinary" name,
not use the values out of the QSsl::SslProtocol enum.

2) Say that we support the latest stable TLS version (1.2, not 1.0).

3) Fix a statement about which protocol is the default one.

Change-Id: I18732914d55060a0c3920f7082f986c262a71ded
Reviewed-by: André Klitzing <aklitzing@gmail.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
2016-07-01 07:49:24 +00:00
Maurice Kalinowski
1e662ff166 winrt: Set minimum SDK version to 10586
10586 reflects Update 1, which is the mininum supported version for many
months, hence reflext this in the manifest template as well.

There are additional features (like drag and drop) which require and
even later SDK version. However, they do not reflect the minimum.

Change-Id: I6d71dc499c928ed98c8a25283e0b53994317bb00
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-07-01 07:45:07 +00:00
Oswald Buddenhagen
d0055e9fd7 nuke dead expandVariableReferences() overload prototype
Change-Id: I0c6fceac0b984e4613932b8507a632dd83d0e79b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-06-30 15:49:58 +00:00