Commit Graph

913 Commits

Author SHA1 Message Date
Liang Qi
511790fd1a Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	config_help.txt
	configure
	mkspecs/features/uikit/sdk.prf
	src/corelib/global/qhooks.cpp
	src/corelib/io/qfilesystemwatcher.cpp
	src/corelib/io/qlockfile_unix.cpp
	src/corelib/tools/qalgorithms.h
	src/gui/kernel/qwindowsysteminterface.h
	src/gui/text/qtextdocument_p.cpp
	src/network/access/access.pri
	src/network/access/qnetworkaccessmanager.cpp
	src/network/access/qnetworkreplynsurlconnectionimpl.mm
	src/src.pro
	src/testlib/qtestcase.cpp
	src/widgets/kernel/qwidgetbackingstore_p.h
	src/widgets/styles/qwindowscestyle.cpp
	src/widgets/styles/qwindowsmobilestyle.cpp
	tests/auto/corelib/io/qdiriterator/qdiriterator.pro
	tests/auto/corelib/io/qfileinfo/qfileinfo.pro
	tests/auto/gui/kernel/qwindow/BLACKLIST
	tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
	tools/configure/configureapp.cpp

Change-Id: Ibf7fb9c8cf263a810ade82f821345d0725c57c67
2016-06-13 12:46:46 +02:00
Thiago Macieira
0a78d918f0 Replace qAllocMore with a pair of more useful functions
The first is "exact", not "more": qCalculateBlockSize. It ensures that
there's no overflow in multiplying, adding the header size or when
converting back to an int.

The second is the replacement for qAllocMore: it calculates the block
size like the first, but increases the block size to accommodate future
appends. The number of elements that fit in the block is also returned.

Task-number: QTBUG-41230
Change-Id: I52dd43c12685407bb9a6ffff13f5da09f816e667
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-09 15:32:14 +00:00
Marc Mutz
a7ae92e67d QStringRef: add missing relational operators against QByteArray
QStringRef op QByteArray was ambiguous between

  bool QStringRef::operator op(const char*) const
  bool operator op(const QStringRef&, const QString&)

QByteArray op QStringRef was ambiguous between

  bool operator op(const QString&, const QStringRef&)
  bool operator op(const char*, const QStringRef&)

Fix by providing more overloads.

[ChangeLog][QtCore] Disambiguated the relational operators
comparing QByteArray with QStringRef (and vice versa).

Change-Id: I1cfa9ecfdd8b4102e652593faf35f6098289bc34
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-08 21:42:33 +00:00
Marc Mutz
f0d9eed064 QString: fix QChar <> QLatin1String relational operators for non-US-ASCII
The implementation used the QString::compare_helper(QChar*, int, char*, int)
overload, which, however, interprets the rhs as a UTF-8 sequence, not as
Latin-1.

Fix by using the (QChar*, int, QLatin1String) overload.

Extend the test to cover this case, too.

Change-Id: I59b26d63d0caec036b80ef8818c75d0cebe519d2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-08 21:35:54 +00:00
Marc Mutz
0843ce8524 tst_qstringapisymmetry: cover QByteArray, const char*, too
As in 032efc2cb2, which added the
API-symmetry test, define the missing relational operators
locally in the test harness until they are fixed in the library.

Change-Id: Ic2688e6b6b3e028a9c29f1a5eb01058375ef3fe9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-08 15:32:02 +00:00
Giuseppe D'Angelo
982ef5b494 QSharedPointer/QWeakPointer/QScopedPointer: add comparison against nullptr
Some constructors were added, but the comparison operators were missing.
The STL has them, so we ought have them too.

Change-Id: I030c14a3b355988f509716b4b1b1a835b3ab9481
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-06-08 09:09:47 +00:00
Liang Qi
57057f76ad Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	.qmake.conf
	config.tests/unix/nis/nis.cpp
	mkspecs/unsupported/freebsd-g++/qplatformdefs.h
	src/corelib/tools/qdatetime.cpp
	src/corelib/tools/qsimd.cpp
	src/corelib/tools/qsimd_p.h
	src/network/access/access.pri
	src/network/access/qnetworkreplynsurlconnectionimpl.mm
	src/network/access/qnetworkreplynsurlconnectionimpl_p.h
	src/plugins/platforms/cocoa/qnsview.mm
	src/plugins/printsupport/windows/qwindowsprintdevice.cpp
	tests/auto/corelib/kernel/qobject/tst_qobject.cpp
	tests/auto/network/access/qnetworkreply/BLACKLIST
	tests/auto/widgets/widgets/qopenglwidget/BLACKLIST

Change-Id: I4b32055bbf922392ef0264fd403405416fffee57
2016-06-06 09:04:55 +02:00
Lorenz Haas
a7372fd79d Add QLineF::center() returning the point in the center of the line
[ChangeLog][QtCore][QLine/QLineF] Added center().

Change-Id: I6dcfa9e839190c0a4caf36fb6ecd01b37d65d274
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-05-27 08:49:44 +00:00
Thiago Macieira
e9041c7fc1 Fix parsing of tzfile(5) POSIX rule zone names with bracket quotes
POSIX.1-2001 allows quoting a zone name so that it can contain other
characters besides letters, by enclosing it in angle brackets ('<' and
'>'). This hadn't been used until recently (tzdata2016b), when the
Asia/Barnaul rule started using a zone name "+07" (the name variable
contained the value "<+07>-7").

Thanks to Paul Eggert for reporting and investigating the root cause.

Task-number: QTBUG-53071
Change-Id: Id5480807d25e49e78b79ffff1449bc410776cb66
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-24 19:31:40 +00:00
Liang Qi
56d6e000f7 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	mkspecs/wince80colibri-armv7-msvc2012/qmake.conf
	qmake/generators/win32/msvc_vcproj.cpp
	src/corelib/global/qnamespace.h
	src/corelib/global/qnamespace.qdoc
	src/corelib/io/qfsfileengine_win.cpp
	src/corelib/tools/tools.pri
	src/network/ssl/qsslconfiguration_p.h
	src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
	src/plugins/platforms/windows/windows.pri
	src/src.pro
	src/tools/bootstrap/bootstrap.pro
	src/tools/uic/cpp/cppwriteinitialization.cpp
	src/widgets/dialogs/qfilesystemmodel.cpp
	tests/auto/testlib/selftests/expected_cmptest.teamcity
	tests/auto/testlib/selftests/expected_cmptest.txt

Change-Id: I4d2ac78f0dcc97f008186bbbc769c6fe588ab0e5
2016-05-23 21:09:46 +02:00
Tor Arne Vestbø
b88573e29b Collate conversion functions for Core Foundation/Foundation types
Makes it easier to apply similar changes across all related functions,
and to implement functions for new types by having the previous
approaches available in one place.

Change-Id: I3f0590d67d0e6deb1c6c856ab1de96b55b6af058
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-05-19 11:20:36 +00:00
Liang Qi
818014b449 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	configure
	src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
	src/network/access/qnetworkaccessmanager.cpp
	src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
	src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp
	src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h
	src/widgets/widgets/qlineedit_p.cpp
	src/widgets/widgets/qlineedit_p.h
	src/winmain/winmain.pro
	tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
	tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
	tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h
	tests/auto/testlib/selftests/expected_cmptest.teamcity
	tests/auto/testlib/selftests/expected_cmptest.txt
	tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
	tools/configure/configureapp.cpp

Change-Id: Ib9997b0d0f91946e4081d36c0c6b696c5c983b2a
2016-05-19 12:55:27 +02:00
Liang Qi
990969655c Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	config_help.txt
	configure
	src/corelib/io/qprocess_wince.cpp
	src/plugins/platforms/windows/qwindowstheme.cpp
	src/plugins/platforms/xcb/qxcbbackingstore.cpp
	tests/auto/corelib/tools/qtimezone/BLACKLIST
	tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
	tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp

Change-Id: I26644d1cb3b78412c8ff285e2a55bea1bd641c01
2016-05-12 08:33:08 +02:00
Thiago Macieira
e1d0da6526 Fix Clang -Wexpansion-to-defined warning by deprecating QT_SUPPORTS
The C and C++ standards say it's undefined whether the preprocessor
supports macros that expand to defined() will operate as an ifdef.
Clang 3.9 started complaining about that fact.

One solution was to change QT_SUPPORTS to check for zero or one, which
means we need to change the #defines QT_NO_xxx to #define QT_NO_xxx 1.
The C standard says we don't need to #define to 0, as an unknown token
is interpreted as zero. However, that might produce a warning (GCC with
-Wundef), so changing the macro this way is not recommended.

Instead, we deprecate the macro and replace the uses with #ifdef/ndef.

Change-Id: Id75834dab9ed466e94c7ffff1444874d5680b96a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-08 04:25:27 +00:00
Liang Qi
dbef41f43e Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	examples/qtestlib/tutorial5/containers.cpp
	examples/widgets/tools/tools.pro
	src/corelib/io/qprocess.cpp
	src/corelib/io/qprocess_unix.cpp
	src/corelib/io/qprocess_win.cpp
	src/network/kernel/qdnslookup_unix.cpp
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	src/testlib/qtestcase.cpp
	tools/configure/configureapp.cpp

Change-Id: I838ae7f082535a67a4a53aa13a21ba5580758be8
2016-05-06 15:36:44 +02:00
Jędrzej Nowacki
67509693bd Improve tst_qtimeline::setPaused resilience
The test should not depend on qWait explicitly

Change-Id: I13c01c47c9f7bae8b0c30afa2ac8550dc0fbf028
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
2016-05-04 09:26:57 +00:00
Liang Qi
6357813207 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	configure
	src/3rdparty/double-conversion/include/double-conversion/utils.h
	src/corelib/global/qnamespace.qdoc
	src/corelib/tools/qsimd_p.h
	tests/auto/corelib/io/qfile/tst_qfile.cpp

Change-Id: I3ca1007bab5355d251c13002a18e93d81c254d34
2016-05-03 15:49:15 +02:00
Liang Qi
b894a8def5 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	mkspecs/features/qml_module.prf
	mkspecs/features/qt_common.prf
	src/gui/text/qzip.cpp
	src/plugins/platforms/cocoa/qnsview.mm
	src/plugins/platforms/windows/array.h
	src/testlib/qtestcase.cpp
	src/widgets/dialogs/qfilesystemmodel.h

Change-Id: Ie41c5868415b81f7693c80e045497035504bb210
2016-04-29 17:55:20 +02:00
Thiago Macieira
ab2f768a8f Autotest: fix the QTimeZone::tzTest failure when database contains LMT
On some operating systems, tzdata files carry the Local Mean Time (LMT)
for the city in question, which better represents how time was tracked
before standard, hourly timezones were introduced in the early 20th
century. The test was asking for the data for 1653-02-09 and assumed
that it would find the first Central European Time (CET) rule, which
Germany didn't start using until 1893-04-01.

This fix allows us to remove the blacklist that had been applied to this
test without investigation. It wasn't related to OpenSUSE, aside from
the fact that OpenSUSE tzdata carries the LMT data.

Change-Id: Id5480807d25e49e78b79ffff1449bdaf46901367
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2016-04-29 08:23:11 +00:00
Thiago Macieira
e22a230a03 Make QSharedPointer without custom deleters call the correct destructor
Where "correct" is defined by what std::shared_ptr does as well as what
happens when an intermediate QSharedPointer of the exact type of the
constructor behaves

That is,
   QSharedPointer<X> ptr(new Y);

Behaves like
   QSharedPointer<X> ptr;
   { QSharedPointer<Y> tmp(new Y); ptr = tmp; }

Change-Id: Id75834dab9ed466e94c7ffff14455d445f72592b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-04-28 12:58:35 +00:00
Thiago Macieira
6dfc3541e6 Add QLibraryInfo::version() returning the Qt version as QVersionNumber
[ChangeLog][QtCore][QLibraryInfo] Added QLibraryInfo::version(), which
returns the current version of the Qt library as a QVersionNumber
object.

Change-Id: Ifea6e497f11a461db432ffff1448d4dc84ef57b1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-04-27 16:12:55 +00:00
Thiago Macieira
8026dc6f36 Add support for initializing QSharedPointer from nullptr
std::shared_ptr supports it. To resolve an ambiguous overload when a
literal 0 is passed as a parameter, the normal constructors needed to be
made a template, like std::shared_ptr.

Task-number: QTBUG-52569
Change-Id: Id75834dab9ed466e94c7ffff14451417892d2148
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-04-19 04:54:36 +00:00
Liang Qi
b94773c9c8 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	config.tests/unix/compile.test
	src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
	src/testlib/qtestcase.cpp
	src/testlib/qtestcase.qdoc

Change-Id: Ied3c471dbc9a076c8de33d673bd557e88575609d
2016-04-13 06:55:37 +02:00
Liang Qi
f34e73a16a Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	src/corelib/kernel/qobject.cpp
	src/gui/painting/qpaintengine_raster.cpp

Change-Id: I74e1779832f43d033708dcfd6b666c7b4f0111fb
2016-04-11 09:12:36 +02:00
Konstantin Ritt
eb26f2b19b Re-generate QLocale data from CLDR v29
* A bunch of fixes and additions to the locale data
* Add new scripts from Unicode 8.0 and 9.0
* Map some potentially useful languages and territories

[ChangeLog][QtCore] QLocale data updated to CLDR v29

Change-Id: I759ccb27fe19be2722be913c5c2e6aa5f36e5c14
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-08 03:51:18 +00:00
Marc Mutz
6958e189a3 QStringRef: add missing {c,}r{begin,end}()
Most containers have them in Qt 5.7, so add them
to QStringRef, too.

Brush up the docs, use the const_iterator typedef
in the API, for consistency with QString's docs.

[ChangeLog][QtCore][QStringRef] Added reverse iterators,
rbegin(), rend(), crbegin(), crend().

Change-Id: I3d2884a1b2faae02c610ab3871552b65bc6e2521
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-07 11:29:45 +00:00
Marc Mutz
f72152381b tst_QStringBuilder: add a check for self-assignment
Change-Id: I78094146bf534163af12d6e265276d987d5ce994
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-04-07 07:02:38 +00:00
Marc Mutz
e0ea0f6178 QChar: optimize comparison with QString{,Ref}
Instead of relying on the QString relational operators to
implicitly convert the QChar to a QString, add relational
operator overloads that compare the QChar without first
turning it into a QString, saving one memory allocation
per comparison, and allowing to mark the operation as
nothrow.

Consequently, in tst_QStringBinOps, verify now that all
relational operations are noexcept.

The added overloads make QChar ==/!= int comparisons
ambiguous. De-ambiguate by providing a constrained
template that matches int and nothing but int (otherwise,
the QChar and the int versions would compete for a
QChar::SpecialCharacter argument, and end up creating
new ambiguities). This solution may not be perfect, but
it can be easily extended should more ambiguities crop up.
The existing overload deals with all patterns found in
qtbase.

Change-Id: I4156d918e9b9134c1da684b8b69e0ee526ad24e3
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-05 19:47:37 +00:00
Laszlo Agocs
df5159a8a6 Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/dev 2016-04-05 15:24:53 +00:00
Marc Mutz
0683c9291f QChar: add missing relational operators against QLatin1String/QStringRef
For QChar <> QStringRef, equality and inequality were already provided
(via QChar -> QString implicit conversions, to be fixed in a separate
patch). Missing were the less/greater than (or equal) operators.

Added.

For QChar <> QLatin1String, all relational operators were missing.

Added, too.

[ChangeLog][QtCore][QChar] Added missing operator{<,>,<=,>=}
comparing against QLatin1String and QStringRef.

[ChangeLog][QtCore][QChar] Added missing operator{==,!=}
comparing against QLatin1String.

Change-Id: I9941fe7e7281ea560b3bd5970cb9651ffadc1495
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-05 15:23:30 +00:00
Liang Qi
f285687584 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	examples/corelib/ipc/ipc.pro
	src/plugins/platforms/xcb/qxcbbackingstore.cpp
	tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp

Change-Id: Ia006e10ff1732fe78f90138c41f05b59b49486cf
2016-04-05 14:22:45 +02:00
Friedemann Kleint
7fc2864dc5 QtCore: Remove Windows CE.
Remove QSysInfo::WV_CE_5/6 enumeration values, #ifdef sections for Q_OS_WINCE
and wince .pro file clauses in library, examples and tests.

Task-number: QTBUG-51673
Change-Id: Ib63463445f3a26e04d018b193e4655030002f5f9
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-30 11:22:47 +00:00
Eirik Aavitsland
91f8c9cc70 Remove the traces of the discontinued android-no-sdk platform
Cleaning out the workarounds for the discontinued "Embedded Android"
platform of Boot2Qt.

Change-Id: I0ff9d770e82a43457fb7e5da0428f4597ead4038
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-30 10:12:34 +00:00
Olivier Goffart
63274c95a3 Add QCommandLineOption::Flags containing HiddenFromHelp and ShortOptionStyle
This patch adds a new option, QCommandLineOption::ShortOptionStyle, which helps
applications (such as compilers, so moc and now qdoc) which need to mix long-style
and short flags.

[ChangeLog][QtCore][QCommandLineOption] Added flags() and setFlags() methods.
Added ShortOptionStyle and HiddenFromHelp flags.

Change-Id: I944ce56aff2b28ecd6bb9d2d23c4e726e9d06647
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-03-23 01:08:28 +00:00
Liang Qi
a02863234d Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	configure
	mkspecs/common/wince/qplatformdefs.h
	src/plugins/platforms/directfb/qdirectfbbackingstore.cpp
	src/plugins/platforms/xcb/qxcbbackingstore.cpp

Change-Id: Ied4d31264a9afca9514b51a7eb1494c28712793c
2016-03-22 07:28:42 +01:00
Liang Qi
6cb8121a44 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/widgets/styles/qgtkstyle_p.cpp
	tests/auto/corelib/io/qtextstream/test/test.pro
	tests/auto/corelib/plugin/plugin.pro

Change-Id: I512bc1b36acf3933ed2b96c00f476ee3819c1f4b
2016-03-21 09:02:57 +01:00
Rolland Dudemaine
d58596fd61 Remove inclusion of -lm for INTEGRITY.
Math functions are linked in by default on INTEGRITY.

Change-Id: I737ae87c02b2321caca3975f69525731e839d1a7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-18 20:40:59 +00:00
Maurice Kalinowski
e7cd32274e WinRT: Fix QTimeZone transitions by switching backend
Previously WinRT was using the UTC backend which fails on all platforms
for some QDateTime autotests related to timezone items. Hence switch to
the Windows implementation for WinRT as well.

However, the windows backend does query the registry heavily, which is
not supported on WinRT. Instead use the API version provided by the SDK.

Long-term we might want to switch to this version on desktop windows as
well, as direct registry access would not be required and we could
harmonize the codepaths for both platforms.

Change-Id: I620b614e9994aa77b531e5c34c9be1da7e272a30
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-03-16 10:30:26 +00:00
Marc Mutz
8005fa3524 QStringRef: add missing relational operators against QLatin1String/QString
Equality and inequality were already provided. Missing were the
less/greater than (or equal) operators.

Added.

Moved existing functions around and more similar to the new ones,
to make the whole code section a bit more manageable.

[ChangeLog][QtCore][QStringRef] Added missing operator{<,>,<=,>=}
comparing against QLatin1String and QString.

Change-Id: Idb3c4fa9b38421637987226f3cc1b77f5d4a6309
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-16 08:06:54 +00:00
Marc Mutz
e4c6d73f92 QRect: fix UB (int overflow) in center()
QRect::center() should be defined for any
  QRect(x1,y1,x2,x2), INT_MIN <= x1, x2, y1, y2 <= INT_MAX
because the average of two signed integers is always
representable as a signed integer.

But not when it's calculated as (x1+x2)/2, since that
expression overflows when x1 > INT_MAX - x2.

Instead of playing games with Hacker's Delight-style
expressions, or use Google's patented algorithm, which
requires two divisions, take advantage of the fact that
int is not intmax_t and perform the calculation in the
qint64 domain. The cast back to int is always well-
defined since, as mentioned, the result is always
representable in an int.

Fix a test-case that expected a nonsensical result due
to overflow.

[ChangeLog][QtCore][QRect] Fixed integer overflow in
center(). This fixes the result for some corner-cases
like a 1x1 rectangle at (INT_MIN, INT_MIN), for which
the previous implementation could return anything
(due to invoking undefined behavior), but commonly
returned (0, 0).

Change-Id: I1a885ca6dff770327dd31655c3eb473fcfeb8878
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-15 11:23:46 +00:00
Marc Mutz
5784c064a9 tst_QRect: drop a test that depends on int overflow
The compiler can statically check that this is undefined
behavior:

  tst_qrect.cpp:3173:52: warning: integer overflow in expression [-Woverflow]
               << QRect(QPoint(0,0), QPoint(INT_MAX+(0-INT_MIN),INT_MAX+(0-INT_MIN)));
                                                   ~^~
  tst_qrect.cpp:3173:72: warning: integer overflow in expression [-Woverflow]
               << QRect(QPoint(0,0), QPoint(INT_MAX+(0-INT_MIN),INT_MAX+(0-INT_MIN)));
                                                                       ~^~

Fix by skipping the test (like most of the others are
in the block).

Change-Id: I359a5e16db6c660c9f11d7dd8fbb40730bd63887
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-15 10:39:38 +00:00
Marc Mutz
032efc2cb2 Add test for API symmetry of QString/Ref, QLatin1String, QChar
At the moment, only checks the relational operators, where
it already found some which do not compile. In order to
simplify the test, the missing operators are supplied by
the test harness until they are fixed in the library.

Change-Id: Ief5daefa68f15de5f8e559c9378ed83b715b69ee
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-15 08:11:35 +00:00
Liang Qi
24cd4a7190 Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: Ic7aaa06f4a14b1aed61faa1a6e7f527ee0eeb96b
2016-03-01 08:23:55 +01:00
Liang Qi
a224dfc9d1 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	tests/auto/corelib/io/qprocess/tst_qprocess.cpp

Change-Id: Ib6955eb874b516b185b45d6c38cec646fbaa95f4
2016-02-29 12:34:31 +01:00
Marc Mutz
a7885c9756 QVector: preserve capacity in clear()
This is what std::vector implementations usually do,
because it minimizes memory fragmentation and useless
allocations since no user will call clear() unless
she intends to append new data afterwards.

Fix calls to resize(0) that show how existing code
tried to work around the issue.

Adjust test. Port from QVERIFY(==) to QCOMPARE as a
drive-by.

[ChangeLog][QtCore][QVector] clear() now preserves
capacity. To shed capacity, call squeeze() or swap
with a default-constructed QVector object, see the
documentation for an example.

Change-Id: I9cebe611a97e027a89e821e64408a4741b31f1f6
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-29 07:57: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
1da975cdc5 QLatin1String: add at()/op[]/mid()/right()/left()
QLatin1String can be used as a string-view-like type.
When attempting to do so in uic, mid() and at() were
found to be missing. Added the others for completeness.

Use the new functions in uic, for which they were
originally conceived.

[ChangeLog][QtCore][QLatin1String] Added at(),
operator[](), mid(), right(), left().

Change-Id: I4cfe3e9ed1157dedee754b2012d9678fe72b161e
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-19 18:16:38 +00:00
Tony Sarajärvi
837d717b13 Blacklist tzTest in openSUSE 42.1
The test was already blacklisted in openSUSE 13.1 and
was found not to work in 42.1 either.

Task-number: QTBUG-51172
Change-Id: I9f8f7b2251a230596a25183dee04ed37824f8ad7
Reviewed-by: Akseli Salovaara <akseli.salovaara@theqtcompany.com>
2016-02-17 11:28:31 +00:00
Sérgio Martins
6139fbeb5f Introduce QHash::equal_range()
Similar to QMap::equal_range().
Will allow to easily fix inefficient code such as:

    foreach (auto value, hash.values(key)) { ... }

[ChangeLog][QtCore][QHash] Added QHash::equal_range()

Change-Id: I6e19e25de632e897ad83d3141d9d07f0313f7200
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-14 06:43:52 +00:00
Marc Mutz
8ce34c2e81 QRect(F): add transposed()
I didn't add a transpose(), because r = r.transposed() is
perfectly capable of filling that role, and just as
efficient. Existing API mistakes are no excuse to create
more of them.

[ChangeLog][QtCore][QRect/QRectF] Added transposed().

Change-Id: Ic38721e9028496fc9b50f4d4cef2e7a60532eed8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-13 18:18:48 +00:00