Commit Graph

3411 Commits

Author SHA1 Message Date
Liang Qi
58437fb125 Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
	src/corelib/serialization/qcborcommon.h
	src/corelib/tools/qlocale_data_p.h
	tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp

Done-with: Edward Welbourne <edward.welbourne@qt.io>
Change-Id: Ibed987f6d77a0294f78f67d78625237616082416
2018-11-10 11:38:40 +01:00
Thiago Macieira
e7998dc187 QCborStreamReader: make sure setDevice() clears the last error
The unit tests weren't running into this problem because the every
setDevice() was preceded by the object being initialized with the exact
same data, so there was never a previous error state. I've only changed
a couple of tests, left the other setDevice() unchanged so we test both
behaviors.

Fixes: QTBUG-71426
Change-Id: I1bd327aeaf73421a8ec5fffd1561a590e3933376
Reviewed-by: Nils Jeisecke <nils.jeisecke@saltation.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-11-08 15:19:45 +00:00
David Faure
fc88dd52a4 QByteArrayList: add indexOf(const char*) overload
This avoids memory allocation and data copying in e.g.
QObject::property().

Detected by heaptrack's "Temporary allocations" counter in an
application using the breeze widget style (many animations).

Change-Id: Iabdb58a3e504cb121cce906ef707b0722de89df6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-11-06 09:49:10 +00:00
Qt Forward Merge Bot
79c5c68dca Merge "Merge remote-tracking branch 'origin/5.12' into dev" into refs/staging/dev 2018-11-06 00:01:16 +00:00
Qt Forward Merge Bot
290aac23a7 Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: Id1e4664d3c942226b76e2c3b338df3116ff89297
2018-11-06 01:00:56 +01:00
Luca Beldi
6963efb396 New proxy model: QTransposeProxyModel
Implemented a new proxy model to transpose the source model.
Rows will become columns and vice-versa.
Both flat and tree models supported.

[ChangeLog][QtCore] New class QTransposeProxyModel to
swap rows and columns of the source model.

Change-Id: I902963c6b81aa0f63b5ad2bddca538f28b565084
Reviewed-by: David Faure <david.faure@kdab.com>
2018-11-05 23:53:01 +00:00
Christian Ehrlicher
e9bebc1281 Fix use of deprecated ItemDataRoles Background/TextColorRole
Replace BackgroundColorRole/TextColorRole with
BackgroundRole/ForegroundRole and explicit deprecate them for 5.13

Change-Id: I6b0d99844a32d2f5fdfd1878317a7b7422b800d3
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2018-11-05 21:58:37 +00:00
Gary Wang
e3c84b6da1 QMimeType: Use default key as fallback for comment() property
When QMimeProvider parses the shared mime database xml files,
it will read the <comment> element for mime comment and treat the
`xml:lang` attribute as locale language string. When no `xml:lang`
attr is provided, QMimeProvider will read the value and treat it as
a en_US locale string as the default key.

When we call QMimeType::comment(), it will try to get the locale
comment string with the default language (QLocale().name()), once
it can't find a matched result, it should return the default key
(which QMimeProvider set it as en_US locale before) as fallback.

Task-number: QTBUG-71314
Change-Id: I444f8159d6f19dfef6338cd79312f608d8f13394
Reviewed-by: David Faure <david.faure@kdab.com>
2018-11-02 08:27:10 +00:00
Allan Sandfeld Jensen
00674a1643 Treat shorts as int in QVariant::canConvert()
Follow the pattern of char and float, and treat shorts as a more generic
type in QVariant::canConvert()

Task-number: QTBUG-60914
Change-Id: Ib1cc7941ee47cb0fc0098f22f98a03cd6f6b63fe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-11-01 17:31:13 +00:00
Edward Welbourne
779a73762d Fully support operator[] on QCborValue and QCborValueRef
Added operator[] to QCborValueRef and mutating operator[] both there
and in QCborValue.  If the value (referenced) is not a container, it
is replaced with a map and a reference into the result is returned.
If the value is an array and the key is a string, negative, or more
than 0xffff, the array is first converted to a map.

Change-Id: Ibbc9e480fb25eb3d05547c8a1b99e762b2a68b68
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-11-01 15:02:46 +00:00
Qt Forward Merge Bot
f09fc1f352 Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I6f8d3abd3247dc980dc7834801a017a89c8f4286
2018-11-01 01:01:28 +01:00
Kari Oikarinen
a952fd7d5b QObject: Fix isSignalConnected() when signals have been disconnected
The bitmap cache for the first 64 signals being connected was only set when the
connection is added. It was never unset when the connection was removed.

Internal use of the connectedSignals bitmap is not hurt by it occasionally
saying a signal is connected even though it is not, since the purpose of those
checks is avoiding expensive operations that are not necessary if nothing is
connected to the signal.

However, the public API using this cache meant that it also never spotted
signals being disconnected. This was not documented. Fix the behavior by only
using the cache if it is up to date. If it is not, use a slower path that gives
the correct answer.

To avoid making disconnections and QObject destructions slower, the cache is
only updated to unset disconnected signals when new signal connections are
added. No extra work is done in the common case where signals are only
removed in the end of the QObject's lifetime.

Fixes: QTBUG-32340
Change-Id: Ieb6e498060157153cec60d9c8f1c33056993fda1
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2018-10-31 10:32:41 +00:00
Jüri Valdmann
497f43c90f tst_QCborValue: Disable support for spaceship operator
Spaceship operator was disabled for QCborValue, but not the test.

Change-Id: Icb91da689f62ef6de9f4fa926346505c5e50e9eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-10-31 09:46:11 +00:00
Oliver Wolff
7e7514482f winrt: Skip a test row of tst_QRegularExpression::threadSafety
PCRE2 does not support JIT on winrt. This test row takes a long time
(30 seconds here) without JIT and thus might cause test timeouts in
COIN when run on winrt.

Change-Id: I79d9f6be16dbe16594ae2bf51f353acd06b3d2fe
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-10-31 09:35:29 +00:00
Olivier Goffart
0330b967f2 Simplify the Q_FOREACH macro when using C++17
This way there is only one for loop, which is more optimizer friendly

Change-Id: Iaa02026627d5259c3eea1ff5664e8f22664eef73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-10-31 09:07:49 +00:00
Ivan Komissarov
95476bfcf6 qendian: Fix float conversions
Since Qt 5.10, qTo/FromBig/LittleEndian<float/double> stopped working.
It may be confusing, but big endian floats do exist, so not to break old
code, we should support them.

Change-Id: I21cdbc7f48ec030ce3d82f1cd1aad212f0fe5dd0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-10-28 22:26:56 +00:00
Timur Pocheptsov
b10ee45546 tst_qeventdispatcher: remove macOS from the BLACKLIST
the test is stable in Qt 5.12.

Task-number: QTBUG-60993
Change-Id: I0c366567121688d9518e90b5e8f9ec1b4006b7b9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-10-25 11:51:53 +00:00
Timur Pocheptsov
95ba049f87 Remove QSKIP and bring the test back to business
on macOS, where it was skipped but where it now seems to be stable/work.

Task-number: QTBUG-39983
Change-Id: I100a57f23b43074ebacc012be247d92acc6ae336
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-10-25 11:51:42 +00:00
Liang Qi
e28e91ae99 Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
	src/corelib/animation/qpropertyanimation.cpp
	src/gui/image/qicon.cpp
	tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp

Change-Id: I3698172b7b44ebb487cb38f50fd2c4a9f8a35b21
2018-10-25 07:21:53 +02:00
Edward Welbourne
6c543879a3 Avoid races on TZ in environment via tzset() calls
POSIX specifies that tzset() consults environment variable TZ and
modifies some globals; it also specifies mktime(), localtime() and
strftime() to behave as if they called tzset().  Fortunately, we only
call strftime() from a test and only call localtime() when not
threaded.  Provide wrappers for tzset() and mktime() that share the
lock used by our environment-access code, to prevent races on the
environment (and tzset()'s globals) when we call them.

In the process, re-use tst_QDateTime's TimeZoneRollback in its older
test systemTimeZoneChange() and presume that this can now be tested
cross-platform, since TimeZoneRollback is used in another test where
this works.

Fixes: QTBUG-71030
Change-Id: I79f559b8857ea2803e73501008bf0d7158c6731f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-10-22 10:07:01 +00:00
Jüri Valdmann
cea2b5510c Fix building tests with -no-gui
Change-Id: I37307080e5adc334fcfcdd2fee650d675228a746
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-10-20 20:38:59 +00:00
Allan Sandfeld Jensen
16ebc78ef3 Fix odd test in tst_qflags
This test triggered a compiler warning for good reason, it made no
sense, trying to change it to what it was probably meant to be.

Change-Id: I01a848272b42dae2aaa58a4f5bed998644d864da
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-10-17 09:15:22 +00:00
Anton Kudryavtsev
aa633ff276 QMetaEnum: fix UB
Check ptr before usage.

Change-Id: Iac757a2e260b237d837318932cc0b5896c6e04c2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-10-17 08:48:13 +00:00
Eirik Aavitsland
f2f040ae1c Improve support for QImages in QDataStream read transactions
QImage's operator>>(QDataStream&) did not set an error mode on the
stream on read failures. That would break QDataStream transactions.
Since the current QImage serialization cannot differentiate between
truncated and corrupted data, we set the ReadPastEnd error as expected
by the transaction system.

Also specify the expected file format on decoding QImage from stream,
to avoid all the format handlers' canRead() being invoked. This is
necessary since some of them may call ungetChar(), which fails when
the stream is in a transaction.

Also add testing of this feature to the QDataStram transaction
autotest. That required a slight rewrite of the fake sequential
QIODevice subclass. The previous implementation had incorrect
behavior of peek(), which is required by QImage decoders.

Task-number: QTBUG-70875
Change-Id: If3f1ca7186ad1e6ca0e6e8ea81d2b2fbece6ea01
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-10-15 07:18:57 +00:00
Qt Forward Merge Bot
69b6845edb Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I5cbfd39cf728036bbdfdeec8e8739568e0a3025b
2018-10-09 01:00:48 +02:00
Edward Welbourne
bc099f33dd Support QCborMap::operator[] taking a string literal
Use a template on the size of the char[], as suggested by Ville
Voutilainen.  This resolves ambiguity about whether such look-ups
should be done via QString or QCborValue (not that it would have made
any difference).

When we come to add mutating indexing of QCborValue, chained
dereferences like map[i][j][k] need to stay in operator[] const
throughout, to avoid detaching intermediates to create references into
them due to using the mutating operator[] on the earlier dereference's
return.  So const-qualify the QCborValue operator[] const variants at
the same time, to match those of QCborValue itself.

Change-Id: Ib1652ae9440fe3767a653afa2856b74040210e07
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-10-08 14:11:23 +00:00
Jesus Fernandez
0c82994623 Use the stack for storing objects
Theoretically, it could improve the speed. Some of the modified lines
also make the style homogeneous.

Change-Id: Iaed7b16fa75e485be0f825220c366903525448ce
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-10-08 13:26:41 +00:00
Liang Qi
7344987c20 Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
	src/widgets/styles/qstylesheetstyle.cpp

Change-Id: I3a503b44ae413fbc0a90f4af70b8f84daffd86ad
2018-10-08 10:56:25 +02:00
Qt Forward Merge Bot
b4da5c6b93 Merge remote-tracking branch 'origin/5.11' into 5.12
Conflicts:
	src/corelib/tools/qtimezoneprivate.cpp

Change-Id: Icbb5999d378711ce3786a4fe0aba176a45ac702c
2018-10-08 10:00:49 +02:00
Jędrzej Nowacki
e74cb37159 Implement QDataStream operator for main CBOR classes
Change-Id: Ib3b68b1963625432c68d02be3bf2ec3c4baf1104
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-10-03 14:49:22 +00:00
Jędrzej Nowacki
0e84e3866c Implement QJsonValue data stream operator
Change-Id: I9cff40828ab68b4e2474da506b2da2cfed479f2c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
2018-10-03 14:49:17 +00:00
Jędrzej Nowacki
4981c2c8b5 Implement QJsonObject data stream operator
Change-Id: I8528f18ad72828cd97a5ac00e1925958acf73f9f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-10-03 14:49:12 +00:00
Jędrzej Nowacki
ff03383017 Implement QJsonArray data stream operator
Change-Id: Ib3c83c06605f0fe39108855bc3416bf453cab043
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-10-03 14:49:06 +00:00
Jędrzej Nowacki
1d0b5d26ec Handle errors when streaming QJsonDocument through QDataStream
Change-Id: I96df896d446e89dc4f9733a6cc6cec61a6826a1f
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-10-03 14:49:01 +00:00
Jędrzej Nowacki
cc24fc0406 Implement QJsonDocument data stream operators
Task-number: QTBUG-48313
Change-Id: I25ebeed94c9340819e925a7740bbee21de73a0ca
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-10-03 14:48:47 +00:00
David Faure
ddeec1b07e QSFPM: don't let setFilterRegExp(QString) overwrite CaseSensitivity
This is a regression from commit 346c15102b, which creates a new QRegExp
in setFilterRegExp, losing previously set case sensitivity property
(i.e. when the code does proxy->setFilterCaseSensitivity(Qt::CaseInsensitive)
before setFilterRegExp).
Interestingly that commit ensured that setFilterFixedString would still
preserve CaseSensitivity, but not setFilterRegExp(QString).

Change-Id: I3d37d001ce6e86dd90e7e07431440a42607172f9
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
2018-10-03 11:45:50 +00:00
Edward Welbourne
ced34cb3d5 QDateTimeParser: avoid using an invalid hour by default
When a time-zone does a spring-forward, skipping an hour (either to
start DST or to move its standard time), there's an hour that doesn't
exist on the day in question.  That hour can be the first hour of the
day, in which case using 0:0 as the default time is broken.  So catch
this case and use the first time that day that makes sense.

Fixes: QTBUG-70823
Change-Id: I23dae9320a3cdd2c988841a7db1b111edb945730
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-10-02 13:49:45 +00:00
Qt Forward Merge Bot
2e02692ec2 Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: Ic8cdb1c2b7c0a786b1313b6c3a3bf7e9ec288712
2018-10-01 17:51:32 +02:00
Jędrzej Nowacki
dca3dd66b4 Expose type id from QMetaType instance
There is not reason why it should be kept in secret. Not having public
accessor forces a user code to keep a copy of the id. Visible for
example in QML (QQmlValueType).

Change-Id: If0de65fb8d91bcd50880c66b5f87c68f6d888dd3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-10-01 09:45:20 +00:00
Friedemann Kleint
20a8a277ee tst_qfileinfo: Refactor ntfsJunctionPointsAndSymlinks()
Move the creation of the symbolic link/junction from the _data() slot
into the actual test function. The parameters are passed by a newly
introduced struct. This ensures only the symbolic links/junctions that
are actually needed are created. It can then no longer happen that
filtering for one data row invokes recursive deletion of the mountpoint
junction.

Also use of the newly introduced convenience createSymbolicLink()
in canonicalFilePath()

Task-number: QTBUG-63989
Change-Id: Ia78fd4ad6097136934ab5a375f4c352713d0f115
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-09-30 09:59:09 +00:00
Qt Forward Merge Bot
07e9261105 Merge remote-tracking branch 'origin/5.11' into 5.12
Change-Id: Iaa438d14357be1bf75bb645cb8d3245947c055b8
2018-09-30 01:00:19 +02:00
Thiago Macieira
caa598c843 Fix QUrl::matches for when removing authority parts (other than host)
QUrl::RemoveAuthority is RemoveUserInfo | RemovePort | 0x10, so the
condition

    if (options & QUrl::RemoveAuthority)

would match if any of the other bits for the username, password or port
were set, which meant we would skip the host comparison. Ditto for
username and RemovePassword.

[ChangeLog][QtCore][QUrl] Fixed a bug that caused QUrl::matches to
incorrectly compare two URLs with different hostnames or different
usernames as equal, if certain QUrl::RemoveXxx options were passed.

Change-Id: I015970a03b874898bba7fffd155856ab9d6cb1be
Fixes: QTBUG-70774
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-09-29 00:33:39 +00:00
Qt Forward Merge Bot
0e1866017f Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I6083c3e61b7dbe188f83676f7e7bb268e5ccf2f3
2018-09-29 01:00:10 +02:00
Alexander Akulich
94884246d4 QCommandLineParser: Ensure that an option text ends with a newline
Before this change we inserted newline only if an option has a
description and ended up with an arbitrary long line with all options.

[ChangeLog][QtCore][QCommandLineParser] Fixed a bug that caused the help
output to show two options or more in the same line if the options didn't
have a description.

Task-number: QTBUG-70174
Change-Id: Id54b9ae13ee596869e4dc14e09301aea19eed2f8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-09-28 22:01:05 +00:00
hjk
f286027e6b Fix QXmlStreamWriter xmlns attribute placement
Done-by: Eugenio Rustico
Change-Id: Ibd6aa6cc8be9090a4fad4f96628086d8a498b8e0
Fixes: QTBUG-63434
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-09-28 13:19:48 +00:00
Liang Qi
555a6b5d5d Modernize the "filesystemwatcher" feature
Change-Id: If030b56ad97e047d89d442629262b4839df306d4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-09-27 08:18:55 +00:00
Allan Sandfeld Jensen
e61a40bff1 Re-enable thread autotests
Replacing the qmake test with the one corelib/thread/thread.pri uses
for those classes.

Change-Id: Ie803190b821736c89b056ae51b7dfe92046189eb
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-09-25 22:35:40 +00:00
Thiago Macieira
7e1a0c0739 Add tests for decoding too-short UTF-8 sequences
We were handling this properly, but not testing them. I guess we weren't
testing because the condition is a valid intermediate state, so
hasFailure() is correct it returning false.

Testing inspired by the bug reported in
https://github.com/intel/tinycbor/issues/137

Change-Id: Ib47c56818178458a88b4fffd1554ecfdd0af637e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-09-25 22:14:07 +00:00
Edward Welbourne
56c5829384 tst_QCborValue: eliminate unused lambda
Change-Id: Icb8bd9bd170c8c22978c7d730a8c8b671705adfc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-09-25 14:35:17 +00:00
Qt Forward Merge Bot
a607fcb31e Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I4d123c3cdf86524716ba67091e0347309b49c837
2018-09-25 10:56:53 +02:00