Commit Graph

1806 Commits

Author SHA1 Message Date
Gabriel de Dietrich
8ee9774e67 Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4 2014-10-01 16:21:12 +02:00
Kai Koehne
d78fb442d7 Logging: Disable tracking of debug source info for release builds
Tracking the file, line, function means the information has to be stored
in the binaries, enlarging the size. It also might be a surprise to some
commercial customers that their internal file & function names are
'leaked'. Therefore we enable it for debug builds only.

[ChangeLog][QtCore][Logging] File, line, function information are not
recorded anymore for logging statements in release builds. Set
QT_MESSAGELOGCONTEXT explicitly to enable recording in all configurations.

Change-Id: I454bdb42bcf5b5a8de6507f29f2a61109dca9b91
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
2014-10-01 16:06:27 +02:00
Gabriel de Dietrich
8ab25620d3 Merge remote-tracking branch 'origin/5.3' into 5.4
Conflicts:
	src/network/socket/qnativesocketengine_unix.cpp
	src/widgets/kernel/qwidget_qpa.cpp

Change-Id: I6f1aa320d5ca66cd92d601a95885aeaab0abb191
2014-09-29 13:38:11 +02:00
Thiago Macieira
0c32af08a6 Fix handling of IPv6 addresses in QUrl::fromUserInput
IPv6 addresses can start with ":", for which QDir::isAbsolute() would
always return true (QResourceFileEngine::isRelativePath() returns
constant false) and would trip the calculation for local files.

Similarly, IPv6 addresses can start with strings that look like Windows
drives: "a:", "b:", "c:", "d:", "e:" and "f:" (though not today, as
those address blocks are unassigned). Since a valid IPv6 address will
definitely require at least one more colon and Windows file names cannot
contain ':', there's no ambiguity: a valid IPv6 address is never a valid
file on Windows.

This resolves the ambiguity in favor of IPv6 for Unix filenames (which
can contain a colon) and in case of an URL containing scheme, relative
path and no authority ("dead:beef::" for example could have been parsed
as scheme() == "dead" and path() == "beef::").

Task-number: QTBUG-41089
Change-Id: Id9119af1acf8a75a786519af3b48b4ca3dbf3719
Reviewed-by: David Faure <david.faure@kdab.com>
2014-09-28 01:28:29 +02:00
Oliver Wolff
eedefa28bd Refactored qt_normalizePathSegments
There were several use cases that did not work with the old
implementation and it was not really readable.

Task-number: QTBUG-3472
Task-number: QTBUG-40067
Task-number: QTBUG-23892
Change-Id: I1e038792dc54cdc6f8d9bb59d80b11dd3c56fac6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-09-25 16:16:59 +02:00
Matti Paaso
974c210835 Update license headers and add new license files
- Renamed LICENSE.LGPL to LICENSE.LGPLv21
- Added LICENSE.LGPLv3
- Removed LICENSE.GPL

Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2
Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
2014-09-24 12:26:19 +02:00
Eike Ziller
3ea0020d3b Abstract proxy model: Add missing delegation of supportedDragActions
Change-Id: I4d2519aaa46d3ca075330c6680dd3672249cbefe
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-09-24 10:37:59 +02:00
Frederik Gladhorn
c96426f19f Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4 2014-09-24 12:04:52 +02:00
Marc Mutz
1ce6e432b6 QVersionNumber: correctly fail for numerically very large segments
The result of qstrtoull() was unconditionally truncated to an int,
resulting in wrong values being appended to the segments vector
when the numerical segment value was above INT_MAX.

Prevent this by first checking the return value of qstrtoull
as a qulonglong for values larger than INT_MAX and stopping
processing in that case. That means that segments that
numerically overflow an int are now considered part of the
suffix.

Also added tests for the case where a segment value is larger
than ULLONG_MAX. That was already working correctly.

Change-Id: Ia4b89021dcfe6bfae27c8d89bb678ec5e0e3b847
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-09-23 20:42:01 +02:00
Thiago Macieira
d554fa6fdc Add unit tests for cleaning up nested functions
I think supporting them now is too complex for the Qt code. We would
probably need to rewrite the parser using a tokenizer so we can find the
right name of the function. Just skipping backwards breaks the support
for returning function pointers and PMFs.

Change-Id: I78636437ecd46d77e6b9b013b2f2668cca1b6cd6
Reviewed-by: David Faure <david.faure@kdab.com>
2014-09-23 17:44:22 +02:00
Friedemann Kleint
a1a678078e Fix MSVC source code encoding warnings in tst_qtjson.
tst_qtjson.cpp(2711) : warning C4566: character represented by universal-character-name '\u2090' cannot be represented in the current code page (1252)
tst_qtjson.cpp(2712) : warning C4566: character represented by universal-character-name '\u2090' cannot be represented in the current code page (1252)
tst_qtjson.cpp(2713) : warning C4566: character represented by universal-character-name '\u2090' cannot be represented in the current code page (1252)

Task-number: QTBUG-41100
Change-Id: I193dc48236bdd3857657a5684178630f0e1dab6d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-09-23 17:04:15 +02:00
Christian Kandeler
e66a878838 QSettings: Don't chop off trailing tabs that were actually part of a value.
This was done wrong when using the ini format.

Task-number:  QTBUG-22461
Change-Id: Ib9390460bce6138659cceac7e3cd25339ba5e9bb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-09-23 11:28:58 +02:00
Frederik Gladhorn
c5a3e5edd9 Merge remote-tracking branch 'origin/5.3' into 5.4
The isAlwaysAskOption was removed in 3862171315
so manually removed code in
src/plugins/bearer/connman/qconnmanengine.cpp

Conflicts:
	src/corelib/global/qglobal.h
	src/corelib/tools/qcollator_macx.cpp
	src/corelib/tools/qstring.cpp
	src/gui/kernel/qwindow.cpp
	src/gui/kernel/qwindow_p.h
	src/gui/text/qtextengine.cpp
	src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h
	src/plugins/platforms/android/qandroidinputcontext.cpp
	src/plugins/platforms/xcb/qglxintegration.cpp
	src/plugins/platforms/xcb/qglxintegration.h
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	src/testlib/qtestcase.cpp
	src/testlib/qtestlog.cpp
	src/widgets/dialogs/qfiledialog.cpp
	src/widgets/kernel/qwindowcontainer.cpp
	tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
	tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
	tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
	tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp

Change-Id: Ic5d4187f682257a17509f6cd28d2836c6cfe2fc8
2014-09-23 11:23:36 +02:00
Lars Knoll
10414444e1 Add support for blacklisting test functions
We need to have a finer grained control over the tests
we skip in our CI system. This adds a blacklisting
mechanism that allows blacklisting individual test
functions (or even test data) using a set of predefined
matching keys for the operating system and some other
relevant variables.

QTestlib will search for a file called BLACKLIST in the test
directory and parse it if found. The file contains a simple
ini style list of functions to blacklist. For details see
qtestblacklist.cpp.

Change-Id: Id3fae4b264ca99970cbf9f45bfb85fa75c1fd823
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-09-21 20:58:41 +02:00
Allan Sandfeld Jensen
294e65f809 QVariant::compare shouldn't return match when QVariant::cmp does not
If the types doesn't match in QVariant::compare we do a comparison based
on QString, this may end up indicating a full match, though the we don't
match according to cmp. In this case it would be better if we preserved
the non-matching to avoid breaking ordering.

[ChangeLog][QtCore][QVariant] Fixed ordered comparison between QVariants
that do not match but produce identical toString output.

Task-number: QTBUG-40363
Change-Id: I84a8eca11e8875dba9948bde2906ae7c5aa35704
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-09-11 23:05:35 +02:00
Jędrzej Nowacki
fa9a407b9f Revert "Reading QJsonObject property should not modify the object itself."
This reverts commit 20cf632ad5. The commit
produced to many problems during statics destruction. For example
causing QtCreator crash (QTBUG-40987).

Change-Id: Ib52f6a449c2d84deab2de792559a6a065ca45e8d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-09-11 10:54:42 +02:00
David Faure
7b9f7f3891 QLockFile: on Windows, retry deleting the lock file if it is being read.
A "sharing violation" happens when trying to delete the lock file and another
thread/process is reading it at that very moment. Detect the error and try again,
up to 10000 times - to avoid an infinite loop if QFile::remove fails for another
reason such as a sudden change of permissions preventing us from deleting our
own lock file.

On Unix the deletion can't fail because of readers, but it doesn't hurt
to check the return value there too, to catch other reasons for failures
such as a sudden permission change.

Task-number: QTBUG-38853
Change-Id: Icf12a74faed4a4916e3427abc09d9c33aa141476
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-09-11 00:17:33 +02:00
Lars Knoll
c17563eca8 Fix several issues in QCollator
Refactor the code and move more things into the cross platform
code path.

Make sure the flags survive changing the locale of QCollator.
Use the correct locale on Windows, WinRT and OS X. We now
pass all QCollator autotests on these platforms.

Task-number: QTBUG-40778
Change-Id: Ic2d3334b5018c323a35a3ea8fc1d7ab5f99b4e62
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-09-10 21:11:11 +02:00
Lars Knoll
6316a681f3 Fix user defined conversions to numeric types
The old code was completely broken. It did dereference
val for user types, but val does in this case only contain
garbage. Instead use the pointer to the correct data.

Change-Id: I20ccf0bfa3dd3774c787d08c51cc8dd7b1ec9a1a
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-09-10 21:10:57 +02:00
Lars Knoll
df25927a68 Don't accept json strings with trailing garbage
A well formed JSON document is not allowed to contain
trailing garbage at the end. Don't accept this in the
parser.

Task-number: QTBUG-40062
Change-Id: I0a09dbd099a8c643f58023342546c4e67d026fec
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-09-10 21:10:45 +02:00
Lars Knoll
853845a4a2 Fix bugs in internal comparison operators
The comparison operators between QJsonPrivate::String
and QJsonPrivate::Latin1String weren't all correct, leading
to wrong sorting of keys in QJsonObjects when the keys were
outside of the latin1 range and resulting lookup errors.

Task-number: QTBUG-41100
Change-Id: Idceff615f85d7ab874ad2a8e4a6c1ce8c2aa0f65
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-09-10 21:10:35 +02:00
Alex Trotsenko
e35841e374 Fix endianness part of QSysInfo::buildAbi() string
Both Q_LITTLE_ENDIAN and Q_BIG_ENDIAN macros are always defined
on all architectures. So, byte order detection results in
"little_endian" value for big endian systems. Test the system
endianness in a right way, according to Q_BYTE_ORDER macro
documentation.

Change-Id: I5523f90567e78d679a3ff2902a8f5377ed39ceb1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-09-04 18:31:50 +02:00
Robin Burchell
3006bd2d44 Make QElapsedTimer default to invalid (and now non-POD).
The practical uses of a POD QElapsedTimer are not really that clear, and the
number of misuses of this API are quite high. Default the state to invalid to
prevent against mistakes.

[ChangeLog][QtCore][QElapsedTimer] Is no longer a POD.

Change-Id: I267292acf2bfca7404e3e449dd04410441d7ce26
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-09-03 13:19:35 +02:00
Jędrzej Nowacki
918038ad57 Mark QByteArrayList as metatype built-in type.
As a side effects it also adds core templates types to the tests

Change-Id: I0e3338e0bffdf21982aa83d404c83288e54411f4
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-08-28 10:13:04 +02:00
Allan Sandfeld Jensen
7dce962200 Add operator-> to QJson iterators
The iterators for QJsonArray and QJsonObject are currently lacking an
operator-> definition. Unfortunately it is not possible to do in clean
way without redefining either the iterators or QJsonValueRef class.

This patch instead adds two fake pointer classes that are only used
to handle the operator-> return value.

Task-number: QTBUG-29573
Change-Id: Ief785a6afbbedc9e89cf3b6f3958c2c755997a66
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-08-25 16:03:42 +02:00
Timur Pocheptsov
6b6e51e5ab OS X - QCollator::compare() returns wrong results.
kUCCollateDigitsAsNumberMask works only if kUCCollateDigitsOverrideMask
is also set.
Update 0: - test added.
Task-number: QTBUG-40777
Change-Id: I48bfec78f5f8439a51f8d749f0fc4397a72b29f2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-08-19 17:53:36 +02:00
Maurice Kalinowski
2ffcf3a423 WinRT: Fix QSettings auto-tests
WinRT is a sanboxed environment, hence files can only be created in
some writable location.
For some tests we reset the current directory to minimize the required
changes. We cannot do this for the application lifetime as the test
also has cases where it reads files relative to the executable inside
the sandbox.

Change-Id: Ib9d37c8cffd191f0d1055f835c11d10887923378
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
2014-08-19 08:58:01 +02:00
Giuseppe D'Angelo
75b62f3a17 Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4 2014-08-19 00:42:00 +02:00
Thiago Macieira
4848796f3e Make sure we don't cache old file sizes prior to new writes
If we write to a file, its size changes. We should drop previous size
caches.

Change-Id: Ib687c91e5fc88cab588c89023f23da9622160da9
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
2014-08-13 16:36:11 +02:00
Ivan Komissarov
6c3c1a4cb8 Add the QStorageInfo class
Allows to retrieve information about mounted volumes such as label,
total/available size, filesystem type and so on.
Possible use cases are:
- allows to do checks about filesystem before performing actual
  operation (such as available/maximum volume size)
- allows to retrive information about volume that can be shown in file
  dialogs
- allows to retrieve volume for specific path and check if two or more
  paths belong to the same volume or not

[ChangeLog][QtCore] Added QStorageInfo class to retrive information
about mounted volumes and drives

Change-Id: Ibf9c2e6b53ef39c5605894a4422acdbbca4030c4
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
2014-08-13 16:09:58 +02:00
Maurice Kalinowski
091653e9e7 Implement native settings format for WinRT
WinRT stores settings inside the app bundle, not in the registry.
Some tests are not fully functional due to errors in the file
implementation (See QTBUG-40588).

QSettings::SystemScope translates to a roaming container on WinRT,
meaning that settings stored inside there should be uploaded and
shared among devices. However, this is untested so far.

The tests have been updated for those platforms which do not store
the order of keys. This has been done on some locations only so
far, but needed to be done on more places for WinRT.

Task-number: QTBUG-33498
Change-Id: Ifd0194387b09c220d31812b4b6fd0ce9a7d84d24
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
2014-08-13 09:40:56 +02:00
Frederik Gladhorn
ca524e5b70 Merge remote-tracking branch 'origin/5.3' into 5.4
Manually included changes from
3a347a4e70
in src/opengl/qgl.cpp.

Conflicts:
	src/opengl/qgl_qpa.cpp
	src/plugins/platforms/android/androidjnimain.cpp

Change-Id: Ic26b58ee587d4884c9d0fba45c5a94b5a45ee929
2014-08-12 13:05:02 +02:00
Olivier Goffart
c2badc7423 Fix disconnect()ing from signals declared in a base class
Fix disconnection from pointer to member signal that belongs to the base
class, but whose type is a pointer to a member of the derived class.

Commit 9cc106d9d7 fixed connect, so apply
the same fix in disconnect

[ChangeLog][QtCore][QObject] Fixed disconnecting from pointer to member
signal that belongs in the base class but whose type is explicitly given
as a pointer to a member in the derived class

Task-number: QTBUG-40638
Change-Id: Ia546fc8f36e1ea0dd0645bdd820aea47f43677ac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-08-11 16:49:01 +02:00
Thiago Macieira
e319196f76 Ensure that qCleanupFuncinfo works with some C++11 new constructs
This commit adds tests for ref-qualified member functions, the new
syntax for functions and decltype.

__PRETTY_FUNCTION__ for lambdas varies wildly between compilers and will
produce really bizarre results after cleanup. It's not tested and is
known to be broken.

Change-Id: I70c8dbcba54790357cecba35aa45c5cc672f29d1
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-08-09 15:35:59 +02:00
Marc Mutz
e41b45f1ae QPair: add constexpr liberally
On templates, adding constexpr makes a given instantiation constexpr
if it can be.

This turns qMakePair(0,0), say, into a compile-time constant.

The effects on existing code are small, but exist:

  $ size lib/*{-baseline,-paircexp} | sort -nr
  6516727  211192    2608 6730527  66b31f lib/libQt5Widgets.so.5.4.0-baseline
  6516711  211192    2608 6730511  66b30f lib/libQt5Widgets.so.5.4.0-paircexp
  5373720   44492   15976 5434188  52eb4c lib/libQt5Core.so.5.4.0-baseline
  5373504   44492   15976 5433972  52ea74 lib/libQt5Core.so.5.4.0-paircexp
  5107206  125072    6080 5238358  4fee56 lib/libQt5Gui.so.5.4.0-baseline
  5107030  125072    6080 5238182  4feda6 lib/libQt5Gui.so.5.4.0-paircexp
  1341290   30180    2600 1374070  14f776 lib/libQt5Network.so.5.4.0-baseline
  1341210   30180    2600 1373990  14f726 lib/libQt5Network.so.5.4.0-paircexp
  # no other libraries benefit

[ChangeLog][QtCore][QPair] Can now be used in C++11 constexpr contexts.

Change-Id: I3872e6aa33a7d02a168516f4dfa7119efcac8c40
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-08-09 09:06:16 +02:00
Thiago Macieira
dcf9883dff Move the special QByteArrayList methods into QList
and make QByteArrayList be a simple typedef.

As a side-effect, the constructor taking a QByteArray is no longer
available since I couldn't find a way to add it to QList<T> when T is
QByteArray. My template-foo failed me. I tried:

 - QEnableIf<is_same<T, QByteArray>::value, QByteArray>::type
   => makes QList fail to compile for any T that isn't QByteArray
 - make the constructor a template member
   => it compiles if the parameter is a QByteArray, but not a const
      char[4] like the test was
 - inheriting constructors
   => runs into ICC and Clang bugs that I could not work around

Besides, the constructor with std::initializer_list is a superior
solution anyway.

Change-Id: Ic86fbadc1104142bfd907a5c4147199bf839fb89
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-08-09 09:05:43 +02:00
Glen Mabey
35105f173e Long live QByteArrayList!
Initial submission of a new class QByteArrayList with the
purpose of aggregating and then joining QByteArray instances.

[ChangeLog][QtCore] Added new QByteArrayList class.

Done-with: Marc Mutz <marc.mutz@kdab.com>
Change-Id: I503af58f125d7f44fef10360177490c933e5840f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-08-09 09:01:41 +02:00
Keith Gardner
a332322de9 Long live QVersionNumber!
The class provides compare operators, stream operators, and hashing
functions. This class aims to be compatible with (but not restricted to)
the Semantic Versioning 2.0 standard (semver.org).

[ChangeLog][QtCore] Added QVersionNumber class

Done-with: Marc Mutz <marc.mutz@kdab.com>
Change-Id: I244c8ccc002909af03987a2df052734d1a8621a9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-08-09 09:00:24 +02:00
Marc Mutz
7f78d547ca QCommandLineParser: support extremely concise option configuration in C++11
The goal of this commit to make the code in the test work:

    QCommandLineParser parser;
    parser.addOptions({
        { "a",                "The A option." },
        { { "v", "verbose" }, "The verbose option." },
        { { "i", "infile" },  "The input file.", "value" },
    });

For this, QCommandLineParser needs a version of addOption that can
take a list of options. That's what addOptions() is for.

More importantly, the QCommandLineOption ctors mustn't be explicit.
OTOH, any implicit conversion from QString or QStringList to
QCommandLineOption is also undesirable.

To solve this dilemma, add new QCommandLineOption ctors that just
take one argument and are explicit, and make the existing ctors
implicit. In order to avoid ambiguities, remove the default values
of their resp. 2nd arguments. The new ctors are by intention not
\since 5.4, as they are completely transparent to the user.

Et voila, even better than getopt_long(3).

[ChangeLog][QtCore][QCommandLineParser] Added addOptions() method.

Change-Id: I5e779f3406cd0f6c8ec6ecbf6c8074af226de300
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-08-06 22:17:22 +02:00
Jędrzej Nowacki
1fceabe8c7 Implement QStringRef::split
[ChangeLog][QtCore] Added the QStringRef::split() function

Change-Id: I28709c9761785dea7be4e7d621ecf4e1ae007a72
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-08-06 14:04:40 +02:00
Peter Kümmel
4124cd159e Undo: Fix state entry bug for parallel state groups
This commit reverts c4cef6fae9.
The above fix for QTBUG-25958 (cloned in QTBUG-40219) is not
complete and introduces the regression QTBUG-30049.

Task-number: QTBUG-30049, QTBUG-25958, QTBUG-40219
Change-Id: I3c4b774dce06c13cb4e089f8413a7747cedfd212
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-08-06 07:21:18 +02:00
Marc Mutz
c55aec2ed7 QFutureInterface: allow to work with a QThreadPool != globalInstance()
Background:
It is often necessary/advisable to schedule tasks on thread pools !=
globalInstance(). As Herb Sutter writes in
http://www.drdobbs.com/parallel/use-thread-pools-correctly-keep-tasks-sh/216500409
and the Qt Training Material stresses, tasks you schedule on a (global)
thread pool should be non-blocking, which currently rules out using any of
the QtConcurrent functions for, say, file I/O.

Nonetheless it's often convenient to have thread pools also for file I/O, as
the thumbnail viewer exercise in the Qt Training Material shows. In this
case, you'd use a dedicated thead pool, leaving the global thread pool for
CPU-bound tasks.

Yet, none of the QtConcurrent functions allow to pick the QThreadPool
instance on which to schedule the work created with them.

This patch prepares for them to do so.

This is the first part of the forward-port of
https://qt.gitorious.org/qt/qt/merge_requests/1281.

Implement by using a new QThreadPool* member that defaults to nullptr,
and adding setThreadPool to set this member, then using it in lieu of
QThreadPool::globalInstance() everywhere.

I chose to leave m_pool == nullptr to mean globalInstance() to avoid
creating the global instance whenever a QFuture is created, even if the
future represents the result of a calculation not run on the global thread
pool.

[ChangeLog][QtCore][QFuture] Can now be used with any QThreadPool, not
just globalInstance().

Task-number: QTBUG-17220
Change-Id: I4e1dc18d55cf60141b2fa3d14e2d44a3e9e74858
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-08-05 18:04:56 +02:00
Marc Mutz
54a4488ca5 tst_QHash: check which of several equal keys is inserted
Add a test that checks that QHash keeps the first of the keys
that compare equal. This may or may not be documented, but is
inconsistent with the values in a QHash, where the last element
with equal key is kept.

Document this as a test. That way, we'll be informed when the
behavior changes (e.g. by a port to std::unordered_map).

Do the equivalent checks in tst_QMap, too. There, of course,
instead of equal keys, check equivalent ones.

Change-Id: I2c5f04f8e8a6bbc7dbaadadd878a4c876e4df042
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-08-05 18:04:46 +02:00
Olivier Goffart
27b67c5399 Logging: use the known function when the first frame of the backtrace is unknown
Change-Id: Ia591805c82e7bf77dc7af04f1054c7daca58eb6a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-08-05 16:52:34 +02:00
Marc Mutz
e1fed5dc31 tst_QSet: check which of several equal elements is inserted
Add a test that checks that QSet keeps the first of the elements
that have equal value. This is documented, but inconsistent with
values in a QHash, which keeps the last element with equal key.

Document this as a test. That way, we'll be informed when the
behavior changes (e.g. by a port to std::unordered_set).

Change-Id: I4ca1718bb86599b925b3ccd13b0856917cd4ce67
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-08-05 00:02:26 +02:00
Marc Mutz
ce6a949c79 tst_QTimeZone: test QTimeZonePrivate::isValidId()
This is in preparation of rewriting the function for efficiency.

Change-Id: Id5c16b984b95d76e1f26d862e3813f75980f44fb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-07-31 21:05:07 +02:00
Jędrzej Nowacki
f5c3126201 Add QString::splitRef functions.
The functions can be used to optimize code that do not need to use
the split results as QString directly.

[ChangeLog][QtCore] QString can now split a string to a list of
QStringRef.

Change-Id: Ic2dc929e1fba82f9a060e37c51068a301cb5b866
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-07-31 08:50:22 +02:00
Frederik Gladhorn
4010cfbf2d Merge "Merge remote-tracking branch 'origin/5.3' into dev" into refs/staging/dev 2014-07-30 22:52:15 +02:00
Thiago Macieira
5d11688d02 Fix QByteArray::to{Upper,Lower} when the array contains embedded nulls
[ChangeLog][QtCore][QByteArray] Fixed a bug that would cause QByteArray
to stop converting toUpper or toLower at the first embedded null
character.

Change-Id: Ia369037206617813d86a8f1489589243c82aa51b
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2014-07-30 19:48:41 +02:00
Kai Koehne
5b0be0c217 QDebug: Improve QDebug stream operator for QFlags
Use the built-in hex, showbase manipulator to format the number in
hex. Also, apply nospace() only once.

Change-Id: Id4b3d5f082ad13f52c8711408d7ec609bec3a621
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
2014-07-30 16:27:33 +02:00