Commit Graph

3266 Commits

Author SHA1 Message Date
Qt Forward Merge Bot
b949c44783 Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I9c90d71fde002544fd97df7e8a2690953cf9f817
2018-02-21 09:41:47 +01:00
Liang Qi
48577b2e7f Merge remote-tracking branch 'origin/5.10.1' into 5.11
Conflicts:
	src/plugins/sqldrivers/psql/qsql_psql.cpp

Change-Id: I070b455078b41e75c46562fcea5676d6218cd00c
2018-02-19 16:02:52 +01:00
Andre Hartmann
ee55b37070 QByteArray: Add functions isUpper() and isLower() for Latin1 byte arrays
[ChangeLog][QtCore][QByteArray] Added QByteArray::isUpper() and
QByteArray::isLower() to check if a byte array contains only uppercase
or only lowercase Latin1 letters.

Change-Id: I7ab3c775bc714138d4be259ac6fa2cfc70467ed4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-02-17 12:23:24 +00:00
Liang Qi
942ab49072 Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	src/corelib/tools/tools.pri

Change-Id: I705630f9cecbf0ce51a22fc6116b8c49611259e9
2018-02-16 08:54:58 +01:00
Alexander Shevchenko
c7c20ce5e2 qmetatype: add '-bigobj' flag to Windows ICC builds
Fix 'Too many segments for object format' errors for (Debug) builds
using Windows ICC.

Change-Id: Ie48f43199948477c426d0a4e557f039eda129b22
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-02-15 22:02:27 +00:00
Alexander Shevchenko
e8531501a7 qsettings: add Advapi32 lib to Windows ICC builds
Fix 'unresolved external symbol __imp_Reg*' errors for builds
using Windows ICC.

Change-Id: I99cb6d53c45cadb31b5675182753f168a7bf4ea3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-02-15 22:02:24 +00:00
Liang Qi
bb0fec8057 Merge remote-tracking branch 'origin/5.10' into 5.11
Conflicts:
	src/corelib/corelib.pro
	src/corelib/global/qrandom.cpp
	src/network/access/qhttpnetworkrequest_p.h
	src/plugins/platforms/cocoa/qcocoamenu.mm
	src/plugins/platforms/cocoa/qcocoansmenu.mm
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/plugins/platforms/cocoa/qnsview.mm
	src/plugins/platforms/offscreen/qoffscreenintegration.h
	src/widgets/kernel/qaction.cpp
	src/widgets/widgets.pro

Done-with: Andy Shaw <andy.shaw@qt.io>
Change-Id: Ib01547cf4184023f19858ccf0ce7fb824fed2a8d
2018-02-15 10:14:11 +01:00
Liang Qi
7bc1d6effa Merge "Merge remote-tracking branch 'origin/5.9' into 5.11" into refs/staging/5.11 2018-02-14 15:49:08 +00:00
Liang Qi
305dd1b61f Merge remote-tracking branch 'origin/5.9' into 5.11
Conflicts:
	.qmake.conf
	src/corelib/animation/qvariantanimation.cpp
	src/corelib/global/qglobal.cpp
	src/corelib/global/qlogging.cpp
	src/corelib/io/qprocess_win.cpp
	src/corelib/json/qjsonarray.cpp
	src/corelib/tools/qsimd_p.h
	src/corelib/tools/qtimezoneprivate_p.h
	src/corelib/xml/qxmlstream_p.h
	src/gui/kernel/qsimpledrag.cpp
	src/gui/kernel/qsimpledrag_p.h
	src/plugins/generic/generic.pro
	src/plugins/platforms/cocoa/qcocoamenu.mm
	src/widgets/styles/qmacstyle_mac.mm
	tests/auto/concurrent/qtconcurrentmap/BLACKLIST
	tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
	tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
	tests/auto/gui/kernel/qwindow/BLACKLIST
	tests/auto/widgets/dialogs/qmessagebox/BLACKLIST

Change-Id: I508d686cf20f7f8cc6a7119b9bc7c3bbb505c58e
2018-02-14 12:51:24 +01:00
Kari Oikarinen
a37dd93def Fix crash in tst_QStateMachine::dontProcessSlotsWhenMachineIsNotRunning
The test sometimes ended up with:

  QThread: Destroyed while thread is still running
  Received a fatal error.

This was because as a member variable of the local struct the QThread object was
sometimes destructed before the signal connection quitting it was handled. Fix
that by making sure that the thread is finished before finishing the test.

Also moved connecting to the state machine's signal to be before starting the
machine. Because the counting of QStateMachine::finished signal could hit 1
after the first signal is emitted and the test could pass without the code
working, check that both of the signals have been emitted.

Task-number: QTBUG-66372
Task-number: QTBUG-66216
Change-Id: If14141e39f37541032ddd8c6471daf40a77b0469
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-02-14 08:12:20 +00:00
Qt Forward Merge Bot
9c055e8e47 Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: Iaec2e57d6bf33355ddfa61d25133580a8740335f
2018-02-13 22:56:03 +01:00
Christian Ehrlicher
92fc338de0 qtbase: cleanup BLACKLIST files
Cleanup BLACKLIST files which contain entries for CI-systems
which are no longer active:
 - opensuse-13.1
 - opensuse-42.1
 - osx-10.8
 - osx-10.9
 - osx-10.10
 - rhel-7.1
 - rhel-7.2
 - rhel-7.3
 - ubuntu-14.04
 - windows msvc-2010

Change-Id: I25590b0807a4454f9dc92aa4ea61300f7c9af56b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-02-13 15:20:33 +00:00
Christian Ehrlicher
b2b32682a9 qtbase: Remove BLACKLIST files which are no longer active
Remove BLACKLIST files which are no longer valid because the mentioned
CI systems are no longer active:
 - opensuse-13.1
 - opensuse-42.1
 - rhel-7.1
 - rhel-7.2
 - rhel-7.3
 - ubuntu-14.04
or the testcases are no longer available:
 - QTBUG_14292_filesystem in qactiongroup

Change-Id: I80a4397059fafba169096440fdc07d45c76a1ed8
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-02-12 17:40:12 +00:00
Liang Qi
3d31afe1e4 Merge "Merge remote-tracking branch 'origin/5.11' into dev" into refs/staging/dev 2018-02-12 11:15:20 +00:00
Kari Oikarinen
38b6ac6544 Skip tst_QFile::largeUncFileSupport
If more than one VM tries to run the test at the same time, it times out. These
sharing violations were attempted to be worked around in 1c3dc8cfb, but the
workaround just leads to timeout, not success.

Task-number: QTQAINFRA-1727
Task-number: QTBUG-66216
Change-Id: If8bfd60dbb6575843680971d45b1c82e5beff534
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
2018-02-12 10:26:00 +00:00
Andre Hartmann
bcd6de15ac QString: Add functions isUpper and isLower
[ChangeLog][QtCore][QString] Added the functions QString::isUpper
and QString::isLower to check if a string contains only uppercase
or only lowercase letters.

Change-Id: I12d3a47d4605eb4514842071e80a9ba0723d4e01
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-02-11 13:06:43 +00:00
Liang Qi
32b506d1db Merge remote-tracking branch 'origin/dev' into 5.11
Conflicts:
	src/corelib/tools/qvarlengtharray.qdoc
	src/corelib/tools/qvector.qdoc

Resolved documentation changes in favor of 017569f702,
which keeps the move overloads along with its const-ref sibling.

Change-Id: I0835b0b3211a418e5e50defc4cf315f0964fab79
2018-02-10 15:55:52 +01:00
Friedemann Kleint
b624cdac21 tst_QSharedPointer: Fix termination of external processes on Windows
Timeouts with subsequent failures to delete the temporary
directories have been observed in COIN.

Previously, QProcess:terminate() was used to end the processes,
which does not have any effect on console processes on Windows.
Add a helper function which resorts to kill() on failure
to terminate().

Change-Id: I05539d1703280d34b392f2e8ff8565b9a04d703c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-02-08 19:56:03 +00:00
Thiago Macieira
64a3bba7b8 QVariant: convert QDateTime and QTime to string with milliseconds
This way, it's lossless.

This commit is a cherry-pick of ab1e507574,
which was reverted.

[ChangeLog][QtCore][QVariant] Conversions of QDateTime to strings now
contain the millisecond components.

Change-Id: I5e421e32396d44e4b39efffd150b744e40fff3a1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2018-02-05 18:48:59 +00:00
Thiago Macieira
ea6675374f QString: fix comparisons to null strings in ucstricmp
Commit 8f52ad9fe0 ("ucstricmp: compare
null and empty strings equal") made sure empties and nulls would compare
equally, but may have broken the null vs non-empty comparison (which was
not tested). The commit message also said that it expected all callers
to handle null before calling into those functions, but that's not the
case for QStringView created from a null QString: the incoming "a"
pointer was null.

So just remove the checks for null pointers and rely on the size checks
doing the right thing.

[ChangeLog][QtCore][QString] Fixed a regression from 5.9 that caused
comparing default-constructed QStrings to be sorted after non-empty
strings.

Task-number: QTBUG-65939
Change-Id: I56b444f9d6274221a3b7fffd150c83ad46c599b6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-02-04 17:24:59 +00:00
Thiago Macieira
687dc7fac7 QUuid: add a way to get the string form without the braces
While we're at it, add a way to get it without the dashes too. I'm
calling it "id128", as in "128-bit ID", as seen in journald's sd_id128_t
type and the sd_id128_xxx() API.

[ChangeLog][QtCore][QUuid] Added a parameter to both toString() and
toByteArray() to allow controlling the use or not of the braces and
dashes in the string form.

Change-Id: I56b444f9d6274221a3b7fffd150cde706cfc5098
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2018-02-03 21:30:37 +00:00
Anton Kudryavtsev
0c0ee82bff QString:: add remove() overload taking QLatin1String
[ChangeLog][QtCore][QString] Added remove() overload taking QLatin1String

Change-Id: I11ddb8b8603144effe44f89d0d02e131a255122c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-02-02 14:49:15 +00:00
Liang Qi
f115ae7001 Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp

Change-Id: Ia28ea4f29d308ba3aa16c2a86ffc57049c6ea590
2018-02-02 11:57:48 +01:00
Thiago Macieira
69d2501ee1 Revert "QVariant: convert QDateTime and QTime to string with milliseconds"
This reverts commit ab1e507574. That was
supposed to be a minor behavior change, but ends up having visible
effects such as QtXmlPatterns xs:dateTime type now reporting sub-second
fractions. So we're reverting in 5.10 and re-applying in 5.11.

Change-Id: I741e49459c9a688c1c329d6cbd521cd4a0b2aa84
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-02-01 16:09:34 +00:00
Edward Welbourne
b44df9937e Clean-up in QDateTime's parsing of ISODate{,WithMs}
Actually check that there's a T where ISO 8601 wants it (instead of
just skipping over whatever's there), with something after it; move
some declarations later; add some comments; and use the QStringRef API
more cleanly (so that it's easier to see what's going on).  Simplify a
loop condition to avoid the need for a post-loop fix-up.

This incidentally prevents an assertion failure (which brought the
mess to my attention) parsing a short string as an ISO date-time; if
there's a T with nothing after it, we won't try to read at index -1 in
the following text.  (The actual fail seen had a Z where the T should
have been, with nothing after it.)

Add tests for invalid ISOdate cases that triggered the assertion.

Task-number: QTBUG-66076
Change-Id: Ided9adf62a56d98f144bdf91b40f918e22bd82cd
Reviewed-by: Israel Lins Albuquerque <israelins85@yahoo.com.br>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a9c111ed8c)
2018-02-01 15:57:23 +00:00
David Faure
2b7de16fbe QMimeType: remove unwanted *.bin as preferredSuffix for octet-stream
This leads to an automatically appended .bin when saving a file.

https://bugs.freedesktop.org/show_bug.cgi?id=101667
https://bugs.kde.org/382437

Fixed upstream in shared-mime-info 1.10

Change-Id: I125a0bc72c91a082706bf2bf149adcf63ff1ec6b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-01-28 19:13:28 +00:00
Thiago Macieira
a6b697ca13 Create corelib/serialization and move existing file formats into it
This is in preparation to adding CBOR support. We don't need yet another
dir for CBOR and placing it in src/corelib/json is just wrong.

Change-Id: I9741f017961b410c910dfffd14ffb9d870340fa6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-01-26 20:59:50 +00:00
Christian Ehrlicher
6578946245 QListWidgetItem/QStandardItem: pass role to dataChanged() signal
QAbstractItemModel::dataChanged() gained an optional role parameter
with Qt5 which was not filled within QListWidgetItem/QStandardItem
setData() functions

Task-number: QTBUG-55903
Task-number: QTBUG-63766
Change-Id: I4da9346ef8401cc8633dc4b2ea7d00451d1e3942
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2018-01-26 19:58:26 +00:00
Oliver Wolff
dcfb6f9d18 tst_qvarlengtharray: Add missing include
The include is needed for std::unique_ptr on winrt.

Change-Id: I72a28bd0951cc947ac65877ccc35f464c757c444
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2018-01-26 06:55:15 +00:00
Joerg Bornemann
6dbf357609 Fix asserts and crashes in QWinEventNotifier activation loop
The backwards iteration was done under the assumption that the only
valid modification of the winEventNotifierList in a slot connected to
activated() would be the removal of the notifier itself. This is wrong.

Instead, iterate forwards, like before 85403d0a, and check the index
against the current list size in every iteration. This ensures that we
do not run out of bounds while the list is modified.

Also, retry the activation loop if the list was modified by a slot
connected to activated(). This ensures that all notifiers with signaled
handles are activated.

Task-number: QTBUG-65940
Change-Id: I25f305463b9234f391abc51fe0628d02f49b6931
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-01-26 06:14:01 +00:00
Thiago Macieira
ab1e507574 QVariant: convert QDateTime and QTime to string with milliseconds
This way, it's lossless.

Change-Id: I5e421e32396d44e4b39efffd150b744e40fff3a1
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-01-25 22:40:40 +00:00
Joerg Bornemann
91732818e5 Remove dead code from tst_qwineventnotifier.cpp
The idx member of EventWithNotifier is unused.

Change-Id: I0f5aacaaad4b4e82c57ff7bb020586944014f139
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-01-25 13:37:15 +00:00
Allan Sandfeld Jensen
5927acaf65 Add support for converting from std::variant
Adds inline handling of the C++17 type std::variant, so the type will
be resolved if converted into a QVariant.

Change-Id: I31809d70d7f347277389d42a3695836ec7a32d02
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-01-25 11:21:32 +00:00
Thiago Macieira
43c44d05ca Update the overflow functions to include qsizetype
Commit 29bc68cf16 added support for
unsigned and commit 5ff7a3d96e later added
support for int. This commit adds support for qsizetype, which isn't int
on 64-bit platforms.

We do this by reorganizing the code and using the generic version of
__builtin_{add,sub,mul}_overflow from GCC 5 and Clang 3.8, which ICC 18
seems to support now too on Linux. That leaves older versions of GCC and
Clang, as well as MSVC, ICC on Windows, and the GHS compiler, to use the
generic implementations, as I've removed the assembly code those
versions of GCC and Clang on x86 are now uncommon.

Note: any older version of ICC probably breaks. We only support the
latest.

Change-Id: I9e2892cb6c374e93bcb7fffd14fc11bcd5f067a7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-01-24 21:13:20 +00:00
Liang Qi
c97eb3e18e Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/corelib/global/qglobal.cpp
	src/corelib/global/qrandom.cpp
	tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp

Change-Id: Icc10543a1f2db5d640d01796bfec70a63517a6b2
2018-01-24 13:38:25 +01:00
Liang Qi
65a97fccc6 Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp

Change-Id: If089d5010d15c33b3c1f13912d4386207456c1a9
2018-01-20 22:36:19 +01:00
Otto Ryynänen
6d50f746fe Support for Q_OS_ANDROID_EMBEDDED and android-embedded build flags
The Embedded Android build (Boot to Qt Android injection) is defined by
having both Q_OS_ANDROID and Q_OS_ANDROID_EMBEDDED flags defined,
as well as having Qt config android-embedded.
This commit enables the possibility to build embedded Android builds.
(i.e. Qt build for Android baselayer only, without JNI)

Change-Id: I8406e959fdf1c8d9efebbbe53f1a391fa25f336a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2018-01-20 18:16:59 +00:00
Allan Sandfeld Jensen
dd58ddd5d9 Add rvalue overload of insert/prepend to QVarLengthArray and QVector
Improves performance and STL compatibility by adding rvalue versions
of prepend and insert.

[ChangeLog][QtCore][QVarLengthArray] Added rvalue overloads of
prepend and insert.

[ChangeLog][QtCore][QVector] Added rvalue overloads of prepend
and insert.

[ChangeLog][QtCore][QVarLengthArray] Can now contain movable but
non-copyable types, such as std::unique_ptr.

Change-Id: I6c946acc5b67502c91c52ac5dea67cedb1af93a5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-01-20 09:27:14 +00:00
Edward Welbourne
4cce7dc19d Test Russia's post-DST transitions are reported correctly
This is a regression test for bugs resulting from failure to take
account of the MS TZ APIs fake-DST handling of standard-time
transitions happening during DST.  Has to skip the 2014 test on Win7,
as it's so old it doesn't know about the (for it) "future" transition.

Task-number: QTBUG-42021
Change-Id: I853b86d03a86f0269371bf1622bf63882fb8ee5d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-01-19 13:57:38 +00:00
d3fault
1a4cc8d57b Add QIODevice::NewOnly and QIODevice::ExistingOnly OpenMode flags
When QFile::open is called with the NewOnly flag, the call will
fail if the file already exists. As usual, if the file does not exist,
it will be created. Like QTemporaryFile, there is a guarantee from
the operating system that you are not accidentally creating a new file
on top of an older file. When QFile::open is called with the
ExistingOnly flag, the call will fail if the file does not exist. The
ExistingOnly flag only provides new functionality when used with the
WriteOnly flag. For ReadOnly it provides no change in functionality,
as ReadOnly by itself already never creates.

Task-number: QTBUG-52244
Change-Id: I8e3206728f245f95172c225bf297023fb078fc6d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-01-17 04:32:47 +00:00
Olivier Goffart
66e56762e1 Test for leaks in QMetaObject::invoke with functors
Task-number: QTBUG-65462
Change-Id: Ifa9735f5610a6df3ceabd286a0321e87bbd05ca3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-01-14 22:36:27 +00:00
Andre Somers
abbd26f553 Add QModelIndex::siblingAtColumn and ::siblingAtRow
Data in item models is most often organized in rows, where each column
contains an attribute of the item represented by the row. Often when
sibling is used, it is to request another piece of data from the same
row. Having a specialized version makes this easier and less awkward
to do, simplifying

auto sibling = index.sibling(index.row(), columnOfInterest);

to

auto sibling = index.siblingAtColumn(columnOfInterest);

For symmetry reasons, siblingAtRow(rowOfInterest) was also added.

Change-Id: Ib203b2cdb16154cbb2680d16fb5c6a7538f33d07
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2018-01-12 15:12:53 +00:00
Edward Welbourne
f4436276d9 Skip a date-time test when we don't know what result it should give
The operator_eqeq(data13) test expected the local-time epoch and UTC
epoch to agree precisely if the localTimeType set by the test's
constructor says local time is UTC; however, when the local zone is
*sometimes* ahead of (or behind) UTC, due to DST, localTimeType is
duly set to indicate that, which doesn't preclude the zone agreeing
with UTC at the epoch.  This indeed happens for Europe/London, which
agrees on the epoch but was ahead a few months later.  So we can't
determine what outcome to expect based solely on localTimeType,
although we can be sure of a match when local time is UTC.  So skip
this test when local time isn't UTC (and document what's going on a
bit better).

Task-number: QTBUG-65435
Change-Id: Id9b8aa0402f2a2b410e0234f6eca4ab0d1010bc4
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-01-12 10:06:07 +00:00
Liang Qi
f4d8cafc1b Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/3rdparty/harfbuzz-ng/src/hb-private.hh
	src/sql/doc/snippets/code/doc_src_sql-driver.cpp
	src/sql/doc/src/sql-driver.qdoc

Change-Id: I38f0e82fcd37926cbf3c1915e009a731040d4598
2018-01-11 18:10:41 +01:00
Jani Heikkinen
a6514ddd33 Fix license headers
Remove usage of outdated header.LGPL21 and replace those with proper
one (header.LGPL in src, header.GPL-EXCEPT in tests)

Change-Id: Ia4d1c0d84b77f09787fe7c30670747a1fe2aff29
Reviewed-by: Liang Qi <liang.qi@qt.io>
2018-01-11 11:40:36 +00:00
Giuseppe D'Angelo
ff25a7ec05 QAbstractItemModelTester: fix the autotests
Move the modeltest autotest in the right place, and fix the
other autotests that were using it to use the version now in QtTestLib.

Change-Id: Ic6838945f616d580f357c872ce0956c341be3b16
Reviewed-by: David Faure <david.faure@kdab.com>
2018-01-09 21:12:58 +00:00
Liang Qi
9bee6712fc Merge remote-tracking branch 'origin/5.9' into 5.10
Change-Id: I840849c072075a69819eb185b20bc42c3de0f825
2018-01-09 21:27:30 +01:00
Giuseppe D'Angelo
69496d4e22 Introduce QAbstractItemModel::checkIndex()
When implementing a custom model there's the habit, in each and every
function that takes a QModelIndex, to carefully checking the index
passed by the caller. This index is checked for "legality" (*): does the
index belong to this model, is the index pointing to an existing row and
column, and so on.  These checks are hand-rolled and, as such, slightly
different and possibly incomplete (i.e. wrong) every time.

What's worse, these checks are implemented via "ordinary" code (if
statements). However, passing an illegal index to a QAIM function is a
precondition violation, and as such does not (and must not) be
checked in ordinary conditions, as it triggers undefined behavior. On
the other hand, while debugging a custom model or a custom hierarchy
of (proxy) models, having such checks in place can be a significant
aid.

Enter checkIndex(): a debugging helper for QAbstractItemModel and its
subclasses. checkIndex() centralizes the checks for legality of a
given index. User code is free to assert on it, or have some other
fallback mechanism in case a check fails.

(*) Using "legality" here instead of "validity" in order to avoid
confusion between QModelIndex::isValid() and what checkIndex() really
does.

[ChangeLog][QtCore][QAbstractItemModel] Added
QAbstractItemModel::checkIndex(), a debugging function for
QAbstractItemModel subclasses.

Change-Id: I1eea0586b1ac3ededdbfbf46759145022dc5ad86
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2018-01-08 09:41:53 +00:00
Marc Mutz
9c53f4d33a QStringBuilder: add support for QStringView
[ChangeLog][QtCore][QStringBuilder] Added support for QStringView.

Change-Id: I5b6803397b107ef69d198a935b3ba4339ac95087
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-01-08 09:41:43 +00:00
Marc Mutz
641e010cc7 QStringBuilder: add support for char16_t{,*,[]}
[ChangeLog][QtCore][QStringBuilder] Added support for char16_t
characters and strings.

Change-Id: Iee727f07226f2a326ae0df28d44930336cd8f71e
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-01-08 09:41:38 +00:00
Marc Mutz
859a78c0c1 QStringBuilder: clean up test
Add some macros to enable systematic testing of QStringBuilder
expressions.

Change-Id: I6b7dbcb4a4ca0d1aebdfe7cb9861af881c0cd346
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-01-07 18:32:11 +00:00
Edward Welbourne
e586d9ea7f Revert "Blacklist tst_QDateTime::operator_eqeq"
Remove black-listing of test; the problem was due to misconfigured
time-zone on the CI system - it was on some zone that presently
coincides with UTC, not actually on UTC as supposed.

This reverts commit 597b96b8fa.

Change-Id: I72ad1dfa38532362c05aef33cd874f7f79879a41
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2018-01-07 11:25:50 +00:00
Friedemann Kleint
5af4cb5a5a Tests: Raise minimum supported MSVC version to 2015
Remove code for older versions and streamline #ifdefs.

Task-number: QTBUG-51673
Change-Id: If456567691538b1a1f452111814c5f9eba401c43
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-01-04 20:23:25 +00:00
Liang Qi
79dfc08437 Merge remote-tracking branch 'origin/5.10' into dev
Change-Id: I644cd82b0d952b7d139e0228bf5017f147db77e7
2018-01-04 19:49:26 +01:00
Liang Qi
4ef667d200 Merge remote-tracking branch 'origin/5.9' into 5.10
Change-Id: I3fa5c9e216201bdf7da260c395f65d7fb95cba0b
2018-01-04 17:24:18 +01:00
Lars Knoll
41b4e154d6 Update Text segmentation and line break data to Unicode 10.0
Also adjusted the text segmentation and line break algorithms
so that they can handle the new data, and pass the test suite.

Change-Id: Ib727fd80003e34e96458d7a681996de3fa3691e7
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-01-03 07:47:26 +00:00
Lars Knoll
2b2b9c9962 Update QString::isRightToLeft() to take directional hints into account
Make sure we properly handle both directional embeddings as well as
directional isolates to determine the direction of the string.

According to the latest version of the Unicode bidi algorithm,
parts of the string contained inside an directional isolate is
to be ignored when determining the paragraph direction. Embedding
markers themselves are to be ignored as well, but not the characters
inside an explicit directional embedding or override.

This is also some required pre-work to get our BiDi algorithm
updated to the latest version of the standard.

Move the implementation to QStringView and implement the methods
in QString and QStringRef through that implementation.

Task-number: QTBUG-57743
Change-Id: I7f24e09198e22d6359c6534c9ae40a904e94c46e
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-01-03 07:46:20 +00:00
Simon Hausmann
997dd020c1 Fix source code file permissions
Fix permissions after commit ffc8409aa5 -
our source files are not executable.

Change-Id: Idc5103704256b6f73857b645c323492beaabe879
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-01-02 14:46:47 +00:00
Liang Qi
9de26a630f Merge "Merge remote-tracking branch 'origin/5.10' into dev" into refs/staging/dev 2018-01-02 09:32:37 +00:00
David Faure
bb6f0a5291 QMimeDatabase: only export var for unittests if QT_BUILD_INTERNAL
Change-Id: I7fa25b64cf39667c8cea95431f68baab623c8a2a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-01-02 09:31:37 +00:00
Lars Knoll
0f315adf91 Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	.qmake.conf
	sc/corelib/io/qfsfileengine_p.h
	src/corelib/io/qstorageinfo_unix.cpp
	src/platformsupport/eglconvenience/qeglpbuffer_p.h
	src/platformsupport/input/libinput/qlibinputkeyboard.cpp
	src/platformsupport/input/libinput/qlibinputpointer.cpp
	src/plugins/platforms/cocoa/qcocoamenu.mm
	src/plugins/platforms/ios/qiosscreen.h
	src/plugins/platforms/ios/qioswindow.h
	src/plugins/platforms/ios/quiview.mm
	src/printsupport/dialogs/qpagesetupdialog_unix_p.h
	src/printsupport/dialogs/qprintpreviewdialog.cpp
	src/printsupport/widgets/qcupsjobwidget_p.h
	src/widgets/widgets/qmenu.cpp
	tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
	tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp

Change-Id: Iecb4883122efe97ef0ed850271e6c51bab568e9c
2018-01-02 09:58:44 +01:00
Samuel Gaist
2b0eb3fac3 Remove use of QRegExp from QSharedMemory
This patch updates the code from QSharedMemory to remove the use
of the deprecated QRegExp class. It also updates the unique key
test to avoid change of behavior going undetected.

Change-Id: I649e615027507898800bb5454a62a6cf8bbb2e18
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-12-30 23:34:00 +00:00
Lars Knoll
db92f2f3aa Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	.qmake.conf
	mkspecs/win32-g++/qmake.conf
	src/corelib/global/qglobal_p.h
	src/corelib/global/qoperatingsystemversion_p.h
	src/corelib/io/qfilesystemengine_win.cpp
	src/network/bearer/qbearerengine.cpp
	src/platformsupport/input/libinput/qlibinputpointer.cpp
	src/sql/doc/snippets/code/doc_src_sql-driver.cpp
	src/widgets/kernel/qwidget_p.h
	src/widgets/kernel/qwidgetwindow.cpp
	src/widgets/styles/qfusionstyle.cpp
	tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp

Change-Id: I80e2722f481b12fff5d967c28f89208c0e9a1dd8
2017-12-30 12:09:53 +01:00
Alex Trotsenko
89b0364cde QRingBuffer: avoid reallocations of the data
Since its initial implementation, QRingBuffer had the following
fragilities in the architecture:

  - it does not guarantee validity of the pointers, if new data will
    be appended. As an example, passing an address of the QRingBuffer
    chunk as a parameter to the WriteFileEx() function on Windows
    requires the stability of the pointer. So, we can't add new data
    to the QRingBuffer until the overlapped operation completed
    (related issues were fixed for QWindowsPipeWriter and QSerialPort
    in 5.6 branch by introducing an intermediate byte array);
  - inefficient reallocations in reserve(), if a shared chunk was
    inserted in the queue (we can get a reallocation in the place
    where we don't expect it:

      char *writePtr = buffers.last().data() + tail;  <-  line #133

    ).

Proposed solution is to avoid reallocation by allocating a new
block instead. That was accomplished by introducing a QRingChunk
class which operates on a fixed byte array and implements head/tail
pointers strategy for each individual buffer in the queue. So,
QRingBuffer is no longer dependent on QByteArray's internal
shrink/growth algorithms.

Change-Id: I05abab0ad78e22e4815a196037dfc6eff85325d1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-12-30 10:15:10 +00:00
Joni Jantti
597b96b8fa Blacklist tst_QDateTime::operator_eqeq
This autotest fails on the new Ubuntu 16.04 template with UTC timezone
in the system settings.

Task-number: QTBUG-65435
Change-Id: I397f01ab3fed354a4eeec8b05415226a75fce5a1
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2017-12-27 14:41:00 +00:00
Thiago Macieira
3d7cdb64fc qfloat16: NaN is not infinite
Change-Id: I39332e0a867442d58082fffd1502b7010424f0f8
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-12-27 11:50:09 +00:00
Dyami Caliri
ffc8409aa5 Use AccessCheck for current user effective file permissions
On Windows, QFileInfo.isWritable() was returning true in situations
where the file would only be writable with elevated privileges. Using
AccessCheck instead of GetEffectiveRightsFromAcl to get the correct
results.

Done-with: Friedemann Kleint <Friedemann.Kleint@qt.io>
Done-with: Edward Welbourne <edward.welbourne@qt.io>
Task-number: QTBUG-30148
Change-Id: I7a3468ac069bf782ca312078e3a84107b6cd468c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-12-21 15:45:34 +00:00
Sergio Martins
17d231039b Don't crash with null receiver/context in new-style connects
old style connects have protection against null sender and null receiver,
but new style only had against null sender.

Change-Id: Ie555ac078412918e60c3b60830fe1f3abfb7f5af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-12-19 23:03:42 +00:00
Morten Johan Sørvig
0b4b864d83 Remove testQuitLock from BLACKLIST
Follow-up to d044b0b, with claimed to remove it but
didn’t.

Change-Id: Ifeeb6b062c7c41f1914d677e8aa20e4cb9378ac9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-12-14 21:07:39 +00:00
Jesus Fernandez
345be58100 Fix assert when emitting a signal from a different thread
If a signal is emitted more than once in a multithreaded application the
QSignalEventGenerator::execute function asserts in the check for a valid
signal index. It happens after abandoning the state and all the
connections are disconnected. If we have pending signal to be
processed the QObject::sender() won't be able to resolve the sender
object.

Task-number: QTBUG-61463
Change-Id: I9d4b7266c6dddc9ff2e7453b05a6989876ccb332
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-12-14 16:30:38 +00:00
Edward Welbourne
99b1253101 Kludge round MS TZ APIs' lies breaking a test
Commit 68bcccac took account of MS TZ APIs mis-describing non-DST
zones making changes to standard offset (e.g. Europe/Samara in 2011 at
the end of October); however a DST transition that coincides with an
equal and opposite change to standard offset, while the other end of
its DST period changes normally, ends up looking exactly the same
(although it's nominally subtly different), in MS's APIs.  Thus fixing
the more common case broke this more obscure case; there is no way to
fix this (other than not using MS's broken-by-design APIs).  So kludge
the test to skip the bit we know this breaks.

Task-number: QTBUG-64985
Change-Id: I068500e2e783ab72b400bfd6dbb7dbbd5b08a7bc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-12-13 18:51:29 +00:00
Oliver Wolff
27c840f5d4 Fix typo
Change-Id: If6111c59b958ba03f6ec5966af5cf443cae5cf9b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-12-13 13:07:48 +00:00
Edward Welbourne
960c712b48 Remove spurious execute permissions
Change-Id: I2aa16d49bb8eb474200c70f312b4eb7cfc1604cb
Reviewed-by: David Faure <david.faure@kdab.com>
2017-12-08 13:27:42 +00:00
Liang Qi
812bb236dd Merge remote-tracking branch 'origin/5.10.0' into 5.10
Change-Id: I6dcf85067ec226136c207ea69ca9d66736c84db5
2017-12-08 13:56:17 +01:00
Liang Qi
53b141dceb Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/plugins/platforms/ios/quiview.mm

Change-Id: I88384c70047391c75d9ff166c8d9881ff6751dbf
2017-12-05 13:37:21 +01:00
Jan Arve Sæther
0c9e379dd8 Use a custom QAnimationDriver to take control over time
This should reduce flakyness of tests.

Change-Id: I26e0a97f7cd3e7cee2ffb44188300c37578cddd7
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-12-02 19:58:30 +00:00
Allan Sandfeld Jensen
2c25a431d0 Use dependencies instead of CONFIG+=ordered
Also drops a few instances where the dependency was purely runtime,
especially for examples.

Change-Id: I2a0476f79928143596bdb3b8f01193af90574ae8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-12-02 11:09:15 +00:00
Friedemann Kleint
92cd3bfa2e macOS: Blacklist: tst_QPropertyAnimation::startWithoutStartValue()
Task-number: QTBUG-64108
Change-Id: Id60a9a1bfede9cbe90f378d131a331d726acfdae
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2017-12-01 09:54:00 +00:00
Friedemann Kleint
6d09db53f7 macOS: Blacklist tst_QPauseAnimation::noTimerUpdates()
Task-number: QTBUG-64107
Change-Id: Ie77d2d2525e79fb7e17f1a69d15ef40982f9242d
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2017-12-01 09:53:58 +00:00
Edward Welbourne
92fad720af Add a check of selected time-zone offset data
Task-number: QTBUG-64122
Change-Id: I6b113f2f05db9659b8c542744846096e39f285ab
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 20:20:29 +00:00
Edward Welbourne
b4ef4469ba QDateTimeParser: reject all short values in fixed-width fields
Previously, a 1, 2 or 3 for "dd" would be rejected because 10, 20 or
30 would fit in the field and be valid; but 4 or more was accepted,
even though it was too short for the field, because no suffix could
make it valid within the field-width.

[ChangeLog][QtCore][QDateTime] When parsing dates and times from
strings, fixed-width date-time fields, such as a "dd" for day,
QDateTime now rejects all values that should be padded, rather
than only doing so when the value is a prefix of some value that
would fill the field-width.  Use a single letter for the field,
e.g. "d" for day, if you want to accept short
values. (QDateTimeEdit is not affected.)

Task-number: QTBUG-63072
Change-Id: I22d223c50057c3edab4ef7f01d9ed0f58e9139c1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-11-30 20:19:29 +00:00
Edward Welbourne
a755c2e521 Raise the upper bound on years to 9999
Test-case taken from bug-report; fits in as an easy row in an existing
data-driven test.  Add similar tests for date-time and time; and an
isValid test on the end of year 9999.  The date-time parser was using
the end of year 7999 as maximum value for dates and date-times; extend
this to year 9999, as I can see no reason not to.

[ChangeLog][QtCore][QDateTime] Years up to 9999 can now be parsed
without error (previously 8000 and beyond were treated as invalid) in
all formats (not only in ISO format).  Widgets handling dates now
support dates to 9999, likewise.

Task-number: QTBUG-64401
Change-Id: I518cfa6c2cb4ecc5a85b896dc9e56b4fdd8a8bb1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 20:19:13 +00:00
Christian Ehrlicher
1c0fcbc887 QSortFilterProxyModel: Clear persistent indexes on source model change
When a new source model was set to QSortFilterProxyModel, the model
tried to remap the persistent indexes to the new model which was wrong.
The correct solution is to clear the persistent indexes with
_q_sourceModelDestroyed() since the old source model went away.

Task-number: QTBUG-44962
Change-Id: Id39e9ac83324250e8bfa434aae467a9206d2590e
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2017-11-30 17:29:33 +00:00
Liang Qi
c35342ffeb Merge "Merge remote-tracking branch 'origin/5.10' into dev" into refs/staging/dev 2017-11-30 12:57:22 +00:00
David Faure
648840c617 QMimeDatabase: handle removal of a mime directory
The previous commit didn't handle correctly the case where an entire
mime directory is deleted. The unittest wasn't testing that case,
now it is. We need to move providers into a new list, and then
delete those left over (i.e. now unused).

Change-Id: I04fd8b39b511a2331d706864f695ce5074acf916
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 12:54:52 +00:00
David Faure
7a5644d648 QMimeDatabase: redesign to use both binary and XML providers
Previously, we would use mime.cache in all mime directories if at
least one of them had such a file (other than the most-local one),
otherwise the "source" XML would be used in all directories.

Now it's possible to use mime.cache in those directories which
have one, and XML in those directories that don't.

Not only is this more correct, it will allow in a subsequent
commit to bundle the binary cache in QtCore's qrc rather than
the very big XML file.

The design change to allow this is that now every provider
only deals with a single directory, and QMimeDatabasePrivate
takes care of creating multiple providers, one for each dir.
This required to move most of the loops from the binary provider
up to QMimeDatabasePrivate itself.

Change-Id: Iac82d5f5836b80d45076e586b903d16fa2525b34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 12:54:49 +00:00
Liang Qi
87204c856a Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/corelib/thread/qsemaphore.cpp
	tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
	tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp

Change-Id: Id35b535e88df63fdfe4007ea92ed4a39c4b6d707
2017-11-30 09:16:58 +01:00
Thiago Macieira
498ef7f9d7 Merge "Merge remote-tracking branch 'origin/5.10' into dev" into refs/staging/dev 2017-11-30 00:51:32 +00:00
Marc Mutz
67391f0a57 Fix aliasing problem in QVector::removeAll()
Since removeAll() takes its argument by cref, if passing a reference
to an element of the container to removeAll(), the element may be
deleted (overwritten) by anyother value, leading to UB.

Add a test that actually happens to fail for me without the patch,
even though that might not be guaranteed (we may invoke UB).

Change-Id: If8c795113aeb515f4a9bdf1e072395b932295667
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-28 21:58:50 +00:00
Simon Hausmann
984ad61249 Improve readability of code that uses the Qt signed size type
During the container BoF session at the Qt Contributor Summit 2017 the
name of the signed size type became a subject of discussion in the
context of readability of code using this type and the intention of
using it for all length, size and count properties throughout the entire
framework in future versions of Qt.

This change proposes qsizetype as new name for qssize_t to emphasize the
readability of code over POSIX compatibility, the former being
potentially more relevant than the latter to the majority of users of
Qt.

Change-Id: Idb99cb4a8782703c054fa463a9e5af23a918e7f3
Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch>
Reviewed-by: David Faure <david.faure@kdab.com>
2017-11-28 18:41:40 +00:00
David Faure
275c748ada Fix naming of new property QSortFilterProxyModel::recursiveFiltering
Add "Enabled" to match Qt API naming rules.
+ fix \since tag.

Change-Id: Iaf312648f7385cd7e8d3d101b561fbd4e955df25
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-28 18:41:09 +00:00
Liang Qi
1139be7b30 Merge remote-tracking branch 'origin/5.9' into 5.10
Change-Id: Iede384644c3df5ee01b701806dfdb586dd6bb138
2017-11-28 11:23:35 +01:00
Tor Arne Vestbø
fa2a653b3b Initialize QLoggingRegistry rules on first use
Allows categorized logging before QCoreApplication has been created,
which otherwise would silently fail to output anything because the
category would never be enabled, despite QT_LOGGING_RULES being set.

Change-Id: I1861e5366ea980dff2ffa753b137276c77278eee
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-25 10:01:35 +00:00
Thiago Macieira
ea18eec931 Merge "Merge remote-tracking branch 'origin/5.9.3' into 5.9" into refs/staging/5.9 2017-11-25 08:52:40 +00:00
Giuseppe D'Angelo
c3632d8036 tst_qstringlistmodel: remove an invalid test
The test is removing 2 rows starting at the last row of a model.
As the comment indicates, that's clearly invalid.

Change-Id: I43ef00d602934965b206e2ba591ff8fd0a6ae398
Reviewed-by: David Faure <david.faure@kdab.com>
2017-11-24 18:23:40 +00:00
Giuseppe D'Angelo
77a7b5c916 tst_qitemmodel: do not pass illegal indices to QAbstractItemModel APIs
That's undefined behavior, so don't test it.

Change-Id: I468637ff1835f4f50859ac3d9876463221a3285a
Reviewed-by: David Faure <david.faure@kdab.com>
2017-11-24 18:23:37 +00:00
Giuseppe D'Angelo
3587a25238 QFlags: support enum classes in setFlag()
Unary ~ is not defined for enum classes, so we need a cast.

Change-Id: I79d495ebcc24ab960da8dae3be08eb307a9de448
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-24 18:23:34 +00:00
Liang Qi
7c4b0aa970 Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/corelib/io/qstandardpaths_win.cpp
	src/plugins/platforms/ios/qioswindow.mm
	src/plugins/platforms/ios/quiview.mm
	tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp

Change-Id: I5deb0a0176a454a9c566e924d074ba60ce04f0bc
2017-11-23 12:52:18 +01:00
Liang Qi
19378fa008 Merge remote-tracking branch 'origin/5.9.3' into 5.9
Change-Id: I9add7e07ff1b6a1cf52f59dbb8319f30e114e5fc
2017-11-23 09:47:49 +01:00
Liang Qi
153e8b49ad Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/network/access/qhttp2protocolhandler_p.h
	src/network/kernel/kernel.pri
	src/network/ssl/qsslkey_qt.cpp
	src/plugins/platforms/cocoa/qcocoascreen.mm
	src/plugins/platforms/windows/accessible/iaccessible2.cpp
	src/plugins/platforms/windows/accessible/iaccessible2.h
	src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
	src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
	src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h
	src/widgets/widgets/qmenu_p.h
	tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
	tests/auto/other/qaccessibility/tst_qaccessibility.cpp
	tests/auto/testlib/selftests/expected_cmptest.lightxml
	tests/auto/testlib/selftests/expected_cmptest.teamcity
	tests/auto/testlib/selftests/expected_cmptest.txt
	tests/auto/testlib/selftests/expected_cmptest.xml

Done-with: Edward Welbourne <edward.welbourne@qt.io>
Change-Id: I4217cc7d840cbae3e3dd28574741544469c4c6b9
2017-11-23 09:36:03 +01:00
Thiago Macieira
4be50ecafd QTemporaryFile: fix issues with removing a file twice
The assertion in isUnnamedFile() we had was incorrect after the file was
removed, since we cleared the name and possibly reset back to the
template. Since ~QTemporaryFile() calls remove(), this was easy to
trigger if you attempted to remove the temp file and leave
QTemporaryFile like that.

Take this opportunity to add to the docs of setAutoRemove() explaining
the possibility of unnamed files.

#7  0x00007f69bcc2b50e in qt_assert (
    assertion=assertion@entry=0x7f69bcf194a0 "unnamedFile == d_func()->fileEntry.isEmpty()",
    file=file@entry=0x7f69bcf19458 "io/qtemporaryfile.cpp",
    line=line@entry=514) at global/qglobal.cpp:3123
#8  0x00007f69bcd672cf in QTemporaryFileEngine::isUnnamedFile (this=this@entry=0x55cd60644df0)
    at io/qtemporaryfile.cpp:514
#9  0x00007f69bcd683f7 in QTemporaryFileEngine::remove (this=0x55cd60644df0)
    at io/qtemporaryfile.cpp:396
#10 0x00007f69bcd48654 in QFile::remove (this=this@entry=0x7fffb393f7e0)
    at io/qfile.cpp:513
#11 0x00007f69bcd6653b in QTemporaryFile::~QTemporaryFile (this=0x7fffb393f7e0, __in_chrg=<optimized out>)
    at io/qtemporaryfile.cpp:719

Change-Id: I57a1bd6e0c194530b732fffd14f4ed28ca8185b2
Reviewed-by: Andreas Hartmetz <ahartmetz@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-23 05:27:23 +00:00
Allan Sandfeld Jensen
b8e352ad37 Add functions for fast bulk conversion of qfloat16
Both ARM and x86 can convert fp16 much faster in bulk than one at a
time. This also enables hardware accelerated conversion on x86, when
F16C isn't unconditionally available at compile time.

This code is implemented in C to ensure that there's no leakage of
inline symbols from the .obj file that was compiled by Visual Studio
with AVX support. Unfortunately, simd.prf uses $(CXX) instead of $(CC)
for all its sources, which means the file gets interpreted as C++ by
g++, clang++ and icpc. Those compilers at least don't leak any symbols.

Done-with: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: I9d26d99e83392861fb09564e0e8e8d76cd8483b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-21 20:01:23 +00:00
Thiago Macieira
0ac2dca977 Add support for C11 static_assert and thread_local
Tested with Clang, GCC 4.5 & up, ICC 17 and MSVC 2017. No current
version of MSVC supports C11 and GCC implemented the features slightly
later in C than in C++.

Change-Id: I57a1bd6e0c194530b732fffd14f45c5074c9a052
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-11-21 20:01:18 +00:00
Liang Qi
7e360ccd4e Merge remote-tracking branch 'origin/5.9.3' into 5.10.0
Change-Id: I3224e0b877ec24b587e299083feb793518b0568c
2017-11-21 10:58:21 +01:00
Oswald Buddenhagen
bb3872d609 Merge 5.10 into 5.10.0
Change-Id: Ibfbaa8ef89cf45b87a2c65f1da4a708e5464f259
2017-11-20 13:48:33 +01:00
Svenn-Arne Dragly
ce08318a46 Add QThreadPool autotest to detect stale threads after tryTake
This test makes sure that we do not introduce a regression where the
threads exited the inner loop over the queue before the queue was
empty. This was triggered by calling tryTake at least maxThreadCount
times, which left the same number of null pointers in the queue
and caused the inner loop to exit too soon for all the threads.

Change-Id: I3a9d800149b88d09510ddc424667670b60f06a33
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-16 12:42:44 +00:00
Edward Welbourne
285596ee19 Special-case parsing of Zulu time-zone in date-times
When parsing a date-time's zone, a stray Z denotes UTC (a.k.a. Zulu
time), despite not being a valid name for the zone.  Clients parsing
such date strings had to treat the Z as a literal, rather than a
zone-ID, but then they got back a LocalTime instead of the UTC the
string actually described.  So teach QTimeZoneParser to handle this
special case and adapt an existing test (that used a time ending in Z,
but had to treat it as a local time) to check this works.

[ChangeLog][QtCore][QDateTime] When parsing a time-zone, "Z" is now
recognized as an alias for UTC.

Change-Id: Ib6aa2d8ea2dc6b2da526b39aec74dbc007f90fd8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-14 16:44:27 +00:00
Thiago Macieira
772863355a QLockFile/Unix: save the boot and machine IDs in the lock file too
This allows us to make sure that the PID we read is from the same boot
as we are right now running. The collision could happen on embedded
systems where the boot sequence is fixed, so all the same processes
would have the exact same PIDs after reboot as they did before.

[ChangeLog][QtCore][QLockFile] QLockFile can now properly conclude that
a lock file from a previous boot of the same device is stale and can be
removed. This is implemented only for Linux and Apple operating systems.

Task-number: QTBUG-63425
Change-Id: I0b48fc8e90304e0dacc3fffd14e8e3a197211788
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2017-11-14 15:54:56 +00:00
Thiago Macieira
4870282117 QSemaphore: fix regression when the timeout < 0
The issue was introduced by eaee1209f0, so
it affected only 5.9.2.

[ChangeLog][QtCore][QSemaphore] Fixed a regression that would make
tryAcquire() not to wait forever if the timeout was a negative
value. Note: new code is advised to only use -1 to indicate "forever",
as some other functions taking timeout periods do not accept other
values.

Task-number: QTBUG-64413
Change-Id: I57a1bd6e0c194530b732fffd14f58fce60d5dfc9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-14 11:07:30 +00:00
Tony Sarajärvi
212f92182a Merge "Merge remote-tracking branch 'origin/5.9' into 5.10" into refs/staging/5.10 2017-11-12 15:35:48 +00:00
Sami Nurmenniemi
3c63c8d2f2 Blacklist tst_qstandardpaths::testFindExecutable for b2qt/arm64
Task-number: QTBUG-64404
Change-Id: Ie04cf67574c4eb8b8e5bdb78e8e30173042edab7
Reviewed-by: Liang Qi <liang.qi@qt.io>
2017-11-12 15:35:21 +00:00
Thiago Macieira
08bf28de03 QRandomGenerator: add more of the std Random Engine API
This brings us to almost parity with the C++11 Random Engine API
requirements (see chapter 26.5.1.4 [rand.req.eng]). We don't implement
the templated Sseq requirements because it would require moving the
implementation details to the public API. And we don't implement the
<iostreams> code because we don't want to.

Change-Id: Icaa86fc7b54d4b368c0efffd14f05ff813ebd759
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-11 08:11:07 +00:00
Thiago Macieira
cfad4e298f QRandomGenerator: add securelySeeded(), to ensure appropriate seeding
Since we don't document how many bytes one needs (it's 2496), it's
difficult for the caller to provide just enough data in the seed
sequence. Moreover, since std::mt19937 doesn't make it easy to provide
the ideal size either, we can't actually write code that operates
optimally given a quint32 range either -- we only provide it via
std::seed_seq, which is inefficient.

However, we can do it internally by passing QRandomGenerator to the
std::mersenne_twister_engine constructor, as it's designed to work.

Change-Id: Icaa86fc7b54d4b368c0efffd14f0613c10998321
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-11 08:11:03 +00:00
Thiago Macieira
af456842e1 Change QRandomGenerator to have a deterministic mode
Now only QRandomGenerator::system() will access the system-wide RNG,
which we document to be cryptographically-safe and possibly backed by a
true HWRNG. Everything else just wraps a Mersenne Twister.

Change-Id: I0a103569c81b4711a649fffd14ec8cd3469425df
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-11 08:11:00 +00:00
Thiago Macieira
4502999ff0 QRandomGenerator: remove the per-thread buffer
Since we're adding a deterministic generator that inherently does not
use syscalls, and people should really use that one by default, there is
no point in optimizing the secure generator wrt syscalls. Besides,
keeping the random data in memory for longer than needed is likely
inadviseable.

Change-Id: Ib17dde1a1dbb49a7bba8fffd14ed0871117fe930
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-11 08:10:58 +00:00
Liang Qi
88cf044580 Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/gui/kernel/qwindow.cpp
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/plugins/platforms/windows/qwindowssystemtrayicon.cpp
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
	tests/auto/widgets/kernel/qaction/tst_qaction.cpp

Change-Id: Ifa515dc0ece7eb1471b00c1214149629a7e6a233
2017-11-09 11:47:57 +01:00
Oliver Wolff
579d0cb2be Fix tst_QFile::openDirectory for systems using builtin test data
To obtain "proper" directory behavior, we have to check against the
extracted "resources" directory instead of its qrc counterpart.

Change-Id: I4996ba74419945f78d356ad953a5b826ff663687
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-11-09 07:33:38 +00:00
Oliver Wolff
82c3c9d45d Fix tst_QFile::handle for systems using builtin test data
To obtain the file's handle, we need to obtain it from the extracted
test data instead of qrc.

Change-Id: I89c5c3f3a7da7e36205a439581a6d83efffdc07c
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-11-09 07:33:37 +00:00
Oliver Wolff
bbc68dc815 Fix tst_QFile::useQFileInAFileHandler for systems using resources for test data
Resource files are extracted to m_dataDir in tst_QFile::initTestCase.
Instead of trying to access the file from the resource on systems that
use qrc for bundling the test data, we have to use the files that were
extracted at the beginning of the test.

Change-Id: I35453fbdeb27e317d1342ff1cb7bbea9cebea14d
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-11-09 07:33:35 +00:00
Oliver Wolff
e27bd98137 qfile tests: Make sure files are writable before deleting them
On some platforms (like UWP) files that are copied during
qfile auto tests are not writable by default. The cleanup will fail for
these files if the permissions are not set accordingly.

Change-Id: Id925dcadfc6b505c87f1f55d5ea05e286b60a5a5
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-11-09 07:33:35 +00:00
Thiago Macieira
19b0ce5daa Change almost all other uses of qrand() to QRandomGenerator
The vast majority is actually switched to QRandomGenerator::bounded(),
which gives a mostly uniform distribution over the [0, bound)
range. There are very few floating point cases left, as many of those
that did use floating point did not need to, after all. (I did leave
some that were too ugly for me to understand)

This commit also found a couple of calls to rand() instead of qrand().

This commit does not include changes to SSL code that continues to use
qrand() (job for someone else):
  src/network/ssl/qsslkey_qt.cpp
  src/network/ssl/qsslsocket_mac.cpp
  tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp

Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-08 09:14:03 +00:00
Edward Welbourne
90a78c9724 Fix typo in tst_QTimeZone::testEpochTranPrivate()
The milli-seconds since epoch value for an invalid transition is,
of course, invalidMSecs(), not invalidSeconds().
Added a comment while I was at it, explaining why we expect a
transition before the epoch, if such transitions are supported.

Change-Id: I0f376f9d69c0e6e79a309dc011943baa41175135
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-06 09:54:20 +00:00
Liang Qi
a7e4b645dc Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/corelib/global/minimum-linux.S
	src/network/access/qhttpthreaddelegate.cpp
	src/widgets/kernel/qwidgetwindow.cpp

Change-Id: Id2e817e85f85c68f5482c9a12912d35590f9d5f8
2017-11-05 18:02:18 +01:00
Jake Petroules
cd542a82b0 Remove references to obsolete platforms
ultrix and reliant have not seen a release since 1995. dgux not since
2001. bsdi not since 2003. irix not since 2006. osf not since 2010.
dynix... unclear, but no later than 2002. symbian needs no mention.
All considered obsolete, all gone.

sco and unixware are effectively obsolete. Remove them until someone
expresses a real need.

Change-Id: Ia3d9d370016adce9213ae5ad0ef965ef8de2a3ff
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-05 06:33:53 +00:00
Gatis Paeglis
ad36da8ff4 testlib: start sharing common helper functions
... by moving them in QTestPrivate namespace (qtesthelpers_p.h). This
header file is a convenient staging area for helper APIs, eventually
some could be moved to public QTest API.

This header file utilizes the same pattern as other qtestlib header
files - wrapping functions with QT_${LIBNAME}_LIB to automatically
enable certain APIs based on what is in the projects dependencies,
e.g. QT += widgets.

Change-Id: Ic0266429939c1f3788912ad8b84fc6e0d5edd68b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-11-04 20:11:22 +00:00
Friedemann Kleint
254849b62a macOS: Blacklist tst_QSequentialAnimationGroup::groupWithZeroDurationAnimations()
Task-number: QTBUG-64109
Change-Id: Iebe5a07d108ba647baa74ded71b730c867bd1c41
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2017-11-03 21:15:08 +00:00
Liang Qi
17d5141113 Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/plugins/platforms/windows/qwindowswindow.cpp
	tests/auto/widgets/kernel/qaction/tst_qaction.cpp

Change-Id: Ia017a825ed2ca2d53ac586f4ae48df6f65818d40
2017-10-30 08:54:05 +01:00
Thiago Macieira
0e0f656f50 Mark the previously public qstringalgorithms.h functions private
Discussed during Qt Contributor Summit 2017. We concluded that we don't
want to make these functions public, as they do not follow Qt coding
style API. Specifically,

   qStartsWith(a, b)

is not easily understood which argument is the needle and which argument
is the haystack (same problem memcpy() has). Compare that to

   a.startsWith(b)

which can clearly be read in English as a subject-verb-object sentence.

This commit removes the unit tests that called compare().

Discussed-on: http://lists.qt-project.org/pipermail/development/2017-October/031060.html
Change-Id: Icaa86fc7b54d4b368c0efffd14ee6205eb9043fb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-10-29 10:13:13 +00:00
Thiago Macieira
81f2516600 QRandomGenerator: add system() and global()
Right now,this does really nothing. This commit is just to allow us to
transition the other modules (besides qtbase) to use the syntax that
will become the API.

I've marked three places to use the system CSPRNG:
 1) the QHash seed
 2) QUuid
 3) QAuthenticator

I didn't think the HTTP multipart boundary needed to be
cryptographically safe, so I changed that one to the global generator.

Change-Id: Ib17dde1a1dbb49a7bba8fffd14ecf1938bd8ff61
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-10-29 10:13:01 +00:00
Friedemann Kleint
1c3dc8cfb8 tst_QFile::largeUncFileSupport(): Use QTRY_VERIFY() to open the file
Open failures due to sharing violations have been observed in Coin.

Change-Id: If7fbe01a454b3c343c0b87f73db50c28eae901c3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-10-27 20:02:58 +00:00
Friedemann Kleint
cd45d0f712 tst_QFile: Introduce StdioFileGuard
Guard the FILE * obtained by fopen() by a RAI class ensuring
the file is closed on destruction.

Change-Id: I9297f91ca2120238f3a44bad92bca5f920e01aa8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-10-27 20:02:53 +00:00
Thiago Macieira
9574436666 QUrl: make sure setPort(nonnegative) is taken as part of authority
There were a couple of corner cases where doing setPort() would result
in QUrl thinking that an authority was not present. Since the full URL
parsing implies that a host is always present if the authority is
present, then we also imply that setting the port number makes the host
be present too.

Change-Id: I69f37f9304f24709a823fffd14e67c12da18d69f
Reviewed-by: David Faure <david.faure@kdab.com>
2017-10-26 04:46:04 +00:00
Liang Qi
4f9b2cb026 Remove duplicate qnx from the platform file selector names
Update the QFileSelector tests for QNX.

Co-authored-by: James McDonnell <jmcdonnell@blackberry.com>
Change-Id: I68a8fde86725596323b539433287ac1a18fac1eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-10-24 16:43:39 +00:00
Allan Sandfeld Jensen
fa9d12f4a2 Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/plugins/platforms/windows/qwindowsmousehandler.cpp
	src/plugins/platforms/xcb/qxcbimage.cpp
	tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
	tests/manual/qtabletevent/regular_widgets/main.cpp

Done-with: Friedemann Kleint<Friedemann.Kleint@qt.io>
Done-with: Mårten Nordheim<marten.nordheim@qt.io>
Change-Id: I5b2499513a92c590ed0756f7d2e93c35a64b7f30
2017-10-24 13:40:55 +02:00
Liang Qi
32f50225c4 Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/plugins/platforms/direct2d/direct2d.pro
	src/plugins/platforms/ios/qiosclipboard.mm
	src/plugins/platforms/windows/windows.pro

Change-Id: Idffa03b3990bd642784f528821c5446b2e1008ef
2017-10-23 09:40:54 +02:00
Sami Nurmenniemi
9c58dd1588 Blacklist and skip failing tests for Boot2Qt / 64 bit arm
Task-number: QTBUG-60263
Change-Id: I05978915b5bb7ae31069e8e9ae1dc273e483ddb0
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2017-10-21 09:31:01 +00:00
Thiago Macieira
c90d9f95d2 QRandomGenerator: improve floating-point random generation
The previous version was good, just not optimal. Because the input was
an unsigned 64-bit number, compilers needed to generate extra code to
deal with HW instructions that only convert 64-bit signed input. And
that was useless because a double uniformly distributed from 0 to 1 can
only have 53 bits of randomness.

The previous implementation did exactly what the Microsoft libstdc++ and
libc++ implementations do. In my opinion, those implementations have an
imperfect distribution, which is corrected in this commit. In those, all
random input bigger than 0x20000000000000 has a different frequency
compared to input below that mark. For example, both 0x20000000000000
and 0x20000000000001 produce the same result (4.8828125e-4).

What's more, for the libc++ and MSVC implementations, input between
0xfffffffffffff001 and 0xffffffffffffffff results in 1.0 (probability 1
in 2⁵³), even though the Standard is very clear that the result should
be strictly less than 1. GCC 7's libstdc++ doesn't have this issue,
whereas the versions before would enter an infinite loop.

Change-Id: Ib17dde1a1dbb49a7bba8fffd14eced3c375dd2ec
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-10-20 18:10:33 +00:00
Orgad Shaneh
0354ba816f Clean dynamic function resolving done for XP in QFileInfo tests
Change-Id: I15364b1e8c4f4406fef2be68ca221a8867d0dcfa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-10-19 10:59:04 +00:00
Liang Qi
7e4571b7e7 Merge "Merge remote-tracking branch 'origin/5.9' into 5.10" into refs/staging/5.10 2017-10-17 18:29:37 +00:00
Liang Qi
d0a0a3c041 Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	examples/network/fortuneclient/client.cpp
	examples/network/fortuneserver/server.cpp
	src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h
	src/plugins/platforms/cocoa/qcocoabackingstore.h
	src/plugins/platforms/cocoa/qcocoaintegration.h
	src/plugins/platforms/cocoa/qcocoascreen.h
	src/plugins/platforms/ios/qiosbackingstore.h
	src/plugins/sqldrivers/oci/qsql_oci.cpp
	src/widgets/kernel/qwidgetwindow.cpp

Change-Id: Ia6dd2c52d4a691b671cf9a2ffca70deccece8f10
2017-10-17 10:34:24 +02:00
Liang Qi
01afc8c810 Merge remote-tracking branch 'origin/5.9' into 5.10
Change-Id: I3cf73c53cf131d0babfb558c2507bed0e0fc5f08
2017-10-16 22:21:52 +03:00
Thiago Macieira
65eed6d597 configure: make C++11 <random> a required functionality
Error out if it's missing or broken (Mersenne Twister not present).

This ensures that we never have a low-quality random generator in Qt.

Change-Id: I0a103569c81b4711a649fffd14ec80649df7087e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-10-16 16:25:34 +00:00
Joerg Bornemann
b5f2bf1a71 Fix QWinEventNotifier for auto-reset events
Auto-reset events are automatically reset to non-signaled when we get
notified about the signaled state. This implies that we cannot check the
event state again in activateEventNotifiers. Instead, store the signaled
state in a QAtomicInt and test and decrement that.

This amends commit 85403d0a.

Task-number: QTBUG-63555
Change-Id: I0adee3d2929783f98d91060f9106c8b5266d72fa
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-10-15 16:14:04 +00:00
Thiago Macieira
f27e029ef2 Autotest: use _exit() instead of exit() to simulate an unclean exit
We're not going to crash to avoid core dumps getting recorded by
systemd, filling up filesystems or showing dialog boxes. We just need to
exit without running destructors. Now, exit() isn't supposed to run
function-scope destructors, so just in case we use _exit().

Change-Id: I0b48fc8e90304e0dacc3fffd14e909ff248ce1a1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-10-08 06:41:05 +00:00
Giuseppe D'Angelo
cb08b40976 Move detection of <future> to a configure test
<future> is needed by QThread::create. Instead of a fragile series
of preprocessor tests, move its detection to a configure test.
This dramatically simplifies the code, but on the other hand ties
the availability of QThread::create() to the system used to compile
Qt (rather the one used to compile an application).

Change-Id: If1b06363379bf29126cfa68f2a0651cbb78a67f7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-10-06 05:51:54 +00:00
Thiago Macieira
f62768d046 QUrl: re-fix the setPath("//path") case leading to scheme://path
Commits aba336c2b4 (in Qt 5.2) and
aba336c2b4 (in 5.6) both tried to deal
with this problem, with different levels of success. This is the third
attempt (and hopefully the charm).

Instead of modifying the path that the user provides, go straight ahead
and declare it invalid. This is supported by RFC 3986, which declares
this expansion impossible:

   relative-part = "//" authority path-abempty
                 / path-absolute
                 / path-noscheme
                 / path-empty
   path-abempty  = *( "/" segment )
   path-absolute = "/" [ segment-nz *( "/" segment ) ]
   path-noscheme = segment-nz-nc *( "/" segment )

The "path-abempty" and "path-noscheme" cases are the two issues we
already handle. This commit adds the third one: path-absolute, which
requires that the first segment of the path be of non-zero length.

That is, it is now possible again to have http://example.com//path
constructed piece-wise, without it producing http://example.com/path.
Additionally, it catches the case of http://example.com//path parsed
from full URL then followed by setAuthority("").

Change-Id: I69f37f9304f24709a823fffd14e67a5e7212ddcd
Reviewed-by: David Faure <david.faure@kdab.com>
2017-10-06 03:49:40 +00:00
Tor Arne Vestbø
08e083e682 Ensure result of all QTest::qWaitFor are verified
The qWaitFor functions themselves can not trigger a test failure, as that
will not result in the test function exiting early, so every single call
to qWaitFor needs to be wrapped in a QVERIFY.

Change-Id: Id15a1549f31d06cdbf788e1d84ea431c28636ec8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-10-05 15:15:36 +00:00
Svenn-Arne Dragly
ba423261cd Improve performance in QThreadPool
When many runnables are executed, this improves the
performance by not resizing the queue for each runnable,
which was the case in the previous version, because of
many calls to QVector::takeFirst().

Also add a test that makes sure tryTake() is safe to
call and does not leave the queue in a bad state that
tries to use nullptr entries.

Change-Id: I608134ecfa9cfc03db4878dcbd6f9c1107e13e90
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-10-04 12:00:33 +00:00
Tor Arne Vestbø
c3e93391ee qmake: Allow non-bundle apps and libs to have an Info.plist
Change-Id: I5fe5c8d3214876520b5259d478ac9ef887c61e95
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-09-29 10:08:08 +00:00
Jake Petroules
7fd3cc3980 Clean up OS version checks for Apple platforms
Convert QSysInfo/QOperatingSystemVersion to __builtin_available where
required or possible, or to QOperatingSystemVersion where
__builtin_available cannot be used and is not needed (such as negated
conditions, which are not supported by that construct).

Change-Id: I83c0e7e777605b99ff4d24598bfcccf22126fdda
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-29 03:30:13 +00:00
Thiago Macieira
f7350ac99e Improve qustrlen further by avoiding the alignment prologue
This avoids looping prior to the main 16-byte loop, by performing one
load that may include bytes prior to the start of the string. This is
guaranteed not to fault, since str points to a valid character, but it
may cause Valgrind to print warnings.

Change-Id: I6e9274c1e7444ad48c81fffd14dcae854bba24b2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-26 18:19:35 +00:00
Liang Qi
aadfe7d634 Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/gui/kernel/qguiapplication.cpp
	src/platformsupport/input/libinput/qlibinputpointer.cpp
	src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
	src/plugins/platforms/cocoa/qcocoawindow.h
	src/testlib/qtestsystem.h

Change-Id: I5975ffb3261c2dd82fe02ec4e57df7c0950226c5
2017-09-26 16:14:54 +02:00
Thiago Macieira
282065d443 QRandomGenerator: update API to better name
"generate" is better than "get", and we already have "generate(it, it)"
which uses std::generate(). This changes:

 - get32()    →   generate()
 - get64()    →   generate64() and QRandomGenerator64::generate()
 - getReal()  →   generateDouble()

Change-Id: I6e1fe42ae4b742a7b811fffd14e5d7bd69abcdb3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-09-22 15:29:42 +00:00
Liang Qi
01bc69f99f Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/plugins/styles/mac/qmacstyle_mac.mm
	src/widgets/util/qcompleter.cpp
	src/widgets/widgets/qmainwindowlayout.cpp
	src/widgets/widgets/qmdisubwindow.cpp

Change-Id: If0e96981af07ce36ac68f2e69211bc2120f93973
2017-09-20 11:58:32 +02:00
Kevin Funk
58c14c4a7e Replace Q_NULLPTR with nullptr where possible
Remaining uses of Q_NULLPTR are in:
src/corelib/global/qcompilerdetection.h
  (definition and documentation of Q_NULLPTR)
tests/manual/qcursor/qcursorhighdpi/main.cpp
  (a test executable compilable both under Qt4 and Qt5)

Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-09-19 11:53:55 +00:00
Kevin Funk
47c92fbb0b Replace Q_DECL_OVERRIDE with override where possible
Remaining uses of Q_DECL_OVERRIDE are in:

src/corelib/global/qcompilerdetection.h
src/corelib/global/qglobal.cpp
doc/global/qt-cpp-defines.qdocconf
  (definition and documentation of Q_DECL_OVERRIDE)
tests/manual/qcursor/qcursorhighdpi/main.cpp
  (a test executable compilable both under Qt4 and Qt5)

Change-Id: Ib9b05d829add69e98a86238274b6a1fcb19b49ba
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-09-19 11:53:42 +00:00
Jake Petroules
83122b1932 Remove unnecessary VxWorks ifdef
Change-Id: Ie655bdff9a09c6060f66e4346b94ba52443241f4
Reviewed-by: Tuomas Heimonen <tuomas.heimonen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-18 21:06:25 +00:00
Jake Petroules
69b16a46e8 Exclude QSystemSemaphore test with -no-feature-systemsemaphore
Change-Id: I9db6b68c3d26b27a0203c68c48ab73602eb15095
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-09-18 08:56:53 +00:00
Giuseppe D'Angelo
fc208838ae QScopedPointer: add get()
For self-consistency with QSharedPointer and minor consistency
with std::unique_ptr (although QScopedPointer isn't movable, so we
can't claim STL compatibility with it).

[ChangeLog][QtCore][QScopedPointer] Added get().

Change-Id: Ib58f936afa0e0d5bce57a61d1467b69956f37ceb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-17 11:42:26 +00:00
Giuseppe D'Angelo
72f700edd6 tst_qidentityproxymodel: map the index to the source model
In data(), index belongs to the proxy, not to the source. It needs
to be mapped back to it first.

Change-Id: Ie5dcbf13166dadf62f3d85b594d3227383132521
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-09-15 13:52:10 +00:00
Jake Petroules
7127202358 Exclude tst_QDir::mkdirOnSymlink on Unix platforms without symlinks
One example is VxWorks.

Change-Id: I253df715a9417c1f9cede79b1e1860924e0da8a9
Reviewed-by: Tuomas Heimonen <tuomas.heimonen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-09-15 11:20:32 +00:00
Thiago Macieira
3b61cd6ad7 QStringView: De-inline the length calculation so we can use SSE2
Performance is more important in this case than the theoretical benefit
of constexpr. This commit implements the SSE2 search for 16-bit null and
it might be possible to implement the equivalent for AArch64
(investigation required). It also adds a fallback to wcslen() for
systems where wchar_t is short (non-x86 Windows or 32-bit x86 build with
-no-sse2).

We can re-add the constexpr loop once the C++ language has a way of
overloading constexpr and non-constexpr. GCC has a non-standard way to
do that with __builtin_constant_p, which is also implemented in this
commit, but note that the inline function is still not constexpr.

Change-Id: I6e9274c1e7444ad48c81fffd14dcaacafda5ebdc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-13 16:19:45 +00:00
Ulf Hermann
3b5b8f1d4a QXmlStreamWriter: Avoid writing invalid characters
Some valid UTF-16 characters cannot be expressed in XML 1.0 and a
QString may contain invalid unicode. In both cases we should not write
the respective data to the output stream, as that generates invalid XML,
which then cannot be read back by QXmlStreamReader. In addition we
should report an error if we encounter them.

The change filters the incorrect strings from the output and introduces
an "encodingError" flag which is reported from hasError().

[ChangeLog][Important Behavior Changes] Characters invalid in XML, such
as 0x0 or 0xfffe, as well as strings containing unmatched UTF-16
surrogates are now suppressed from the output of QXmlStreamWriter and
cause the error flag to be set.

Task-number: QTBUG-63150
Change-Id: Ia29bab768fed9681dd68e8934da2a7e3fcdfc3cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-13 07:29:00 +00:00
Giuseppe D'Angelo
71a2dd955c QSharedPointer: add get() for STL compatibility
[ChangeLog][QtCore][QSharedPointer] Added get(), for compatibility
with std::shared_ptr.

Change-Id: I77189c89bc6a222313b9b2353f1fb3969433c750
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-12 14:05:21 +00:00
Tor Arne Vestbø
d2a988512e macOS: Detect use of heap-allocated QMacAutoReleasePool
QMacAutoReleasePool is backed by an NSAutoreleasePool, which documents that
"you should always drain an autorelease pool in the same context (invocation
of a method or function, or body of a loop) that it was created".

This means allocating QMacAutoReleasePool on the heap is not a supported
use-case, but unfortunately we can't detect it on construction time.

Instead we detect whether or not the associated NSAutoreleasePool has been
drained, and prevent a double-drain of the pool.

Change-Id: Ifd7380a06152e9e742d2e199476ed3adab326d9c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-09-08 12:05:21 +00:00
Liang Qi
19dd2ca93b Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	examples/opengl/qopenglwidget/main.cpp
	src/3rdparty/pcre2/src/pcre2_printint.c
	src/plugins/platforms/cocoa/qnsview.mm
	src/widgets/widgets/qcombobox.cpp

Change-Id: I37ced9da1e8056f95851568bcc52cd5dc34f56af
2017-09-06 13:26:31 +02:00
Orgad Shaneh
ced0f54ec3 Fix resolution of relative links on Windows
[ChangeLog][QtCore][QFileInfo] Relative symbolic links on Windows are
now resolved to their absolute path by symLinkTarget().

Task-number: QTBUG-62802
Change-Id: I5826517130bd389aef994bf3f4b6d99b2a91b409
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-09-04 07:35:09 +00:00
Thiago Macieira
541a031552 tst_QMutex: produce less noise with MSVC
Since MSVC doesn't have <chrono> (according to QT_HAS_INCLUDE), the QSKIP
in the test was printed for every line in the table. Instead, add the
skip in the _data() function.

Change-Id: I6e9274c1e7444ad48c81fffd14dbcee5e5a322aa
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-09-01 16:36:17 +00:00
Liang Qi
112a4af107 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	examples/examples.pro
	qmake/library/qmakebuiltins.cpp
	src/corelib/global/qglobal.cpp
		Re-apply b525ec2 to qrandom.cpp(code movement in 030782e)
	src/corelib/global/qnamespace.qdoc
	src/corelib/global/qrandom.cpp
	src/gui/kernel/qwindow.cpp
		Re-apply a3d59c7 to QWindowPrivate::setVisible() (code movement in d7a9e08)
	src/network/ssl/qsslkey_openssl.cpp
	src/plugins/platforms/android/androidjniinput.cpp
	src/plugins/platforms/xcb/qxcbconnection.cpp
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	src/widgets/widgets/qmenu.cpp
	tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp

Change-Id: If7ab427804408877a93cbe02079fca58e568bfd3
2017-08-31 14:31:31 +02:00
Alex Trotsenko
ca0df4b269 Introduce QIODevice::skip()
[ChangeLog][QtCore][QIODevice] Added skip() method to improve
performance in read operations.

Change-Id: I79068a3e9df108756abe37ba3d431e27e7413621
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-27 06:17:09 +00:00
Orgad Shaneh
0f11fab6f7 Fix resolution of relative symlinks from relative path on unix
Consider the following:
/root/target - a file
/root/path/link -> ../target
/root/path/other/exe - executable

Running from /root/path/other.

exe is:

#include <QDebug>
#include <QFileInfo>

int main()
{
    qDebug() << QFileInfo("../link").symLinkTarget()
    return 0;
}

The link references /root/target, but the current output is
/root/path/target.

The link doesn't depend on the PWD. It depends on its own directory.

Change-Id: I61e95018154a75e0e0d795ee801068e18870a5df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-27 02:39:57 +00:00
Thiago Macieira
189e9c93d7 QTemporaryFile: Add support for Linux's O_TMPFILE
That means a file is never created, unless you ask for the name. There's
no chance of left-over temporary files being left behind. QSaveFile also
benefits from this, since the save file is not present on disk until
commit(). Unfortunately, QSaveFile must go through a temporary name
because linkat(2) cannot overwrite -- we need rename(2) for that (for
now).

[ChangeLog][Important Behavior Changes][QTemporaryFile] On Linux,
QTemporaryFile will attempt to create unnamed temporary files. If that
succeeds, open() will return true but exists() will be false. If you
call fileName() or any function that calls it, QTemporaryFile will give
the file a name, so most applications will not see a difference.

Change-Id: I1eba2b016de74620bfc8fffd14cc843e5b0919d0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-23 04:02:19 +00:00
Morten Johan Sørvig
d044b0b1e3 Remove timer checks from testQuitLock
This test sets up two timers:
	- a 100ms recurring timer
	- a series of 10 200ms single-shot timers.

After quitLock lets exec() return it then uses a signal
spy to check if the 100ms timer fired at least 17/20
of the times it should.

However there is no guarantee that the 100ms timer
will fire more often than the 200ms timer. If the
native timer callbacks happen at 500ms intervals then
Qt will fire both timers (once) at that interval.

In practice this seems to happen on macOS CI under
system load and/or with the test app napping.

The primary goal for the test is to verify that exec()
returns when it should; we can remove the timer signal
spy.

Remove testQuitLock from BLACKLIST.

Timely timer:

  524429311.389913 runLoopTimerCallback
  524429311.389979 200ms fire
  524429311.389997 100ms fire
  524429311.490056 runLoopTimerCallback
  524429311.490130 100ms fire
  524429311.589752 runLoopTimerCallback
  524429311.589929 200ms fire
  524429311.589976 100ms fire

Delayed timer:

  524429428.690887 runLoopTimerCallback
  524429428.691002 100ms fire
  524429428.691143 200ms fire
  524429433.692103 runLoopTimerCallback
  524429433.692205 100ms fire
  524429433.692331 200ms fire

Change-Id: Iff4faaa1de3741cf4e217949d5ed17d4e70c6af2
Task-number: QTBUG-61499
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-08-22 05:10:48 +00:00
Liang Qi
106d3b9bf9 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/plugins/platforms/cocoa/qcocoamenu.h
	src/plugins/platforms/cocoa/qcocoamenu.mm
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/widgets/styles/qstylehelper_p.h

Change-Id: I54247c98dd79d2b3826fc062b8b11048c9c7d9bb
2017-08-15 16:31:48 +02:00
Thiago Macieira
10b46fe474 Autotest: Fix test when running on a non-Unicode-capable locale
Like my default FreeBSD environment.

Change-Id: I3868166e5efc45538544fffd14d8a7f2dffa6ac9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-12 07:56:39 +00:00
Thiago Macieira
5d2240718c Autotest: fix blacklisted test about position on non-regular files
On BSD systems (tested on macOS and FreeBSD), you *can* lseek(2) or
ftell(3) on a pipe and get its current position. But QFile will not get
the position when the file is sequential, so we need to return 0.

Technically speaking, we ought to do the same for block devices, but if
you're redirecting stdin, stdout or stderr in the unit test to or from a
block device, you deserve the extra work to add that yourself to the
test.

Change-Id: I3868166e5efc45538544fffd14d8a74e92963fe7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-08-08 21:48:28 +00:00
Thiago Macieira
6504bc6bbc QFileInfo: harmonize QFileInfo() and QFileInfo("")
If a QFileInfo was constructed with an empty path, which could happen
with QFileInfo(QFile()) or via QDir, etc., then it would issue system
calls to empty paths and could even produce warnings. This commit makes
am empty path name be the same as a default-constructed QFileInfo and
corrects the use if 0 for ownerId and groupId to match the
documentation.

[ChangeLog][Important Behavior Changes] QFileInfo on empty strings now
behaves like the default-constructed QFileInfo. Notably, path() will now
be the empty string too, instead of ".", which means absoluteFilePath()
is no longer the current working directory.

Change-Id: I8d96dea9955d4c749b99fffd14ce34968b1d9bbf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-08 21:48:23 +00:00
Thiago Macieira
883dfb3d15 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/widgets/kernel/qwidget.cpp

This merge also extends the expected output of the pairdiagnostics
teamcity output (added in dev in commit
c608ffc56a) after the recent addition of
the flowId attribute to the teamcity output (commit
8f03656211 in 5.9).

Change-Id: I3868166e5efc45538544fffd14d8aba438f9173c
2017-08-08 11:48:10 +02:00
Thiago Macieira
6c3a3d498a Filesystem: Use "birth time" to avoid confusion with Unix ctime
The Unix stat fields "st_ctime" and "st_ctim" mean "change time", the
last time that the file/inode status fields were changed. It does not
mean "creation time". So this commit splits all of the internal API to
"birth" and "metadata change" instead of "creation" to avoid the
conflict.

Change-Id: I149e0540c00745fe8119fffd1463fe78b619649e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-05 16:41:38 +00:00
Thiago Macieira
261c6713bd Introduce QFileInfo::birthTime and metadataChangeTime
[ChangeLog][QtCore][QFileInfo] Deprecated created() because it could
return one of three different file times depending on the OS and
filesystem type, without the ability to determine which one is which. It
is replaced by metadataChangeTime() and birthTime().

[ChangeLog][QtCore][QFileInfo] Added QFileInfo::metadataChangeTime(),
which returns the time the file's metadata was last changed, if it is
known, and falling back to the same value as lastModified() otherwise.
On Unix systems, this corresponds to the file's ctime.

[ChangeLog][QtCore][QFileInfo] Added QFileInfo::birthTime(), which
returns the file's birth time if it is known, an invalid QDateTime
otherwise. This function is supported on Windows and on some Unix
systems.

Change-Id: I0031aa609e714ae983c3fffd1467bd8b3e3a593d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-08-05 16:41:32 +00:00
Thiago Macieira
4934138be2 Allow QSettings to synchronize non-atomically
This is required so that one can use QSettings in situations that
temporary files or renaming may not work.

[ChangeLog][QtCore][QSettings] Added setAtomicSyncRequired(), which
allows one to use QSettings with config files in unwriteable directories
or in Alternate Data Streams on NTFS on Windows. This used to work
before Qt 5.4, but remains a non-default behavior due to the potential
of data corruption.

Task-number: QTBUG-47379
Change-Id: I81480fdb578d4d43b3fcfffd14d4f77112f0402f
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2017-08-04 17:30:16 +00:00
Thiago Macieira
66500b9d75 Support Alternate Data Streams in QSaveFile
We can't use MoveFile to do atomic commits on an ADS, so QSaveFile needs
to detect when the target name is ADS and then use the direct fallback
mode.

[ChangeLog][QtCore][QSaveFile] Saving to Alternate Data Streams on NTFS
on Windows is now possible, but requires setDirectWriteFallback(true).

Task-number: QTBUG-47379
Change-Id: I81480fdb578d4d43b3fcfffd14d4bc062ae1750d
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2017-08-04 17:30:13 +00:00
Thiago Macieira
3d6cbe3409 Long live QTemporaryFileName!
So we can use it in QTemporaryFile, QTemporaryDir and QFile::rename()

[ChangeLog][QtCore][QTemporaryDir] The class now supports the "XXXXXX"
replacement token anywhere in the template, not just at the end. This
behavior is similar to what QTemporaryFile supports.

Change-Id: I1eba2b016de74620bfc8fffd14ccb645729de170
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-08-04 17:30:03 +00:00
Allan Sandfeld Jensen
74197140be Implement conversion from nullptr QVariant to QString and QByteArray
A nullptr QVariant should become a null QString or QByteArray,
since null strings have previous in our APIs represented the null value
in the absence of a dedicated null metatype.

Change-Id: I3b8f6386ece314d7c196959fbcf042c4fe0508a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:44 +00:00
Edward Welbourne
a9c111ed8c Clean-up in QDateTime's parsing of ISODate{,WithMs}
Actually check that there's a T where ISO 8601 wants it (instead of
just skipping over whatever's there), with something after it; move
some declarations later; add some comments; and use the QStringRef API
more cleanly (so that it's easier to see what's going on).  Simplify a
loop condition to avoid the need for a post-loop fix-up.

This incidentally prevents an assertion failure (which brought the
mess to my attention) parsing a short string as an ISO date-time; if
there's a T with nothing after it, we won't try to read at index -1 in
the following text.  (The actual fail seen had a Z where the T should
have been, with nothing after it.)

Add tests for invalid ISOdate cases that triggered the assertion.

Change-Id: Ided9adf62a56d98f144bdf91b40f918e22bd82cd
Reviewed-by: Israel Lins Albuquerque <israelins85@yahoo.com.br>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:35 +00:00
Allan Sandfeld Jensen
f2c6e10ad5 QVariants of null pointers should be null
Changes the QVariant::isNull() implementation for
pointer types so they return true if null.

[ChangeLog][QVariant] QVariants containing pointers will now return
true on isNull() if the contained pointer is null.

Change-Id: I8aa0dab482403837073fb2f376a46126cc3bc6b2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:25 +00:00
Thiago Macieira
b12fd1fa9d Long live qEnvironmentVariable()
[ChangeLog][QtCore] Added qEnvironmentVariable, which returns the value
of an environment variable in a QString, while qgetenv continues to be
used to return it in a QByteArray. For Unix, since most environment
variables seem to contain path names, qEnvironmentVariable will do the
same as QFile::decodeName, which means NFC/NFD conversion on Apple OSes.

I opted not to #include <qfile.h> from qglobal.cpp to implement that
QFile::decodeName functionality, so qglobal.cpp doesn't depend on
corelib/io and to avoid possible recursions.

Task-number: QTBUG-41006
Change-Id: I14839ba5678944c2864bffff141794b8aaa7aa28
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:13 +00:00
Oswald Buddenhagen
d61ac601d8 unbreak tst_qresourceengine for prefix builds
don't try to execute a binary from the install dir.

amends 8e776d39f.

Change-Id: I37990bc83b295379f0c93f4ca712e1bbf980fd44
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-08-03 04:54:56 +00:00
Frederik Gladhorn
6c2bfbf88e Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev 2017-08-02 23:15:27 +00:00
Morten Johan Sørvig
e44ff19783 Add QThreadPool::stackSize
Allows setting the stack size for the thread pool
worker threads. Implemented using QThread::stackSize.

Task-number: QTBUG-2568
Change-Id: Ic7f3981289290685195bbaee977a23e0c3c49bf0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-08-02 21:58:54 +00:00
Allan Sandfeld Jensen
bef7e4a222 Allow conversion of QVariants with real null values
Update documentation to be clearer on the special null variant state
with no value as opposed to a variant with a null value, and only block
conversions of the former.

Change-Id: I24fd50285414e049de87de54a63700a89bd5adf1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-02 21:09:19 +00:00
Oswald Buddenhagen
ee07b912a1 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/plugins/platforms/xcb/qxcbconnection.h
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
	src/plugins/styles/mac/qmacstyle_mac.mm
	src/widgets/widgets/qdockarealayout.cpp
	src/widgets/widgets/qmainwindow.cpp
	src/widgets/widgets/qmainwindowlayout.cpp
	src/widgets/widgets/qmainwindowlayout_p.h
	tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
	tests/auto/other/macnativeevents/BLACKLIST
	tests/auto/widgets/widgets/qmenu/BLACKLIST

Change-Id: Ic8e724b80a65e7b1af25511b0e674d209265e567
2017-08-02 22:52:32 +02:00
Edward Welbourne
60a9747bb5 Add a date-time test for time-zones near epoch and odd transitions
Check we do handle DST after epoch and don't before.
Check we do notice various unusual transitions.
Check we do handle non-whole-hour-offset zones.
(Unfortunately, MS-Win lacks data for some of the zones and is wrong
about the two date-line crossers, so we skip those for it.)

Change-Id: If420d61b9db7f914ca25c22297c16e917ad2307a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-31 09:24:31 +00:00
Joerg Bornemann
85403d0af0 Support more than 62 instances of QWinEventNotifier, take 2
QWinEventNotifiers were limited to 62 instances, because of
WaitForMultipleObject's limitation to MAXIMUM_WAIT_OBJECTS - 1 handles.

Use the RegisterWaitForSingleObject API which does not have this
restriction and executes waits in threads managed by the system. A
central manual reset event per event dispatcher is signaled in the
RegisterWaitForSingleObject callback and waited for in the event loop.

Task-number: QTBUG-8819
Change-Id: I3061811c18e669becf9de603bbdd7ba96e4d2fcd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-07-30 19:11:49 +00:00
Friedemann Kleint
3bdd59920f Refactor tst_qdir::entryList()
Split the test in two: one test that requires the symlinks
and test files and one that does not need them.
In the test with test files, verify each step and the deletion
of the files.

Task-number: QTBUG-58654
Task-number: QTBUG-50835
Change-Id: I14de57ce7a1df2d834d5a7565c804dead1d89088
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-29 09:51:50 +00:00
Edward Welbourne
8b628bb251 Add test for time zone transitions near the epoch
This needs a zone with transitions near the epoch; and the only CET
with DST that winter was Italy (copied by Malta), for which the Olson
database had a recent (2016) correction to its data, for that winter.
That means we get inconsistent results on O/Sen of different ages.

So add a separate testEpochTranPrivate(), alongside testCetPrivate(),
and test it with America/Toronto.  (Unfortunately, MS-Win gets the
date wrong on the first transition after the epoch, so we have to code
round that.)

Since information before the epoch isn't reliably available, only test
the search backwards if nextTransition does find something before it.
(We can safely assume all real transitions happened since 1601;
non-celestial time-keeping wasn't accurate enough, before that, for
anyone to synchronize with anything but celestial time.)

Change-Id: I984b46938a2805b93bb2afd6855e317b5d66b386
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-28 08:14:36 +00:00
Thiago Macieira
15df77f683 Fix use of getentropy on larger blocks
Found while working on suppressing the warning about the return value
(which is either 0 or -1) was being ignored.

Task-number: QTBUG-61968
Change-Id: I02d22222fff64d4dbda4fffd14d148b1724547ca
Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-27 23:19:05 +00:00
Thiago Macieira
7c45c6a3c4 Revert "Make QFile::open fail when using an invalid file name"
This reverts commit 346cd79192. The bug
report was incorrect, since the suggested file name is actually valid,
it just happens to name an Alternate Data Stream (ADS) "20:803Z.txt" in
file "testLog-03".

[ChangeLog][QtCore][QFile] Reverted an incorrect change from Qt 5.9.0
that forbade the creation and access to Alternate Data Streams on NTFS
on Windows. This means that file names containing a colon (':') are
allowed again, but note that they are not regular files.

Task-number: QTBUG-57023
Change-Id: I81480fdb578d4d43b3fcfffd14d4f2147e8a0ade
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2017-07-27 15:42:55 +00:00
Jüri Valdmann
af7e756155 Return "en" for QLocale::c().bcp47Name()
Currently QLocale::c().bcp47Name() returns "C" which, according to [BCP47], is
not a valid language tag. In particular it does not conform to the ABNF grammar
in section 2.1 which specifies a minimum length of 2 characters for all language
tags.

[BCP47]: https://tools.ietf.org/html/bcp47

This patch changes the return value to "en" seeing as the documentation for
QLocale::Language states that the C language is identical in behavior to
English.

Task-number: QTBUG-61949
Change-Id: I2a381def8fb7156467e01d105da92bb1f4821204
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-07-26 08:22:51 +00:00
Jüri Valdmann
2031196ad1 Add test for QLocale::bcp47Name()
Task-number: QTBUG-61949
Change-Id: I34fece0441afb1e69ea84ae59b90c5e2b7cf133f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-26 08:22:43 +00:00