Commit Graph

32117 Commits

Author SHA1 Message Date
Marc Mutz
de3785b8bc QVersionNumber: add fromString(QStringView/QLatin1String) overloads
The parsing code anyway operated on a QByteArray created from
toLatin1(), so expose this to the user by providing a QLatin1String
overload.

Also provide a QStringView overload, since we can. Port one user (in
qmake) to the new overload.

[ChangeLog][QtCore][QVersionNumber] Added QStringView and
QLatin1String overloads of fromString().

Change-Id: Idbff44c3997f5cfa86ea1bce8b3da4b700a3d9cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-08 05:40:52 +00:00
Marc Mutz
f5d8ad61a4 qmake: use new QString::arg(QStringView) overload
Add ProString::toQStringView() to avoid creating QStrings just to pass
them to QString::arg() (single-arg; multiArg() does not, yet, accept
QStringViews).

I could have used the existing toQStringRef() function, but QStringRef
is a tad more complex to copy and quite a bit less future-proof.

Change-Id: I344c46f301768e844c487d36ce3e6cb276de8843
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-04-07 18:33:23 +00:00
Marc Mutz
cdbe9d1483 QMakeEvaluator: port a QString::split() to a QStringRef::split() loop
Change-Id: I91a65776124f88a7e2e4778dbe9154b597f52212
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-04-07 18:33:18 +00:00
Jesus Fernandez
18cdf8e90b Adds a list of supported platforms in PI mkspec
Change-Id: I7e67ffc41c7a389750e1ab342a570a1dda8ff077
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-04-07 10:18:51 +00:00
Martin Smith
7e1658f2ec doc: Correct include guard
It should be QCOCOAWINDOWFUNCTIONS_H, not QXCBWINDOWFUNCTIONS_H.

Change-Id: I296e1db28f3727c6aba6de4f02cf26808f72a8a1
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-04-07 10:09:00 +00:00
Gatis Paeglis
f57322f70e xcb: remove x11FilterEvent() code path
This is a legacy code that was there to support
IM plugins using the Qt4's QInputContext::x11FilterEvent.
Updating IM plugins to the new API is a trivial task,
external plugins have had enough time to switch to
the new API QInputContext::filterEvent(). The 'fcitx'
plugin did the required changes in Oct 2014. AFAIK
this was the only remaining plugin that still used
x11FilterEvent.

Change-Id: I7702bcd7017d2d24a1ed07fdebac8b61ca178161
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-04-07 09:25:07 +00:00
Marc Mutz
399ab058c9 Add front()/back() to QString, QStringRef, QByteArray and QLatin1String
These STL-compatibility functions are present on our generic
containers, but not on the string classes.

[ChangeLog][QtCore][QString/QStringRef/QByteArray/QLatin1String] Added
front() and back() for STL compatibility.

Change-Id: I536019396b319abd1e2daf9c64ebab4e7a35b334
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-07 08:32:32 +00:00
Marc Mutz
5dc1e08c8c Add qConvertTo{Utf8,Latin1,Local8Bit,Ucs4}() and corresponding QStringView methods
Like the qt_compare_strings()/qCompareStrings() split, distinguish
between the internal and exported functions.

Because of the circular dependency between qstring.h and qvector.h,
the inline toUcs4() function has to be in qvector.h.

At some point, we need to refactor the headers so qvector.h is lower
in the dependency chain than qstring.h. It's not the first time this
bites.

Change-Id: Ief9f3bd92c83cdd1f31c51c700f42e146916eefd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-07 08:54:16 +00:00
Jesus Fernandez
86005ea257 Replace Q_DECL_OVERRIDE with override in imageformats
Change-Id: I7280cdf674b2a202f9ef7ff2bb9b6732e09a5a76
Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-04-07 08:45:51 +00:00
Liang Qi
191a210478 Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev 2017-04-07 09:38:34 +00:00
Marc Mutz
dea78262e5 tst_QStringApiSymmetry: Add tests for truncate() and chop()
All good.

Change-Id: Id791a04fd5e2c9bc7f54660eaaa95d6db61a5674
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-07 08:34:49 +00:00
Marc Mutz
95db1f6cae Optimize comparisons of QChar with QLatin1String, QString, and QStringRef
Instead of blindly calling the general compare function with a 1-char
string, compare size() and front() to 1 and the QChar, respectively.

Change-Id: I6c83c0772d16294ce6dd7eb058513d717208d6cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-07 08:32:39 +00:00
Marc Mutz
95263dbf7a Add a test for container API symmetry
Akin to the successful tst_QStringApiSymmetry, add such a test for
generic containers, too. Yes, we have tst_collections, but it's a
cut'n'paste mess that makes it hard to systematically perform
cross-class checks for consistency. This new test, still in its
infancy, uses templates and thus ensures that exactly the same checks
are run on all containers.

Starting out with front()/back(), which the string classes were found
to lack, we will build this test up, as we did and continue to do with
the string API one.

Change-Id: I07323340b5612ecc658232b2776d788018010d0d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-07 08:32:24 +00:00
Marc Mutz
5e93361888 Add a test for consistency of hash values between QString{,Ref,View}
Change-Id: I64a169fd6c8e2444bfe67e3ecd5375ea7b6a81ee
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-07 08:30:17 +00:00
Liang Qi
5d6073be27 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	mkspecs/linux-icc/qmake.conf
	mkspecs/macx-icc/qmake.conf
	mkspecs/win32-icc/qmake.conf
	src/gui/painting/qgrayraster.c

Change-Id: Ib08c45ea3215be05f986ecb3e1f4b37d209aa775
2017-04-07 10:24:33 +02:00
David Faure
e5a2c87dc7 xcb_egl: fix clang error due to m_connection now being unused
Change-Id: I00846d26013d31856f049659069852d749d54b8e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2017-04-07 07:27:21 +00:00
Sami Nurmenniemi
bbb67ca32c Fix tst_Collections for gcc/arm
- Alignment test was not compiling or passing on GCC / arm
- Using C++11 alignas() enforces maximum limit for the alignment, which
  at least on GCC / arm is __BIGGEST_ALIGNMENT__ multiplied by 8
- On GCC 6.2.0 / x86_84, maximum alignment accepted by alignas is 128
- On GCC 5.3.0 / arm, maximum alignment accepted by alignas is 64
- This change calculates biggest tested alignment on ARM targets
  and compilers supporting alignas() to the value calculated
  from __BIGGEST_ALIGNMENT__

Task-number: QTBUG-55492
Change-Id: If2b70000ff9cdc5ae8c5a00e39f79efcc6ba1221
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-07 05:54:04 +00:00
Sami Nurmenniemi
5c6d132408 Fix tst_QDirModel for qemu
QTBUG-43818 does not affect only Android, it can be reproduced also
with qemu.

Change-Id: I6364c09b3c7f860b34899e26056ad562b7c338f2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-07 05:53:47 +00:00
Thiago Macieira
97d7d80e73 Disable MSVC warning 4577 in headersclean
This warning is added in MSVC 2015 and is printed when we use noexcept
in modules we turned exceptions off.

Task-number: QTBUG-59645
Change-Id: Id92f4a61915b49ddaee6fffd14ae3b943ccd2bce
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-04-07 01:51:44 +00:00
Marc Mutz
f672bd6316 Extend the check for null and empty QString hashing to QString{Ref,View}
Change-Id: I5c41287991f6dd2eeb3d54699da0f653bfac59be
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-06 22:19:41 +00:00
Samuel Gaist
c608ffc56a Improve pair-like class handling in tests
Currently when doing comparison with pair-like classes the fallback
toString method is called which returns a Q_NULLPTR thus not allowing
proper diagnostic of the values that triggered an error. This patch
adds support for QPair and std::pair to improve the tests output
readability.

[ChangeLog][QtTest][QCOMPARE] Now outputs contents of QPair and
std::pair on failure.

Change-Id: Ib0b4aad7640590d56275b6f1306fb9fb39fa81bc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-06 21:46:32 +00:00
Sami Nurmenniemi
0624085b73 Don't set margin on offscreen window if it has a parent
Offscreen platform had window frame margins set to 2 by default unless
Qt::FramelessWindowHint had been set. Margins must not be set to 2 if
the window has a parent. This change fixes two tests in
tst_QWindowContainer for offscreen platform.

Change-Id: Ib1577c301ea3a3b240bfa7c46ff12510dd2bcef0
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-04-06 13:29:01 +00:00
Liang Qi
c50f6a8329 Merge "Merge remote-tracking branch 'origin/5.8' into 5.9" into refs/staging/5.9 2017-04-06 14:35:54 +00:00
Sami Nurmenniemi
60f6e4428f Fix tst_QFile for qemu
Qemu does not report /proc/self/maps size correctly. Added expected
failure for it

Change-Id: I4019884702b8f9a33717b02e79c9e0c042b2449f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-06 12:19:55 +00:00
Sami Nurmenniemi
42b3ed763f Fix network tests on qemu/arm
Function if_indextoname fails on qemu because SIOCGIFNAME is not
supported. Expect failure if emulation is detected.

Change-Id: I53b41286d82458661e7fa723af385f323582ce7e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-06 12:19:46 +00:00
Liang Qi
0fc569184c Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
	src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
	src/platformsupport/fontdatabases/freetype/qfreetypefontdatabase.cpp
	src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
	src/widgets/widgets/qtabbar.cpp

Change-Id: Iaa9daee5f7a6490d56257a3824730a35751ceb05
2017-04-06 14:16:31 +02:00
Marc Mutz
6f41600422 Port internal class QXmlUtils to QStringView
... and adapt callers.

In one case, port a use of QString::toLatin1() to QStringRef::
toLatin1() so together with this change and the addition of
QString::arg(QStringView) we can drop one more QStringRef::toString().

Change-Id: Iba898af8cc2a9e1a811e271789359395f595ad32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-06 12:06:26 +00:00
Marc Mutz
e1e6506c8d QString: add QStringView/QLatin1String overload of (non-multi) arg()
Use the new overload directly in QXmlStream*.

Saves 129B in QtCore text size on optimized GCC 6.1 Linux AMD64
builds, even though we added two more functions.

[ChangeLog][QtCore][QString] Added arg(QStringView),
arg(QLatin1String) overloads.

Change-Id: Idf7236dcab763824593f34182e4e0b16b5ed4321
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-06 12:06:18 +00:00
Marc Mutz
0a5b610679 QText{En,De}coder: mark ctors explicit
C++11 allows these to be called implicitly.

Change-Id: Ife62ce4df4c294623e84fb0c0751ae9b4f6d1020
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-06 12:05:56 +00:00
Marc Mutz
c928d08267 QTextCodec: add QStringView overloads
[ChangeLog][QtCore][QTextCodec] Added fromUnicode()
and canEncode() overloads taking QStringView.
[ChangeLog][QtCore][QTextEncoder] Added fromUnicode()
overload taking QStringView.

Change-Id: I2599f25570480d967921ccd4414e092bfc90d821
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-06 12:05:33 +00:00
Marc Mutz
edb29be8ba QStringView: fix ambiguity between f(QString)/f(QStringView) with QString::null args
... by removing the QStringView(QString::Null) ctor.

This means that QStringView(QString::null) will now fail to compile.
That's ok, since we've deprecated QString::null in the last Qt version.

This will also help pulling up the QStringView definition to before
the QString one in qstring.h, something that we'll require for properly
adding QStringView-append/prepend/insert to QString.

Change-Id: I3c836732be1e185111b13950be9d8dcd935734ff
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-06 12:05:26 +00:00
Rainer Keller
4387202f31 eglfs: Show error details when JSON parsing failed
Change-Id: I1a92da5b2ed0b8064efa37c43d7894c212073b60
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-04-06 08:47:03 +00:00
Robin Burchell
727da2965c qmltestcase: Allow a QML-only testcase to not require a C++ harness
[ChangeLog][qmake] If you use CONFIG+=qmltestcase with no SOURCES, 'make check'
will now run qmltestrunner for you.

Change-Id: Ie9dfaef75494c9b38f6c9a6239754858535d8657
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-04-06 08:40:17 +00:00
Kai Koehne
65a551816f Replace last occurrences of LGPL3, LGPL3-COMM headers
Change-Id: I0e967120d7bdfa00f110b49e6c65d8c6f9b329aa
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2017-04-06 08:13:54 +00:00
Thiago Macieira
280e321e52 Fix detection of F16C for the Intel compiler (again) and Visual Studio
Neither the Intel compiler nor Visual C++ have a dedicated switch to
enable F16C support, like GCC and Clang do. So we used the AVX switch
for that in commit 8241d51f70, as it was
the closest, lowest denominator. That was incorrect and insufficient.

The Intel compiler silently miscompiles the intrinsics with -xAVX,
making calls to out-of-line functions like _mm_cvtps_ph, which don't
exist. So we actually have to use AVX2 support to generate correct code.
That might be a problem later, since Ivy Bridge supports F16C but not
AVX2.

Visual C++ is able to generate F16C code with just -arch:AVX.

Either way, since there's no dedicated command-line switch, there's also
no dedicated preprocessor macro. We're using __AVX2__ for both
compilers, as that's a sufficient condition to indicate a processor that
supports F16C.

Change-Id: I27b55fdf514247549455fffd14b205b8d8b86da7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-04-06 04:15:07 +00:00
Thiago Macieira
c817b33b45 f16c: Use the packed intrinsics instead of scalar ones
MSVC, Apple's Clang and Clang prior to 3.9 do not recognize _cvtss_sh
and _cvtsh_ss. So expand the operation to use directly the packed
intrinsics.

Change-Id: I27b55fdf514247549455fffd14b2046fd638593d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-04-06 04:15:04 +00:00
Thiago Macieira
264d814773 Fix GCC warning about dereferencing type-punned pointers
GCC is wrong. Type-punning is when you read something of a given
type as something else. We're not doing that, as it's only read
as integer.

 qnativesocketengine_unix.cpp:1011:79: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]

Too bad my plan for a good C++ solution was foiled by glibc
developers.

Change-Id: I27b55fdf514247549455fffd14b1a27667745e94
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-06 04:14:58 +00:00
Thiago Macieira
b3f474d620 QSysInfo: update the ICC warning that needs to be suppressed
qsysinfo.h(235): error #1786: enum "QSysInfo::MacVersion" (declared at line 156) was declared deprecated ("Use QOperatingSystemVersion")

Take this opportunity to merge the two groups.

Change-Id: I27b55fdf514247549455fffd14b1c2a1d8eab869
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-04-06 04:14:55 +00:00
Thiago Macieira
71649e2168 Fix build when SCTP is enabled
c0157a9f03 was incomplete.

Change-Id: I27b55fdf514247549455fffd14b158f54403663d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-06 04:14:41 +00:00
Marc Mutz
be49235266 QStringView: use qssize_t as size_type
Nothing changes, we've just given 'QIntegerForSizeof<size_t>::Signed'
a better name in qglobal.h and now use it in QStringView API and
users.

Change-Id: Ibea1ae26e95b3a96708400fd4b0cd120459d57b6
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-04-06 02:38:25 +00:00
Gabriel de Dietrich
7d5e516e67 Remove unused function qt_mac_secure_keyboard
This function was also relying on Carbon APIs.

Change-Id: I87bc942800f5f3dc4ab69cad80f3cbf06d1ad4e2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-04-05 17:25:17 +00:00
Benjamin Terrier
ea4c4691f7 Remove superfluous handle assignment in QLocalSocket::connectToServer()
The handle is already assigned by QLocalSocket::setSocketDescriptor().

Change-Id: I695cfa31f3d14a3a9eef2fb79d23e9651616e8a8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-04-05 16:54:44 +00:00
David Faure
411398aab4 QTextLayout optimization: avoid calling [] when at() will do
The 'lines' and 'items' containers are both declared mutable, so
[] detaches even in const functions.

Change-Id: I29ac74302af2fab390b3cf3f9d05ea2cace6840b
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-05 12:48:51 +00:00
Martin Smith
4a67066f14 doc: Prevent overwrite of qbytearray.html
A use of Q_GLOBAL_STATIC() tricked clangqdoc into
thinking it created something called QByteArray that
should be documented, so the html generator tried to
overwrite qbytearray.html which had already been
created for the real QByteArray. This probably means
there is a bug in the clang visitor class, but I can't
see it, and this change eliminates 4 qdoc errors.

Change-Id: Iee333217212ce60727cd9424a19b8e96a20547b4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-05 12:14:47 +00:00
Richard Moe Gustavsen
b99ec4b4ec Docs: add platform notes to QSystemTrayIcon
On macOS, DoubleClick will work if there is no context menu set.
Otherwise, the context menu will open on the first mouse
press, and then steal focus (which is native behavior).
This means that we never get a callback from the OS for
the second click.

Since it sounds strange to attach a context menu, and at the
same time, listen for double click, we choose here to follow
native behavior and open the menu straight away.

Task-number: QTBUG-5770
Change-Id: I14e08bb8ccd330eecc98e332d54ce4e551cd78fb
Reviewed-by: Jeremy Whiting <jpwhiting@kde.org>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-04-05 11:59:58 +00:00
Tor Arne Vestbø
fb38db29e1 Consider ENXIO (No such device or address) reason to check isatty()
Aligns with EPERM (Operation not permitted) and ENOENT (No such file
or directory), and is what errno is set to on macOS when opening the
/dev/tty device when running inside e.g. Xcode, where isatty() will
return true.

Change-Id: I09b88eaa3ff611d95ab37f0ff4df9aaaca52747d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-05 11:51:15 +00:00
Marc Mutz
84b114e4f3 QVulkan{Layer,Extension}: various fixes
- don't export simple structs
- make op== non-member
- add op!= (required by EqualityComparable)
- add qHash() (should be defined by Qt for every EqualityComparable class)
- add Q_DECLARE_TYPEINFO

Change-Id: Ia14ac3fea48a6a0ad1d8993c9408afe77bbe6c1a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-04-05 11:49:20 +00:00
Allan Sandfeld Jensen
efb84b6189 Copy stretch to multifont fontDef
If we do not the fontDef of the multifont will be the default 0.

Task-number: QTBUG-59443
Change-Id: Ib223517975b2a57b2371e309d12cd8f918d30825
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-04-05 11:27:15 +00:00
Friedemann Kleint
fdd32329ab Documentation: Add Vulkan section to Qt Gui overview
Add section, external references and link examples.

Task-number: QTBUG-55981
Change-Id: I705f8bacc9d21aff8446ac40b7a172604a18ef85
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-04-05 11:06:20 +00:00
Tony Sarajärvi
63ef26d583 Extend blacklisting of a tst_QMenuBar's test to cover Ubuntu 16.04
tst_QMenuBar::taskQTBUG4965_escapeEaten() already failed on
Ubuntu 14.04 and reproduces in 16.04.

Task-number: QTBUG-24326
Change-Id: I46170c9ce397f4042b308ca485b19364e6ee0663
Reviewed-by: Liang Qi <liang.qi@qt.io>
2017-04-05 10:31:00 +00:00