Commit Graph

6480 Commits

Author SHA1 Message Date
Liang Qi
f34e73a16a Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	src/corelib/kernel/qobject.cpp
	src/gui/painting/qpaintengine_raster.cpp

Change-Id: I74e1779832f43d033708dcfd6b666c7b4f0111fb
2016-04-11 09:12:36 +02:00
David Faure
b6eea89b67 Fix crash when using QLockFile in a global destructor
(for instance any global object which writes out to a config file in the
destructor). If the global cache isn't available anymore, don't use it.

Change-Id: I851a6e394d0b073aebf3ffd88b1966d424bfb92e
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-04-10 07:37:51 +00:00
Thiago Macieira
8c427e5bdf Autotest: confirm that QHostAddress obeys RFC 5952 recommendations
Change-Id: I0c94a5c2846b48c8aea7ffff1435b8a7ccbd4d9e
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
2016-04-09 05:16:40 +00:00
Alexander Grishkov
f39e542eb8 Fix parsing of IPv4 addresses with certain symbols
Add some extra checks to the parser to make sure that addresses
like "300-05" aren't interpreted as valid IPv4 addresses.

Change-Id: I12475eebc9452e060779bb05e2b4ad9512a28281
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-04-08 15:09:50 +00:00
Liang Qi
8e103902de tests: fix tst_QFontComboBox on OS X
After 909d3f5c7, private families will not be shown in user interface.

Task-number: QTBUG-41318
Change-Id: I15ae77cacd2a27c9db4b1a8ffbb582416258988c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-04-08 15:02:58 +00:00
Friedemann Kleint
e1d44b531d Tests: Add more QChar::unicode() calls to brush over deprecation warning.
Amends change e0ea0f6178

Change-Id: I19e505b2aac9c26173508d75bbf60a45db825fe4
Reviewed-by: hjk <hjk@theqtcompany.com>
2016-04-08 09:26:40 +00:00
Marc Mutz
1ed8a7bff5 QTest: support nullptr in QCOMPARE
This allows to write
  QCOMPARE(ptr, nullptr);
instead of
  QVERIFY(ptr);

Task-number: QTBUG-49973
Change-Id: I6e1327d4327bcf17bd9b59de4352fdcaae98ac27
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-04-08 05:38:33 +00:00
Konstantin Ritt
eade27bb67 Update QDateTimeEdit tests to match data from CLDR v29
Change-Id: Ie4c4b2ed927caa95a9e7e11f94f05da2fe4e2860
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-08 03:51:23 +00:00
Konstantin Ritt
eb26f2b19b Re-generate QLocale data from CLDR v29
* A bunch of fixes and additions to the locale data
* Add new scripts from Unicode 8.0 and 9.0
* Map some potentially useful languages and territories

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

Change-Id: I759ccb27fe19be2722be913c5c2e6aa5f36e5c14
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-08 03:51:18 +00:00
Lars Knoll
da95152dfb Unify naming of LIBS/CFLAGS for 3rd party libraries
Most libs use QMAKE_LIBS/CFLAGS, but some have other naming
conventions. Unify them into using QMAKE_LIBS/CFLAGS.

Change-Id: I39b188adc1f9a223a83b294c5315c3095a9c68de
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-04-07 16:18:03 +00:00
Marc Mutz
6958e189a3 QStringRef: add missing {c,}r{begin,end}()
Most containers have them in Qt 5.7, so add them
to QStringRef, too.

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

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

Change-Id: I3d2884a1b2faae02c610ab3871552b65bc6e2521
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-07 11:29:45 +00:00
Friedemann Kleint
115d4fc8cc QtWidgets: Remove Windows CE.
Remove  Windows CE-specific files, #ifdef sections for Q_OS_WINCE and wince
.pro file clauses in library, examples and tests.

Task-number: QTBUG-51673
Change-Id: I102745aaca9d9737f2108fe7618111743d5ae980
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-04-07 10:24:45 +00:00
Lars Knoll
00ca784be6 Always build JPEG and GIF support as plugins
Our handling of plugins when Qt is build statically is
nowadays good enough, so we don't need to build the
JPEG and GIF support directly into Qt for static builds.
Let's simply always build them as plugins.

Also simplify the logic in configure, and get rid of the
no-gif, no-jpeg and no-png config variables.

[ChangelLog][Build system] JPEG and GIF image support is now
always built as a plugin. Removed -imageformat-[jpeg|gif]
arguments to configure.

Change-Id: Ic01559ff406c966807b3be8761252e8802adcdf7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-04-07 09:08:41 +00:00
Liang Qi
ee0951d69b Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/network/access/qftp.cpp
	src/widgets/itemviews/qheaderview.cpp
	src/widgets/itemviews/qlistview.cpp
	tests/auto/network/access/qftp/tst_qftp.cpp

Change-Id: I9f928f25d45d8944dd60bb583f649fc1615bc5d9
2016-04-07 10:47:20 +02:00
Marc Mutz
f72152381b tst_QStringBuilder: add a check for self-assignment
Change-Id: I78094146bf534163af12d6e265276d987d5ce994
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-04-07 07:02:38 +00:00
Friedemann Kleint
d37239aa41 QFtp: Use UTF-8 encoding.
According to RFC 2640, FTP uses UTF-8 encoding. Fix the conversions
accordingly.

Task-number: QTBUG-52303
Change-Id: I615199b3d074fc3861f25df113dda672525766b6
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
2016-04-07 04:25:57 +00:00
Friedemann Kleint
2a282551ac Remove empty first lines of files.
They might upset licensing related tools.

Change-Id: I858d21fc418ba16959c88847b559b11bea29ed6b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-04-06 18:26:26 +00:00
Friedemann Kleint
8104729e63 QtTest: Remove Windows CE.
Remove #ifdef sections for Q_OS_WINCE and wince .pro file clauses in library
and tests.

Task-number: QTBUG-51673
Change-Id: I552b3fe8d6e0eb7c8c7b3a3d41558e5e21904dd2
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-06 10:56:02 +00:00
Hannah von Reth
1726352207 Make sure QStyleOption is correctly initialized.
Ensures that QStyleOption is correctly initialized.
This prevents possible styling issues due to
QStyleOption's reporting version 0, see qstyleoption_cast.
This enables users to handle more cases in their QProxyStyle.
For now the test is only used for QCommonStyle.

Change-Id: I768db00b12b46890343fffe44e4f562762e9cf80
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-04-05 20:32:26 +00:00
Marc Mutz
e0ea0f6178 QChar: optimize comparison with QString{,Ref}
Instead of relying on the QString relational operators to
implicitly convert the QChar to a QString, add relational
operator overloads that compare the QChar without first
turning it into a QString, saving one memory allocation
per comparison, and allowing to mark the operation as
nothrow.

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

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

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

Added.

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

Added, too.

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

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

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

Change-Id: Ia006e10ff1732fe78f90138c41f05b59b49486cf
2016-04-05 14:22:45 +02:00
Marc Mutz
284016c7e6 network-settings.h: don't crash when running without the test server
Don't access first() of a potentially-empty QList.
Check for QHostInfo::error() first.

Also change to constFirst() to prevent a detach.

Change-Id: I91fa0bbfb21f62af29abdb23b4869a7f039b259e
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-05 06:52:39 +00:00
Liang Qi
216f57ef86 Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I35ca979395620e104e50b06366d0869433a4ffc2
2016-04-04 08:59:18 +02:00
Stephen Kelly
bedf0367ac QVariant: Fix flags for type-erased associative iterator key
The flags here are passed to a private QVariant constructor, and they
really represent a boolean - IsPointer or not.

Because the flag for the key_type was incorrectly populated with the
flag for the value_type, memory would be corrupted when using a mapping
type whose value_type is a pointer, but whose key type was not, such as

  QMap<QString, int*>

This typo has been there since the concept was introduced in commit
v5.2.0-alpha1~807 (Add container access functionality for associative
containers in QVariant., 2013-04-05).

Task-number: QTBUG-52246
Change-Id: I9ecb13c603015eed2dc2ca43947fa0ecd6be8b5a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-04-03 10:58:12 +00:00
Marc Mutz
b7c7beacda QPointer: add a test for const QPointer<X>
People use this, so make sure there's a test for it.

I don't expect this test to fail, but static and
dynamic checkers should be presented with this
use-case, so they have a chance of warning, because
certain implementation strategies of QPointer may
make this code undefined.

Change-Id: I334bd73204ba4e186c4098fc6b7188917407e020
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-04-01 18:57:25 +00:00
Simo Fält
f44d826751 Autotest: Remove blacklistings
Removing blacklistings from tests that are now passing.

Change-Id: I00aa1ce286d3e7715fb4bee4a36d0d77049a29ae
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@theqtcompany.com>
2016-04-01 05:41:21 +00:00
Eirik Aavitsland
ea122fa9e3 Fixup for text labels in lancelot graphics test
Some strings were drawn with a different size or scaling than what the
string itself said, causing confusion.

Change-Id: I4b187cba6d467cfa0900576bdf451052baa806e6
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-03-31 10:27:39 +00:00
Joerg Bornemann
479ee4fa46 moc: bail out early on missing or invalid options file
If moc is invoked with the @ argument and no options file is specified
or the options file cannot be read, do not try to parse the empty
arguments list. Otherwise QCommandLineParser will print an additional
error message that is of no value for the user.

Task-number: QTBUG-51847
Change-Id: I9aa1eb20a44097b553123be8bc6fded87473a03a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-31 08:57:39 +00:00
Milla Pohjanheimo
342290888f Check that window has been painted
The test is preventing us to take RHEL 7.1 in the CI for Qt 5.7.
Changed the paintEvent() test to be less strict about the paintCount.

Task-number: QTBUG-51809
Change-Id: I84f797442e38c66dc23862e92eda6db08bcac368
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-31 08:55:37 +00:00
Eskil Abrahamsen Blomfeldt
a4e2f2e687 Fix possible crash in QImage::pixel()
QImage::pixel() assumed that the color table was valid
for the values in the bitmap. This was always wrong
for indexed images with explicit no color table set and
was wrong for mono images that were constructed from
preexisting data.

For mono images, we default to a black/white color table,
like we do when constructing with uninitialized data.

For indexed image, we always default to no color table,
but instead of crashing in pixel(), we warn and return
an undefined value.

[ChangeLog][QtGui][Image] Fixed possible crash in QImage::pixel()
for mono or indexed images.

Change-Id: Ieaf19c03984badddfd06e1855a7e287b862adc70
Task-number: QTBUG-50745
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2016-03-31 08:54:03 +00:00
Friedemann Kleint
f720619e0d Remove Windows CE from tests (others).
Remove #ifdef sections for Q_OS_WINCE, wince .pro file clauses and
CE-specific files.

Task-number: QTBUG-51673
Change-Id: Ibf599204f5c0daaef086edaf8fac86853db3ee14
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-31 06:14:04 +00:00
Friedemann Kleint
bf537516a9 QtGui: Remove Windows CE.
Remove #ifdef sections for Q_OS_WINCE and wince .pro file clauses in library,
and tests.

Task-number: QTBUG-51673
Change-Id: I55f61845c3b54027c467a5c59c122e7d16955358
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-30 17:35:41 +00:00
Friedemann Kleint
7fc2864dc5 QtCore: Remove Windows CE.
Remove QSysInfo::WV_CE_5/6 enumeration values, #ifdef sections for Q_OS_WINCE
and wince .pro file clauses in library, examples and tests.

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

Change-Id: I0ff9d770e82a43457fb7e5da0428f4597ead4038
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-30 10:12:34 +00:00
Kai Pastor
9bc352e38d Enable cmake auto tests for -no-gui
This change disables tests which require QtGui.

Change-Id: Ib647afd086f54536054cb4c0cde5696d762ee8c4
Reviewed-by: Stephen Kelly <steveire@gmail.com>
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2016-03-30 07:16:50 +00:00
Friedemann Kleint
086317d72a QTextEdit::inputMethodQuery(): Preserve types when applying offset.
The old code converted QRectF into QRect when applying the offset. Change
the offset point to QPointF and change the conversions accordingly. Add an
autotest similar to that of QPlainTextEdit.

This minimizes rounding errors and prevents conversions since
the input method logic mostly uses qreal.

Task-number: QTBUG-51923
Change-Id: I0c2f80ccae028d8bbbb97ec603f8782f69959c76
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-03-30 07:12:57 +00:00
Friedemann Kleint
04aa760711 QtNetwork: Remove Windows CE.
Remove #ifdef sections for Q_OS_WINCE and wince .pro file clauses in library,
examples and tests.

Task-number: QTBUG-51673
Change-Id: I3706336395620522ceda414d7437295d9ec64f16
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-29 20:28:18 +00:00
Błażej Szczygieł
88fae806a8 QtWidgets: Add autotests for Qt::WA_OutsideWSRange flag
Task-number: QTBUG-48321
Task-number: QTBUG-49445
Task-number: QTBUG-51788
Change-Id: I6c04919ff788cad684df69d0aee73d86fd985bb9
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
2016-03-29 12:06:10 +00:00
Friedemann Kleint
b169b5a4f3 QPlainTextEdit: Take vertical offset into account when answering input method queries.
Determine offset point to similar to QTextEdit::inputMethodQuery()
and add an autotest.

Task-number: QTBUG-51923
Change-Id: I8232eb348063e2cd95d0632fe74a6eb30c897eda
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-03-29 11:10:27 +00:00
Jani Heikkinen
cd46a2daf5 Unify license header usage.
Update files using old header.LGPL3 to header.LGPL
Update files using old FDL template to use new one
Update files using old BSD template to use new one

Change-Id: I36a78272516f9953d02956522f285b40adfc8915
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-29 10:20:03 +00:00
Edward Welbourne
717724b17a Purge sRGB chunks from PNGs in tests.
Subjects each *.png file that matched grep -law "sRGB" to:
pngcrush -ow -brute -rem allb -reduce
(Two needed -force but did get smaller.)

Change-Id: Ia030f0bc1d3617ba716bcc26677ff919ef58423c
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-03-29 08:39:43 +00:00
Hannah von Reth
f64640f441 Allow to style arrows drawn with drawPrimitive in QCommonStyle.
Its currently not possible to style the arrows with QCommonStyle because
drawPrimitive from QCommonStyle is called instead from the proxy.

Change-Id: I910b13df110601cb18578bc16edfa5ddaa17bbd2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-25 16:31:31 +00:00
M. Moellney
705d29585b Fix qSetMessagePattern to have many time/backtrace parts
The previous implementation overwrote multiple 'time' parts in the
qSetMessagePattern with the last setting in the pattern line.
%{time}%{time process}%{time boot} ended up to be output as if
%{time boot}%{time boot}%{time boot} was set.

This fix keeps the arguments of each individual 'time' part.

The same holds for multiple 'backtrace' parts. The previouse
implementation overwrote multiple 'backtrace' arguments with the
arguments of the last occurrence.

This fix keeps the individual arguments for the 'process' parts.

The individual arguments are applied in qFormatLogMessage.

A new test to verify the individual 'time' arguments application
is added, too.

Task-number: QTBUG-51944
Change-Id: Ib757614a482c5f31ed0a61b550daa2eea4b907b4
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-25 11:03:43 +00:00
Joerg Bornemann
1534297323 Update comment in tst_QLocalSocket::readBufferOverflow
QWindowsPipeWriter doesn't write in a separate thread
anymore.

Change-Id: Id978bfdfa2531be91cce94476ab9b0dff237bd61
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
2016-03-24 20:35:18 +00:00
Simon Hausmann
487844fc62 Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I13c7ea6a74eb98606cf45702ae068101943bec6a
2016-03-24 20:37:33 +01:00
Marc Mutz
aedda12ef1 tst_QAtomicInteger: fix UBs (signed overflow)
Drop addSub() test. It executes exactly the union of fetchAndAdd()
and fetchAndSub(), which have already had their UBs fixed.

No need to do fixes in duplicated code.

Change-Id: Ib72caab0310fce3ff9a40c261d8a38518f91ecaf
Reviewed-by: David Faure <david.faure@kdab.com>
2016-03-24 16:16:15 +00:00
Joerg Bornemann
24411e9743 Add a write buffer to QLocalSocket/Win
Commit 0307c008 removed the buffering of data-to-be-written from
QWindowsPipeWriter, because it was assumed that users of this class
(QProcess and QLocalSocket) already buffer data internally.

This assumption was wrong for QLocalSocket. The following sequence
    localSocket->write(someData);
    localSocket->write(someMoreData);
would not write anything on the second write.

Add a write buffer to the Windows implementation of QLocalSocket.

Task-number: QTBUG-52073
Change-Id: I6d0f03a722ec48138cbde3e2f69aae7dafe790d3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-24 16:12:46 +00:00
Giuseppe D'Angelo
4ca7785161 QAbstractItemView test: check that the selection model is in sync with the view
Change-Id: Ifca91154b47184a9d9a1979e1fba471517e16698
Reviewed-by: Stephen Kelly <ske@ableton.com>
2016-03-23 22:10:07 +00:00
Giuseppe D'Angelo
fce83bd9f8 QAbstractItemView: trigger handlers (and redraw) when changing selection model
The most visible problem is that changing selection model didn't update()
the view, resulting in the old selection/current item still being drawn.
In general trigger the handlers for when the selection/current item
changes.

Change-Id: Ib3b2ad70412e6a21a182d4c173e617710bcc630d
Task-number: QTBUG-50535
Reviewed-by: Stephen Kelly <ske@ableton.com>
2016-03-23 15:12:04 +00:00
Marko Kangas
1bbbb682b5 Initialize input method for read-only QTextBrowser
Set input method attribute to be aligned with read-only
value in QTextBrowser initialization

Task-number: QTBUG-52071
Change-Id: If0e64bf09e2a2d505ed66fcbfb8cd12ae39844d3
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
2016-03-23 09:46:24 +00:00
Simon Hausmann
8e2d3e3b90 Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I9a10e1f3c9506ec8554d8f59b6300825ac730939
2016-03-23 08:29:43 +01:00
Kai Pastor
4ccfb1eb92 Fix tests for build with -no-gui
Change-Id: I48d5452daeaf3490ed7a5b8c30953da019bb33af
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2016-03-23 06:52:46 +00:00
Olivier Goffart
63274c95a3 Add QCommandLineOption::Flags containing HiddenFromHelp and ShortOptionStyle
This patch adds a new option, QCommandLineOption::ShortOptionStyle, which helps
applications (such as compilers, so moc and now qdoc) which need to mix long-style
and short flags.

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

Change-Id: I944ce56aff2b28ecd6bb9d2d23c4e726e9d06647
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-03-23 01:08:28 +00:00
James McDonnell
005a8bfbf0 Remove QPROCESS_USE_SPAWN and all that it surrounds
The spawn code was only used to make QProcess work on QNX 6.5.0.  Fork
works on QNX 6.6.0.  The QNX spawn implementation has a flaw that causes
a deadlock in certain situations.  When a working directory is specified
for the process, the QNX spawn implementation stops all threads except
the one doing the spawn so that it can temporarily change the process'
working directory.  This can lead to a deadlock if the thread does
anything that conficts with something being done in a stopped thread.
QNX 6.5.0 is no longer supported in Qt 5.6.0 so we can just switch QNX
to the fork implementation and get rid of the spawn implementation.

Made a QNX specific adjustment to the hardExit test.  There's a bug
in the OS that the test can run into because it does something that
normal applications wouldn't.

Task-number: QTBUG-47250
Change-Id: Ib32567d2c15ce651815858000035ac5aa6f35224
Reviewed-by: Dan Cape <dcape@qnx.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
2016-03-22 15:20:06 +00:00
Liang Qi
a02863234d Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	configure
	mkspecs/common/wince/qplatformdefs.h
	src/plugins/platforms/directfb/qdirectfbbackingstore.cpp
	src/plugins/platforms/xcb/qxcbbackingstore.cpp

Change-Id: Ied4d31264a9afca9514b51a7eb1494c28712793c
2016-03-22 07:28:42 +01:00
Timur Pocheptsov
765eab5103 qsslsocket/qsslcontext - add ALPN (OpenSSL only)
Application-Layer Protocol Negotiation (ALPN) - is a reworked revision
of Next Protocol Negotiation (NPN) we have in our OpenSSL code.
Can be used as a part of HTTP2 negotiation during TLS handshake.

Change-Id: I484ec528c81d4887a64749095ec292dfaec18330
Reviewed-by: Richard J. Moore <rich@kde.org>
2016-03-21 15:01:12 +00:00
Gabriel de Dietrich
e342a2e05f Add auto-test for crash in QCocoaBackingStore
This issue has been solved some time between 5.6 and 5.6.0.
We just make sure to protect against further regressions.

Change-Id: Ic3fdad901ed5f36792ae04b3d65047da95eea668
Task-number: QTBUG-50561
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-03-21 08:36:41 +00:00
Liang Qi
6cb8121a44 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/widgets/styles/qgtkstyle_p.cpp
	tests/auto/corelib/io/qtextstream/test/test.pro
	tests/auto/corelib/plugin/plugin.pro

Change-Id: I512bc1b36acf3933ed2b96c00f476ee3819c1f4b
2016-03-21 09:02:57 +01:00
Stephen Kelly
6ec89bec0a Fix QFINDTESTDATA when using cmake ninja generator
The Qt CI does not have ninja, but the autotest can be used for manual
regression finding.

 cd qtbase/tests/auto/cmake
 qmake
 make check
 cd build
 cmake . -DHAVE_NINJA=ON
 ctest -R FINDTESTDATA

Change-Id: Ic3f3748f6ab04e37fa5287c59486e5cd46dcabb4
Reviewed-by: Stephen Kelly <steveire@gmail.com>
2016-03-19 13:44:21 +00:00
Rolland Dudemaine
d58596fd61 Remove inclusion of -lm for INTEGRITY.
Math functions are linked in by default on INTEGRITY.

Change-Id: I737ae87c02b2321caca3975f69525731e839d1a7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-18 20:40:59 +00:00
Alberto Mardegan
fb6000a74f Add QAbstractTextDocumentLayout::imageAt(), formatAt()
The new imageAt() method pairs with the existing anchorAt() method, and
allows retrieving the source link of the image under the cursor.
We also expose the common logic between these two methods as an
additional formatAt() method.

[ChangeLog][QtGui][QAbstractTextDocumentLayout] Added imageAt() and
formatAt() methods, which respectively can be used to retrieve the
source link of the image under the cursor, or the QTextFormat of the
text under the cursor.

Change-Id: If09815dde91de6616edcb19c72c462dbf7abd8ef
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-03-18 19:02:13 +00:00
Alex Trotsenko
bec47545dc QAbstractSocket: do not fail writing on read buffer overflow
canReadNotification() could return 'false' if either the socket has
been closed, or the read buffer has reached the maximum size. Because of
this duality, waitForBytesWritten() should not fail as a result of a
canReadNotification() call.

Change-Id: I9a15fa174a3b982a7ce404913caa38fc19f64622
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
2016-03-18 13:05:42 +00:00
Friedemann Kleint
eda675b688 QtTest/generate_expected_output.py: Add TeamCity logging format.
Adapt the script to generate output for the new TeamCity format
added by fbd6acedac.

Change-Id: I9435382ec3daf80428c324c58434aa951841bf08
Reviewed-by: Borgar Øvsthus <borgar.ovsthus@fmcti.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2016-03-17 17:29:14 +00:00
Friedemann Kleint
74c202f913 QtTest: Add formatting for QColor.
When a QCOMPARE of values of type QColor fails, their
name will now be printed.

Task-number: QTBUG-51124
Change-Id: I76565daa338f038ea4f452e47705e638d94eaeee
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2016-03-17 15:35:05 +00:00
Gabriel de Dietrich
d19c9cfd29 QMenu: Add showTearOffMenu()
The API is incomplete since we can't show a tear-off menu
programatically. This could be useful when restoring the
application state on launch.

Change-Id: Ice1911b44a5b973680f67b0150efacf3d023c2c5
Task-number: QTBUG-47974
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2016-03-17 10:06:51 +00:00
Tony Sarajärvi
1151d8e5e3 Blacklist tst_qfont::exactMatch in openSUSE 42.1
It is already blacklisted in openSUSE 13.1 and is a
known bug somewhere.

Task-number: QTBUG-46054
Change-Id: Ie2fb23bcede1871d3b9fa15644112fb2ab975c2b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-03-17 08:41:48 +00:00
Maurice Kalinowski
e7cd32274e WinRT: Fix QTimeZone transitions by switching backend
Previously WinRT was using the UTC backend which fails on all platforms
for some QDateTime autotests related to timezone items. Hence switch to
the Windows implementation for WinRT as well.

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

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

Change-Id: I620b614e9994aa77b531e5c34c9be1da7e272a30
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-03-16 10:30:26 +00:00
Tony Sarajärvi
3e72eaba2c Autotest tst_qfont can split font families
openSUSE 42.1 returns 2 font families comma separated
when querying monospace font families. Without splitting
we compared the family against the whole list.

Task-number: QTBUG-51336
Change-Id: Icd757e173aa8ffab713b83cf9e38b78aab00c07e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-03-16 09:24:21 +00:00
Maurice Kalinowski
e830fa8fc2 tst_QXmlStream::writerHangs(): Create file in temporary directory
A test should not write to its directory.

Change-Id: I34dfc36387cf5a637b325be29c8a19ff51d9b9c3
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-03-16 08:15:59 +00:00
Maurice Kalinowski
eef3afaa97 QTextStream test: Change current directory
For platforms with builtin testdata/sandboxed platforms we need to
change the current directory to be able to create files.

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

Added.

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

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

Change-Id: Idb3c4fa9b38421637987226f3cc1b77f5d4a6309
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-16 08:06:54 +00:00
Milla Pohjanheimo
e363817498 tst_qtabbar sizeHints fix
tst_qtabbar uses fixed values to check the minimumSizeHint and it fails
with screens that have a higher resolution. The test still uses the
default values, but now in the beginning it creates enough tabs so that
it goes over the default.

Change-Id: I3f891d2661288d7fad50ad522d73f634b3e91958
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
2016-03-16 07:39:22 +00:00
Sean Harmer
aa21ac1043 Add a function to QMetaObject to check for inheritance
This is analogous to QObject::inherits() but only requires the
metaobjects rather than pointers to a QObject instances. This is needed
for type checking on the backend of Qt 3D where we do not have access
to QObject pointers.

Change-Id: I14d26c4cbb5cc3fbecb57725f2c14ee0ffda4a11
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-15 16:36:22 +00:00
Marc Mutz
e4c6d73f92 QRect: fix UB (int overflow) in center()
QRect::center() should be defined for any
  QRect(x1,y1,x2,x2), INT_MIN <= x1, x2, y1, y2 <= INT_MAX
because the average of two signed integers is always
representable as a signed integer.

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

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

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

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

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

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

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

Change-Id: I359a5e16db6c660c9f11d7dd8fbb40730bd63887
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-15 10:39:38 +00:00
Marc Mutz
add95c5510 tst_QSqlQuery: fix UBs (invalid downcasts, member calls)
The existing code derived a helper class from QSqlResult and
overloaded two protected functions as public ones so the test
could call them after casting QSqlResults to that helper class.

Both the cast (which is a C-style cast, but with combined
static_cast and const_cast semanics) and the following member
function call are undefined behavior.

Fix by making the test class a friend of QSqlResult, and
dropping the casts.

Change-Id: I09de2e2b46976d01cfce25892aec6ad36881d3eb
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2016-03-15 10:39:20 +00:00
Milla Pohjanheimo
1a9e1fbbfc Remove restoreDockWidget from BLACKLIST
Tested on the Ubuntu 14.04 VM. The test didn't fail anymore with
2000 test rounds

Change-Id: Ic12c60e5ebf9c234358a6983bf87fa0a88d7886e
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@theqtcompany.com>
2016-03-15 09:41:09 +00:00
Marc Mutz
032efc2cb2 Add test for API symmetry of QString/Ref, QLatin1String, QChar
At the moment, only checks the relational operators, where
it already found some which do not compile. In order to
simplify the test, the missing operators are supplied by
the test harness until they are fixed in the library.

Change-Id: Ief5daefa68f15de5f8e559c9378ed83b715b69ee
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-15 08:11:35 +00:00
Liang Qi
50d0f57b77 Merge remote-tracking branch 'origin/5.6' into 5.7
This change partially reverts 1bfc7f68 about QT_HAS_BUILTIN define
and undef in src/corelib/tools/qsimd_p.h.

This change is also squashed with "Fall back to c++11 standard
compiler flag for host builds" which is done by Peter Seiderer.

Conflicts:
	mkspecs/features/default_post.prf
	src/3rdparty/sqlite/0001-Fixing-the-SQLite3-build-for-WEC2013-again.patch
	src/3rdparty/sqlite/sqlite3.c
	src/corelib/tools/qsimd_p.h
	src/gui/kernel/qevent.cpp
	src/gui/kernel/qwindowsysteminterface.cpp
	src/gui/kernel/qwindowsysteminterface_p.h
	src/plugins/bearer/blackberry/blackberry.pro
	src/plugins/platforms/cocoa/qcocoasystemsettings.mm
	src/plugins/platformthemes/gtk2/gtk2.pro
	src/plugins/styles/bb10style/bb10style.pro
	src/sql/drivers/sqlite2/qsql_sqlite2.cpp
	tools/configure/configureapp.cpp

Task-number: QTBUG-51644
Done-with: Peter Seiderer <ps.report@gmx.net>
Change-Id: I6100d6ace31b2e8d41a95f0b5d5ebf8f1fd88b44
2016-03-11 20:08:50 +01:00
Friedemann Kleint
a8c72b7671 tst_QTextStream::textModeOnEmptyRead(): Create file in temporary directory.
A test should not write to its directory. Amends change
d0b54cede8.

Task-number: QTBUG-47176
Change-Id: If15258b4aed199792fab422b7ac1d74e22a9e322
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
2016-03-11 11:26:14 +00:00
Maurice Kalinowski
71a36d0b65 Disable tests requiring shared build when compiling statically
Change-Id: I06ec53e46d2f61f1685899b0f8a4d385051095d6
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-03-11 08:30:27 +00:00
Joerg Bornemann
ac8dae8b5e QLocalServer/Win: Fix race condition in listen().
Suppose a client connects while the QLocalServer is still in the loop
that calls addListener. The connection would SetEvent(eventHandle),
but every call to ConnectNamedPipe would ResetEvent(eventHandle).
Thus, the connection is never detected by the notifier on eventHandle.
  Callers of addListener must check the connection state of every
listener to make sure that no client connected while setting up
listeners.

Task-number: QTBUG-49254
Change-Id: Ia961927ea76973708e6e3f73510695eb5d6a0e4c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-10 17:32:49 +00:00
Allan Sandfeld Jensen
8589bb334f Enable most of tst_qstatictext on non-developer builds
Only two tests inside tst_qstatictext required private symbols, so
we can enable the rest on all builds.

Change-Id: Id222ba01d9676c40b6447c1526ee127fcc2090d3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-10 15:45:41 +00:00
Friedemann Kleint
2ec7f2cfed QSql tests: Remove Windows CE and clean up code.
Use the newly introduced QSysInfo::machineHostName() to determine
the host name in the shared header, removing the need to link
against the winsocket library. All Windows-specific .pro sections
can then be removed.

Task-number: QTBUG-51673
Change-Id: Iba990b886b16addd210639871065abde6de96516
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
2016-03-10 15:07:02 +00:00
Joerg Bornemann
39efe3c84d Fix glitch in tst_QLocalSocket::sendData
In one code path the test checked for the emission of a readyRead()
signal without waiting for it.
This code path was never hit, neither on Windows nor on Unix platforms.

Change-Id: Ifbe464400a2a1ba8eab49bd60315289040e6bbde
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-10 15:03:37 +00:00
Friedemann Kleint
45dc347a95 tst_QStaticText: Output verbose message for test failures.
Factor out function to check on the pixel color that
outputs a verbose message on failure.

Change-Id: I2331fe45f35327d1ff8ae547a58d93a2e6fe9184
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-03-10 12:37:47 +00:00
Marc Mutz
f647375275 Fix signed integer overflows in tst_QAtomicInteger
Signed integer overflows and underflows are undefined
behavior. A test that invokes UB tests nothing, because
the standard permits any outcome.

Fix by guarding the respective operations so
they are not executed if they would overflow
or underflow.

Change-Id: I40354ee88f40e4b47b70eac7790dc3a79ac70a57
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-10 07:17:55 +00:00
Marc Mutz
2020d2cb63 QObject: fix GCC 6 warning about qt_static_metacall's 'hidden' attribute use
This warning is triggered when we try to apply the Q_DECL_HIDDEN
attribute to a class in an unnamed namespace. Such classes are
already not exported.

  qobjectdefs.h:175:108: warning: ‘visibility’ attribute ignored [-Wattributes]
  qobjectdefs.h:198:108: warning: ‘visibility’ attribute ignored [-Wattributes]

Added a test on gadgets (and QObjects) in unnamed namespaces,
because qtbase currently does not contain such Q_GADGETs.

Done-with: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: Ic747cc2ab45e4dc6bb70ffff1438c747b05c5672
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-09 20:11:28 +00:00
Dyami Caliri
f8f1bac3f0 Accept LFCRLF to mark end of HTTP Headers
Some embedded servers use LF to mark the end of an individual header,
but use CRLF to mark the end of all the headers. The GoPro WiFi
interface does this, as an example.

Change-Id: I227ab73622c84f439a6cf8703d020393c4d8bf69
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
2016-03-09 15:47:18 +00:00
Jarek Kobus
cb24903ef4 Generate QVariant::fromValue(enum_value) for enum values
Instead of just QVariant(enum_value).

Task-number: QTBUG-49383
Change-Id: Id57c65b68d4328816046bc35301dc6afba47b727
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-03-09 13:51:39 +00:00
Marc Mutz
62e89f4745 tst_QMetaType: fix misleading indention
As found by GCC 6:

  tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:1476:9: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
         tn += ">";
         ^~
  tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:1474:5: note: ...this ‘if’ clause, but it is not
     if (tn.endsWith('>'))
     ^~

Fix += argument from char[2] to char as a drive-by.

Change-Id: I814dc58830934cac7fcf81eb7fd7564b2abeb631
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-03-09 13:18:26 +00:00
Friedemann Kleint
4ef990ce4a tst_QKeyEvent: Fix MSVC warning about 64bit shift.
tst_qkeyevent.cpp(140): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)

Change-Id: Id3e0eea125f7f7ec13f9b9428e034b922d2ce204
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2016-03-08 14:57:14 +00:00
Lars Knoll
d0b54cede8 Ensure QTextStream doesn't modify the Text flag on the underlying iodevice
An empty read or a failed write on the underlying QIODevice of the text
stream would lead to an early return where we wouldn't correctly restore
the QIODevice::Text flag of the io device.

Change-Id: I5b632f45dea6ede3f408113556c3dad1b96574e2
Task-number: QTBUG-47176
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-03-08 08:59:19 +00:00
Jesus Fernandez
8c86d57e32 Async open file support in QNetworkAccessManager
This change adds support for BackgroundRequestAttribute to local file request. It is useful
when opening files located in network drives where the file open operation could take several
seconds to complete. When this attribute is activated the QNetworkAccessManager::get call
returns the reply immediately and the user has to wait until QNetworkReply::finished signal
is emitted or QNetworkReply::isFinished function returns true.

Task-number: QTBUG-45925
Change-Id: Ie2019dd94fe04253d1ef6874811d7e749a5aad93
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-03-07 18:07:37 +00:00
Fredrik de Vibe
95ea7552a1 Rename test to comply with coding conventions.
Test was inappropriately named according to
https://wiki.qt.io/Writing_Unit_Tests#Naming_of_test_functions_is_important

Task-number: QTBUG-51288
Change-Id: I1c97cee80b5fbf41182b9472ba683862a576b83c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-03-07 15:02:23 +00:00
Alexander Volkov
559152d911 Make an implicit grab on TouchBegin for a widget subscribed to a gesture
A receiver of TouchUpdate and TouchEnd events is determined either
as a widget which has an implicit grab for the touch point or as a
visible widget if there are no implicit grabs. The events are sent
if the receiver has accepted TouchBegin event or if it is subscribed
to a gesture. Before sending the events to the widget they are
delivered to the gesture manager. Thus, in order to detect gestures
for the widget, it must own an implicit grab or be a visible widget.

It can happen that the parent widget is subscribed to a gesture, but
doesn't accept TouchBegin event, as in the case of QScrollArea. Then it
will not get an implicit grab and gesture detection will be impossible.

Activate an implicit grab for such widgets. Also don't send TouchUpdate
and TouchEnd to them, because it's against the documentation.

Task-number: QTBUG-43277
Change-Id: Id767583991def6d76c48ad15eb39af822cad115d
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2016-03-05 21:49:59 +00:00
Marc Mutz
d4b6ed3c18 tst_qglobal.cpp: fix compilation with an actual C++14 compiler
Change-Id: I66819f3708f0489006f997f43f1051b81f7b647e
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-05 09:57:46 +00:00
Fredrik de Vibe
48f25caac4 Check if socketEngine is set before accessing it.
QTcpServer::addPendingConnection() is protected, so it is possible to
add pending connections from a class derived from QTcpServer. This
derived class can get a QTcpSocket from somewhere else, in which case
d->socketEngine will not be set (or used). Given that it is possible to
add pending connections in this scenario, it would make sense to be able
to retrieve them as well.

[ChangeLog][QtNetwork][QTcpServer] Permit using a QTcpServer with
externally created QTcpSocket.

Task-number: QTBUG-51288
Change-Id: I830c10f1a881e2bca4e4ad716d8be865e1c27a9f
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-04 08:11:54 +00:00
Tony Sarajärvi
43e535dd6f Blacklist tst_qnetworkreply tests that fail in RHEL 7.1
Task-number: QTBUG-51545
Change-Id: I0f5fdef315f87401ca5e638bce5dd2dbe85bcb83
Reviewed-by: Akseli Salovaara <akseli.salovaara@theqtcompany.com>
2016-03-03 09:17:44 +00:00
Joerg Bornemann
2b2232b5ea Speed up tst_QLocalSocket::sendData
The data function for this test re-used listenAndConnect_data that
has an additional column "connections" which was never used in sendData.
Thus sendData executed three times the same code which is just uselessly
burned CI time.
Copied the actually needed code of listenAndConnect_data to sendData_data.

Change-Id: I6cdb1c1b72cb4ce7be7c13e90eea30ac09a14914
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-03-03 08:25:04 +00:00
Dan Cape
36ecf2c025 Fix QTextEdit/QQuickTextEdit undo bug - Part #2
If a user selected the text "foo" and typed "bar", upon pressing undo,
the text would change to "b". This is incorrect and does not match the
functionality of QLineEdit or the default behaviours of Windows/OSX/Ubuntu.
This was fixed by a change made to always merge two sequential inserts
if they are not part of the same block. Previously the selection delete
and the "b" were part of one edit block and "ar" was part of another.
With this change, the selection delete and "bar" are part of the same
edit block.

Unit test changes are part of a separate review (Part #1) since they
required changes in qtdeclarative.

[ChangeLog][QtGui][Important Behavior Changes] Fixed QTextEdit to match
undo functionality of QLineEdit to group two sequential inserts into one
undo action.

Task-number: QTBUG-38825
Change-Id: I76bf30e331e3526277c3e0ade58cf95b611fc117
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-03-02 16:00:02 +00:00
Friedemann Kleint
0aed4fd941 tst_qimagewriter: Fix leaking temporary files.
Add missing slash to the prefix pointing to the temporary directory.

Change-Id: I0d00f706af58214a9922758a60d097cab7d6bc9d
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2016-03-02 14:53:08 +00:00
Friedemann Kleint
235c1c776a Fix test tst_QIcon::fromThemeCache().
Verify that the temporary directory could be created. Check whether
the gtk-update-icon-cache binary exists before running and skip cleanly.
Check successful execution. Fixes Windows warnings:

SKIP   : tst_QIcon::fromThemeCache() gtk-update-icon-cache not run
.\tst_qicon.cpp(707) : failure location
QWARN  : tst_QIcon::fromThemeCache() QTemporaryDir: Unable to remove "D:\\temp\\tst_qicon-DSSn9G" most likely due to the presence of read-only
files.

Change-Id: Ibc8f883121e62b30d71586bc64b42eb6c480925f
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-02 07:14:47 +00:00
Alex Trotsenko
4d0672ed42 Integrate network sockets into the multichannel infrastructure
Change-Id: I96974a7460c29b46cae8a28aadb3e50cdcdb7beb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
2016-03-01 15:35:36 +00:00
Maurice Kalinowski
cb6d751efa Fix tests for platforms without process support
Change-Id: I2d1cefdb5ff574635a75b54499efc392aba84434
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-03-01 09:27:13 +00:00
Liang Qi
24cd4a7190 Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: Ic7aaa06f4a14b1aed61faa1a6e7f527ee0eeb96b
2016-03-01 08:23:55 +01:00
Joerg Bornemann
6f75c189e1 Fix crash in QProcess::waitForFinished on Windows
Suppose the user connects QProcess::readyReadStandardOutput with a
slot that calls QCoreApplication::processEvents.
Assume the event loop did not handle events between QProcess::start
and QProcess::waitForFinished. The process writes to stdout and exits.
QProcessPrivate::waitForFinished calls drainOutputPipes which calls
QWindowsPipeWriter::waitForReadyRead. This in turn will trigger
_q_processDied via the readyRead signal and processEvents.
_q_processDied will delete the pid object and set pid to null.
After drainOutputPipes returns, _q_processDied is called again but it
must not be called if pid is already destroyed.

Prevent calling _q_processDied if pid is null.

Task-number: QTBUG-48697
Change-Id: Iee047938ee1529057a1a43d71f4e882750903c7e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-02-29 17:52:58 +00:00
Friedemann Kleint
c7e213334b tst_QDialog: Instantiate test dialog on the stack.
Remove the member variable and instantiate only where needed
on the stack to prevent it from interfering with windows created
by other tests.

Remove flag Qt::X11BypassWindowManagerHint as it does not seem
to have any effect.

Task-number: QTBUG-51516
Change-Id: I3bf88bf148f365c57aaf989671f8b9c3c3f0d8e2
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-29 15:04:40 +00:00
Liang Qi
a224dfc9d1 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	tests/auto/corelib/io/qprocess/tst_qprocess.cpp

Change-Id: Ib6955eb874b516b185b45d6c38cec646fbaa95f4
2016-02-29 12:34:31 +01:00
Joerg Bornemann
d345783e4d Remove superfluous Windows CE special cases from tst_qprocess.cpp
Use default timeouts for wait functions. The increased timeouts will
only have an effect if the tests fail.
Print process errors if the process could not be started, while we're at
it.
Contract consecutive "#ifndef Q_OS_WINCE" blocks.

Change-Id: I6324e4c5b91b89ebb2580635b88705bbda922907
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-02-29 10:01:40 +00:00
Marc Mutz
a7885c9756 QVector: preserve capacity in clear()
This is what std::vector implementations usually do,
because it minimizes memory fragmentation and useless
allocations since no user will call clear() unless
she intends to append new data afterwards.

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

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

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

Change-Id: I9cebe611a97e027a89e821e64408a4741b31f1f6
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-29 07:57:47 +00:00
Marc Mutz
77164e4cc0 QRegion: make iterable
Virtually all code in Qt that inspects a QRegion does
so by calling rects(), which returns a QVector<QRect>.

But rects() has a problem: A QRegion that contains just
one rectangle internally is not represented by a QVector,
and the mere act of calling rects() makes QRegion create
one.

So, expose the fact that QRegion is a container of QRects
to users by providing iterators and begin()/end(), which
can be nothrow, since for the one-rectangle case, instead
of vectorize()ing the region, we just return pointers to
(and one past) the 'extent' rectangle.

As a consequence, the iterator type is just const QRect*,
but I think that whatever containers QRegion may use under
the hood in the future, it will be certainly one that is
layout-compatible with a C array.

No mutable iterators are provided, since QRegion maintains
a running bounding-rect, so a mutable iterator would have
to call into QRegion for every change, which doesn't make
sense.

[ChangeLog][QtGui][QRegion] Is now iterable as a container
of QRects: added {c,}{r,}{begin,end}().

Change-Id: I2fa565fac0c1d26e2c0937604b23763cd4e23604
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-28 19:06:44 +00:00
Friedemann Kleint
c3761bf6a7 tst_QDialog::snapToDefaultButton(): Do not check on exact cursor position unless hint is set.
Given the flakyness of cursor positioning, loosen the check to only verify
that the cursor is outside the window. The hint is only active on Windows
depending on a system setting.

Task-number: QTBUG-51516
Change-Id: I474d251cc41e68f182baf8dba84eaf38d914d7ee
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-26 19:17:19 +00:00
Friedemann Kleint
bc5917a10a Fix warnings about constructor initialization order in tst_QObject.
tst_qobject.cpp: In constructor 'DispatcherWatcher::DispatcherWatcher(QEventLoop&, int*, int*)':
tst_qobject.cpp:5871:10: warning: 'DispatcherWatcher::m_statusAboutToBlock' will be initialized after [-Wreorder]
tst_qobject.cpp:5870:10: warning:   'int* DispatcherWatcher::m_statusAwake' [-Wreorder]
tst_qobject.cpp:5815:5: warning:   when initialized here [-Wreorder]
tst_qobject.cpp:5870:10: warning: 'DispatcherWatcher::m_statusAwake' will be initialized after [-Wreorder]
tst_qobject.cpp:5869:17: warning:   'QEventLoop* DispatcherWatcher::m_eventLoop' [-Wreorder]

Amends change c5d4972577.

Task-number: QTBUG-18434
Task-number: QTBUG-32859
Task-number: QTBUG-36434
Change-Id: I03a9c872469334741a26b4dc1783a36d48f1556f
Reviewed-by: Paolo Angelelli <paolo.angelelli@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-26 17:37:32 +00:00
Tony Sarajärvi
12705f70c9 Blacklist a font dialog test that fails
This test has failed already in openSUSE 13.1 where
it has been marked as insignificant. Incorrect font
size is returned from a font dialog in tst_qfontdialog.

Task-number: QTBUG-46056
Change-Id: I7b5841e90d4cbe9d9573b46ec7dec64432160473
Reviewed-by: Akseli Salovaara <akseli.salovaara@theqtcompany.com>
2016-02-26 10:57:50 +00:00
Tony Sarajärvi
78904a38f6 Blacklist tst_QStyleSheetStyle::hoverColors as it is flaky
Task-number: QTBUG-51400
Change-Id: I29793b2da26951ace3a32df7e5e0d0a2dfdac759
Reviewed-by: Akseli Salovaara <akseli.salovaara@theqtcompany.com>
2016-02-26 10:57:45 +00:00
Edward Welbourne
45ae0cb780 Remove a mis-placed QSKIP().
It made us skip the rest of the test, not just the small set of
sub-tests that were conditioned by the if () in whose else it sat.

Change-Id: I5e914e0aeb9d5ba44b21966d071aaccbc590365d
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-02-26 09:22:35 +00:00
Marc Mutz
0a8fd9c620 tst_qguimetatype::flags(): port to QTypeInfoQuery
QTypeInfoQuery was introduced for 5.6 to decouple isStatic
and isRelocatable so old code continues to work. But since
this test still uses !isStatic to mean trivially-relocatable,
it will fail as soon as one of the checked types is marked as
Q_RELOCATABLE_TYPE instead of Q_MOVABLE_TYPE.

Incidentally, such a change is in the pipeline for Qt 5.7/5.8,
so fix the test by porting to QTypeInfoQuery. Do this in 5.6,
because that's when QTypeInfoQuery was introduced.

Change-Id: I06f815f26ca9b430e124c4a2f8de2a729999762b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-26 09:12:23 +00:00
Friedemann Kleint
c0963486ce QScreen::grabWindow(): Scale the coordinates.
The coordinates need to be scaled before calling QPlatformScreen::grabWindow()
On return, set a devicePixelRatio on the pixmap.

Adapt the QWidget test to scale the grabbed pixmaps.

Fixes pixeltool displaying the wrong part of the screen when High DPI scaling
is in effect.

Task-number: QTBUG-46615
Change-Id: I12de7df0da669230cf0fae74f4a42d43f061d5ff
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-02-26 07:16:48 +00:00
Kai Pastor
44357dbe42 QMacPrintEngine: Really set the printer resolution
As already reported in 2009 (Qt 4.6) QPrinter never actually set the
printer resolution. This change adds the necessary call to
PMPrinterSetOutputResolution (available since OS X 10.5).

[ChangeLog][QtPrintSupport][OS X] QMacPrintEngine now really sets the
printer resolution.

Task-number: QTBUG-7000
Change-Id: I3e851b62e1a7ed78564a8a6fd576b0a18d7eff63
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
2016-02-25 18:42:47 +00:00
Liang Qi
3ed944b843 Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/dev 2016-02-25 12:23:23 +00:00
Liang Qi
5439451def Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	mkspecs/features/qt_module.prf
	src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm

Change-Id: I7912c23b02b186831f0e465dbe5d1f9936205439
2016-02-25 09:55:25 +01:00
Tony Sarajärvi
d8f4d4452d Adjust tst_qabstracttextdocumentlayout for border cases
OpenSUSE 42.1 failed this case for some reason. With this change
the test tests the anchor from the middle of the string instead
of looking for it from the end.

Task-number: QTBUG-51345
Change-Id: I2fc7496399f46926f261c7a1f48756bfaf782f7b
Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-25 07:37:49 +00:00
Joerg Bornemann
696a4bc2f9 Remove legacy from tst_qprocess.cpp
The windows.h include is not needed, the enums are properly known to
the metaobject system nowadays, and qprocess_p.h already has a
QT_NO_PROCESS guard.

Change-Id: I6bbdce19f097feb8260c51a29425279049aa0192
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-02-24 16:05:05 +00:00
Joerg Bornemann
479167cd4e tst_QProcess: Transform loop into additional test rows
Do not use a loop to execute similar but separate tests in
tst_QProcess::softExitInSlots. Use separate test rows with
distinguishable data tags instead.
This way we can deduce from CI output which part of this test failed.

Change-Id: Ic9bc996f2ced11b2bb1c33c1970e64937d860976
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-02-24 16:05:03 +00:00
Liang Qi
1fadc7292b Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
	src/plugins/platforms/windows/qwindowsfontengine.cpp
	src/plugins/platforms/windows/qwindowsnativeimage.cpp
	tests/auto/gui/kernel/qwindow/BLACKLIST
	tests/auto/gui/kernel/qwindow/tst_qwindow.cpp

Change-Id: I649b32b260ce0ed2d6a5089021daa0d6a8db85f7
2016-02-24 13:31:14 +01:00
Anton Kudryavtsev
9e59174b49 QPixmap: check data ptr in isQBitmap()
Task-number: QTBUG-51271
Change-Id: I670e074ced1217d2614fa334eb365e40ef80b8b1
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-24 12:13:56 +00:00
Błażej Szczygieł
7091be1b79 xcb: Deliver mouse enter event to window when closing modal window
When a modal window is closed and the mouse is not under the modal
window - find a proper window and send a fake enter event.

Added auto test for checking enter event on window when modal window
is closed.

Task-number: QTBUG-35109
Change-Id: I370b52d386503820ac9de21e6d05fd019ca456ec
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2016-02-24 09:03:14 +00:00
Friedemann Kleint
bf44f002ca Blacklist tst_QTreeView::setSortingEnabledChild() on Windows.
Task-number: QTBUG-51149
Change-Id: I7887aea5a6046353e235655665e53b5953f0854b
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
2016-02-24 08:20:11 +00:00
Błażej Szczygieł
57ecd5aeeb QtWidgets: Proper delivery of enter/leave event to context menus
First-level context menu grabs the mouse, so all mouse events are
delivered to it. This menu passes the mouse events to submenus. Any
platform delivers mouse enter/leave event differently when window is
grabbed. This patch unifies event delivery to context menus - it can
block some unwanted events and it emulates fake events if necessary.

This patch can reduce duplicated events and can provide proper enter
or leave event to additional widgets in the context menu. It can also
prevent submenu from unwanted close on Windows and X11.

Added autotest.

Task-number: QTBUG-45565
Task-number: QTBUG-45893
Task-number: QTBUG-47515
Change-Id: I7dd476d0be23afa34e947e54aef235012d173dcf
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2016-02-24 04:33:36 +00:00
Christian Strømme
d392826959 Make it possible to preserve the library/plugin path in tst_selftest
If QT_PRESERVE_TESTLIB_PATH is set, then LD_LIBRARY_PATH and
QT_PLUGIN_PATH won't be filtered out for the sub-tests started by
tst_selftest.

Change-Id: Ic43ba9b4d882ee36b2f7495b1c880f26aefd2629
Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com>
2016-02-23 21:16:44 +00:00
Dmitry Shachnev
b6a824d0a3 Add native support for D-Bus global menu
The protocol was originally developed by Canonical, currently supported
by Unity and Plasma.

Adjust some tests to use the non-native menu bar when they require it.

[ChangeLog][XCB / X11] QMenuBar uses the unified D-Bus AppMenu menubar
when the desktop environment supports it.

Change-Id: Iea74b40522573bcc4f70168fe7fa2a49b4f3fc21
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2016-02-23 20:56:07 +00:00
Eirik Aavitsland
950bb7185c Autotests: if cross-compiling, ignore dbus status on compilation host
The auto.pro file would bail out or skip based on the availability of
the session bus at qmake time. That does not make sense for cross
compilation: the session bus may be available on the target even if it
is not on the compilation host.

Change-Id: I459a518f3411acb39e8dcdad9d32ded1f9b57029
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-02-23 12:19:31 +00:00
Simo Fält
0ac8c8698c Autotest: Blacklist tst_QFontDialog::setFont()
This test fails in distros using GNOME due to
most likely bad usage of native dialogs.

Task-number: QTBUG-51148
Change-Id: I6e539b429266e298ce413565e0191bffa7fbe6bc
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-23 07:30:34 +00:00
Samuel Gaist
6129aade00 QListWidget: setup connections when changing selection model.
QListWidget uses a set of slots for its selection model that are
connected only at creation time. This patch adds the missing
connections cleanup and setup when a user changes the selection
model.

Task-number: QTBUG-50891
Change-Id: I942bae6c471ea1ae22637d09b96d6fbd422f653f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-21 20:50:18 +00:00
Marc Mutz
1da975cdc5 QLatin1String: add at()/op[]/mid()/right()/left()
QLatin1String can be used as a string-view-like type.
When attempting to do so in uic, mid() and at() were
found to be missing. Added the others for completeness.

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

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

Change-Id: I4cfe3e9ed1157dedee754b2012d9678fe72b161e
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-19 18:16:38 +00:00
Simon Hausmann
bcc965ef4b Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: I7bee7df50af3d607a349b68103cd2c67791281fb
2016-02-19 12:02:49 +01:00
Friedemann Kleint
11cd0902e6 Re-enable tst_QTreeView::setSortingEnabled on Windows.
The test was made insignificant for Windows in change
f3939d943e. As the failure is not
reproduceable locally, re-enable it. Also split apart the test.

Task-number: QTBUG-51149
Change-Id: I6a06bdf2369bc3bdbc73dfe4fa416e9d644f8b01
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-18 22:54:19 +00:00
Friedemann Kleint
5d2068b912 Prospective fix to stabilize tst_QMdiArea::subWindowActivated2()/xcb.
Ensure that the window is active (as otherwise
QMdiArea::activeSubWindow() returns 0) and add a QTRY_COMPARE.

Change-Id: I7edb01d43fd2635864266614ef9a0e844f76edbf
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2016-02-18 22:53:22 +00:00
Liang Qi
4fe2fbcf82 Merge remote-tracking branch 'origin/5.6' into 5.7
This also reverts commit 018e670a26.

The change was introduced in 5.6. After the refactoring, 14960f52,
in 5.7 branch and a merge, it is not needed any more.

Conflicts:
	.qmake.conf
	src/corelib/io/qstandardpaths_mac.mm
	src/corelib/tools/qsharedpointer_impl.h
	tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp

Change-Id: If4fdff0ebf2b9b5df9f9db93ea0022d5ee3da2a4
2016-02-18 20:50:35 +01:00
Vyacheslav Grigoryev
34472e946a QSqlDriver: use table prefix in WHERE clauses
If the WHERE clause is used in a query involving multiple tables,
such as generated by QSqlRelationalTableModel, the table prefix
may be necessary to disambiguate column references. It is harmless
if not needed.

Task-number: QTBUG-43320
Change-Id: I39e1ab7359bf748afa8bcd8578220e3abb3ee24a
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2016-02-17 23:13:58 +00:00
Oswald Buddenhagen
86c5a337e3 Merge "Merge dev into 5.7" into refs/staging/5.7 2016-02-17 19:57:54 +00:00
Stephen Kelly
bfeb2fdd79 QStandardItemModel: Reset the flags on clear()
Pass modeltest after clear().  Otherwise it fails because more flags
than Qt::ItemIsDropEnabled get returned for the QModelIndex().

Change-Id: I8f11515cc7dc9383f528f785312ffb77b3c2699d
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-17 11:39:13 +00:00
Tony Sarajärvi
837d717b13 Blacklist tzTest in openSUSE 42.1
The test was already blacklisted in openSUSE 13.1 and
was found not to work in 42.1 either.

Task-number: QTBUG-51172
Change-Id: I9f8f7b2251a230596a25183dee04ed37824f8ad7
Reviewed-by: Akseli Salovaara <akseli.salovaara@theqtcompany.com>
2016-02-17 11:28:31 +00:00
Tony Sarajärvi
042f9eaeb4 Blacklist tst_QStorageInfo::storageList
A bad test that assumes hard disk being
partitioned in a specific way

Task-number: QTBUG-51174
Change-Id: Ic4d56fbd041444e00bd656372e9190ba07ff2704
Reviewed-by: Akseli Salovaara <akseli.salovaara@theqtcompany.com>
2016-02-17 11:28:23 +00:00
Anton Kudryavtsev
a3b8e355fc QListView: fix skipping indexes in selectedIndexes().
Remove spurious increment of i.

Task-number: QTBUG-51086
Change-Id: I4307a6728de1e7f25c8afa31fe2066f92373f3fc
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-17 04:53:16 +00:00
Maurice Kalinowski
ad16703fa8 Update testdata
Some entries were not updated and tests failed to succeed on platforms
which need to deploy content/testdata.

Change-Id: Ieb2b44c375b04cbaaecc1fb2303cc2478b86a100
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-02-17 04:50:50 +00:00
Maurice Kalinowski
8b0dc80294 winrt: Fix usage of testdata
testdata needs to be deployed to temp and current directory
needs to be set to that directory for the test to succeed.

Change-Id: I2dd023af9073d90afbb4ad60fcfb50bb1af4e159
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-02-17 04:50:14 +00:00
Maurice Kalinowski
6c7c34f219 winrt: Disable tests which connect to localhost
WinRT does not allow do connect to the localhost due to security
constraints and sandboxing. Hence we need to disable those
currently.

Change-Id: Idb8c71397a41e5fa5bad9d618dba1bb389e71b9c
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-02-16 19:35:10 +00:00
David Faure
78b8f7803b QtConcurrentRun: add unittest for polling for isFinished()
I had intermittent failures with this kind of code in my unittests,
not sure why yet. This test seems to pass reliably, apart from
helgrind saying it triggers the known race in QFuture::isFinished,
for which Marc is working on a fix.

Change-Id: I4aabe77566dc1af859a016ffe8a4cce19ddf25c8
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-15 13:53:57 +00:00
David Faure
bbc830ce3e QIcon::fromTheme(): add support for absolute paths.
This allows methods that return an icon name, to sometimes also
return an icon full path (e.g. because the icon was dynamically generated
and stored into a local cache on disk)

Change-Id: Ib01c3955f4b64236463846241d9814b2d0686634
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-15 13:53:54 +00:00
David Faure
e8ed29d679 tst_QTemporaryFile: test value of openMode() after open().
I had a doubt about what it would be, turns out it's ReadWrite.
Turns out it's documented, too :-)

Change-Id: I87c2ffc81aa240ffa88c495fe250b022d7fb3c21
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-15 13:53:51 +00:00
Peter Kümmel
ab8cc8387f Add qOverload to select overloaded functions
[ChangeLog][QtCore][Global] qOverload added to select
overloaded functions.

Change-Id: I7c9b1b054e6631eca0b5594db59e1202ef552c33
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-15 12:33:24 +00:00
Liang Qi
80bf4bfe3d Merge remote-tracking branch 'origin/5.6.0' into 5.6
Change-Id: I0b190005377a23a91da3563428e223b8a3b18333
2016-02-15 08:09:50 +01:00
Sérgio Martins
6139fbeb5f Introduce QHash::equal_range()
Similar to QMap::equal_range().
Will allow to easily fix inefficient code such as:

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

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

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

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

Change-Id: Ic38721e9028496fc9b50f4d4cef2e7a60532eed8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-13 18:18:48 +00:00
Marc Mutz
afc7da09ec QRegion: add move ctor
After this change, this was the distribution of calls in
QtGui and QtWidgets when the patch was developed for 5.4:

      QtGui  QtWidgets
move  23     63
copy  23     36

Change-Id: If3f536e52fc242c585e7fa0662049c0657efcc9c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-13 18:18:32 +00:00
Paolo Angelelli
c5d4972577 Fix for deferredDelete() bug when calling the glib loop directly
This patch makes sure that all events posted using Qt on top of the
GLib event loop have the loopLevel counter incremented.
This is done since Qt depends on the fact that all deleteLater() calls
are issued within the scope of some signal handler (in other words,
triggered by the chain sendEvent() -> notifyInternal2()).
There is a side effect though: in the conditions affected by this
patch, that is deleteLater()s issued within a glib event handler for
example, manually calling processEvents() or sendPostedEvents() with
or without the QEvent::DeferredDelete flag has the same effect, and
deferred deleted events are always processed.
While this is not a currently working feature which the patch breaks,
this side effect seems to be difficult to avoid without separating
sendPostedEvents() and processEvents() into a public and a private
method, in order to detect when they are manually called.
Such change could perhaps be done for Qt6.
An autotest for QTBUG-36434 is also included.
Autotesting for QTBUG-32859 seems to be more challenging in this
respect, due to its dependency on GLib.

Task-number: QTBUG-18434
Task-number: QTBUG-32859
Task-number: QTBUG-36434
Change-Id: Ib89175aa27c9e38bca68ae254d182b2cd21cf7e9
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-12 19:06:11 +00:00
J-P Nurmi
5be4f95d95 Fix QFileSelectorPrivate::addStatics()
It must clear the previously cached sharedData->staticSelectors,
or else QFileSelectorPrivate::updateSelectors() does nothing and
the newly added static selectors end up being ignored.

Change-Id: If6997664629199be9f00de64c5dd01de2bf0a044
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
2016-02-12 14:10:29 +00:00
Liang Qi
321658d288 Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/dev 2016-02-11 12:57:10 +00:00
Liang Qi
d456f87ece Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/corelib/io/qfilesystemwatcher_win.cpp
	src/corelib/plugin/plugin.pri
	src/plugins/platforms/cocoa/qcocoaaccessibility.mm
	tests/auto/corelib/tools/qlocale/tst_qlocale.cpp

Change-Id: Id6824631252609a75eff8b68792e4d10095c8fc1
2016-02-11 08:25:04 +01:00
Simo Fält
5d8354e63a Autotest: Enable make check on rhel 7.1
Blacklisting all tests, which were failing locally.

Task-number: QTQAINFRA-949
Change-Id: I40c25ab0155b8977596d61297ab252a546515f87
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@theqtcompany.com>
2016-02-11 05:47:38 +00:00
Gabriel de Dietrich
9e8c84aa14 Add SH_ItemView_ScrollMode style hint and use it in QMacStyle
On OS X, the default scrolling mode of item views should be
per pixel instead of per item. We enforce this through a new
style hint. On all other platforms, the behavior remains the
same.

It's still possible to override the style hint by using the
regular scroll mode setters. Any subsequent style change will
result in a no-op once the setters have been called and until
the properties are reset.

Some auto-tests had to be update to to take the new behavior
into account.

[ChangeLog][QtWidgets][Styles] Added SH_ItemView_ScrollMode
style hint.

[ChangeLog][QtWidgets][Item Views] Item views scroll per pixel
on OS X now.

[ChangeLog][QtWidgets][Item Views] QAbstractItemView::verticalScrollMode
and QAbstractItemView::horizontalScrollMode are now resettable.

Change-Id: I3f923275c99aa4389323b52fc1c5455fe71f8d73
Task-number: QTBUG-50102
Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
2016-02-11 04:50:36 +00:00
Aleix Pol
8b4ac65e29 Provide QCss with the correct font for <pre> blocks
Labels would use a statically defined font for <pre> blocks.
Use the one defined by the QPlatformTheme instead, through
QFontDatabase::systemFont(FixedFont)

Task-number: QTBUG-50564
Change-Id: I5491bd0defce651bdf809bcbc6a529a900f4959b
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2016-02-09 21:24:46 +00:00
Maurice Kalinowski
2ddd11dde2 Cleanup testcase for platforms without QProcess support.
Change-Id: Ib56c90262605ad975772f6b26c6232020e308ca6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-02-09 15:45:17 +00:00
Andre Somers
21861e6fd1 Add setFlag method to QFlags
This makes implementing class methods that enable or disable a feature
stored in a QFlags<> member easier.

[ChangeLog][QtCore][QFlags] Added setFlag method to set or unset a flag

Task-number: QTBUG-27100
Change-Id: Ic602abbbf3100df78f21b7918573744d1bbd18c1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-08 10:25:09 +00:00
Eirik Aavitsland
e4f71b0cb5 Crash fix: reject certain malformed bmp images
A malformed bmp file header could specify a negative color table
size. The bmp handler would then return a QImage that claimed to be
valid, but actually was invalid, having an empty color table. This
would cause crash later, e.g. when attempting to paint it.

Change-Id: I7df7c40867557a82dbcee44c7de061226ff232c0
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
2016-02-05 04:14:35 +00:00
Louai Al-Khanji
e9802a1073 tst_qeventloop: replace select with poll
Change-Id: Ib2b71696e24249b0b13bb925a7bb627ef09f2dff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-02-04 22:33:51 +00:00
Allan Sandfeld Jensen
6ec7d7658d Fix rounding error in fetchTransformedBilinear
To calculate the real count we need to use the actual fixed point
increment and can not use the floating point value increment wass based
on since it might round differently.

Includes auto-test by Gabriel de Dietrich.

Task-number: QTBUG-50153
Change-Id: Ia973088f361c90370fa20bac14a4b8f373b5d234
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-02 22:47:10 +00:00
Edward Welbourne
bb1924c345 Pass -silent to lrelease to avoid cruft in test logs.
Change-Id: I7cf2808187f97b6319f7561fe06ddef476fa9aa0
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-02-02 16:28:07 +00:00
Edward Welbourne
04def3a878 Don't clutter up the source tree with .qm files generated by testing.
Generate the qundo*.qm files for tst_QUndo*::commandTextFormat() in
the current directory (out of source, for a shadow build) rather than
alongside the qundo*.ts from which they're derived (in the source
tree); and remove them once loaded, if that succeeds.  (On failure, we
might even want to look at them.)

Task-number: QTBUG-49081
Change-Id: I666985fa3ceb8c25c917b617d6d39141eddebb76
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-02-02 16:27:55 +00:00
Błażej Szczygieł
751e2ce44f Clean up tst_qwidgetwindow
Rename TestWidget to PaintTestWidget, because this class tests only
whether paint event occurs.

Remove unused variables.

Remove reset() method, because there is no need to reset only one
variable in class method.

Change-Id: I8f442c73598e3431baf2b0433fefc157d3f10ea6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-02-02 15:18:19 +00:00
Liang Qi
d3e6e732c7 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	config.tests/unix/compile.test
	src/plugins/platforms/cocoa/qcocoahelpers.mm
	src/tools/qlalr/cppgenerator.cpp

Change-Id: I0103ca076a9aca7118b2fd99f0fdaf81055998c3
2016-02-02 15:57:44 +01:00
Oswald Buddenhagen
615534f14c Merge 5.6 into 5.6.0
Change-Id: I95962e28b6fc101cbbad41230585e2b61f1f6c0f
2016-02-02 13:12:21 +01:00
Andy Shaw
0c019d7bd2 QDockWidget: Restore using setGeometry since the geometry is used for the state
This solves an instance where restoreState() was used when the
dockwidget was already floating and the saved state was also for
a floating dockwidget.

Change-Id: I1fe764ae2a6b0351ae26e33ffec682ad37c944d7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-02 07:43:13 +00:00
Dmitry Shachnev
b84c61b088 Stop Q_AUTOTEST_EXPORTing QKeyBinding and QKeySequencePrivate
The QKeySequence test no longer uses private members (since commit
725bdc3fd2), so that is no longer needed.

Also, remove the unused include from the test.

Change-Id: I4d252bb3efd7282f74c44e48444c23ab51d48ea5
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-02 05:57:08 +00:00
Tor Arne Vestbø
d10bfff89a Revert "QWindow::destroy(): only reset QGuiApp::focus_window and friends as a last resort"
This reverts commit 4c71db7567.

It's too risky for 5.6, we should let it cook in dev for a while
and backport when ready.

Change-Id: I91e677e65d967f29c84a254cd3dffc8bb847b263
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2016-02-02 02:12:26 +00:00
Alex Trotsenko
599dbc5e43 Stabilize tst_QProcess::softExitInSlots()
After the commit 7ff655360f, case 4 in SoftExitProcess class relates
to a channelReadyRead() signal instead of stateChanged(). Accordingly,
terminateSlot() is fixed to handle a special case when process is not
running.

Change-Id: Ie0d3284f5d264037d00e4ad6d927c0766be562b0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-02-01 16:39:23 +00:00
Liang Qi
a43e7b4d93 Merge remote-tracking branch 'origin/5.5' into 5.6.0
Change-Id: Ie58c80cf612efe1aa08a837f112437a87a844276
2016-02-01 16:33:43 +01:00
Eskil Abrahamsen Blomfeldt
dce530b64e Fix bounding rect of glyph runs in multi-line QTextLayout
When getting the glyph runs from a QTextLayout with multiple
lines, the glyph runs would be merged if possible, but not their
bounding rects. This was an oversight.

[ChangeLog][Text][QTextLayout] QTextLayout::glyphRuns() now returns
united bounding rects for glyph runs that are merged.

Change-Id: Ibbeaa99ecfc4e82e7965342efdae7c3c2b637343
Task-number: QTBUG-50715
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-30 06:53:44 +00:00
Tor Arne Vestbø
f576f438bf Add basic QKeyEvent auto-test
Change-Id: I732723389edf0970e9688966407c728d38538d0a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2016-01-30 05:13:21 +00:00
Thiago Macieira
0ad153b76e Autotest: rename the test class so it's different in this test
Change-Id: I3d11545be52c43119f0fffff142b0e5e91b1e878
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-30 03:20:54 +00:00
Tor Arne Vestbø
4c71db7567 QWindow::destroy(): only reset QGuiApp::focus_window and friends as a last resort
Resetting focus_window and other internal QGuiApplication variables before
calling setVisible(false) and destroying the platform window means that the
platform window can't reason about whether or not it was the focus window
unless it can resolve that using native APIs. We should let the platform
window take care of resetting the focus window and related states, and
only execute our fallback logic if the plugin doesn't do the right
thing.

We also use QPA to update the state instead of modifying the internal
QGuiApplication variables directly, so that events and signals are
emitted as a result of the reset.

The QLineEdit test gets two added calls to processEvents(), since
assuming that activateWindow() is synchronous is not correct, and
would result in the QMenu resetting the focus window to 0 on destroy.

Task-number: QTBUG-46414
Change-Id: I562788393ed0ffd77d7a4be2279862322f721c1a
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2016-01-29 19:29:14 +00:00
Maurice Kalinowski
2515e1eb3d winrt: cleanup testcases
We have to make sure that the plugins to be tested are located inside
the virtual sandbox / relative to the application binary. Launching via
winrtrunner, a test can find those plugins then. It is not possible to
those via TESTDATA and extract them to temp, as LoadPackagedLibrary only
loads inside the sandbox.

Unfortunately this also implies that running those tests inside Visual
Studio will fail, as Visual Studio copies the virtual sandbox to another
location missing the plugins. For automated testing this should not
matter though.

Change-Id: I70f5ef2d56b3cf526b731fd885f12583c8f6e103
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-01-29 13:35:48 +00:00
Konstantin Ritt
3e5719ae7b QFont: Fix possible cache misses due to misprepared cache key
Parse the requested family before we're looking/saving into the cache,
thus hitting the cached EngineData for:
* quoted family names (eg. QFont("'Arial'"))
* non-simplified family names (eg. QFont(" Arial  "))
* substituted family names (\sa QFont::insertSubstitution())
* explicit fallback list, where possible (eg. QFont("Tahoma, Arial"))

This also improves the cache hitting for the font engines in some cases.

Change-Id: I18cdc3e8d669cccec961f84e9b27329402e2b7ed
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-01-29 11:24:49 +00:00
Liang Qi
270cc073b7 Merge "Merge remote-tracking branch 'origin/5.5' into 5.6" into refs/staging/5.6 2016-01-29 12:55:06 +00:00
Edward Welbourne
2736d7921d Don't let a good day cause date-time parser to forget a conflict.
Setting conflicts to isSet & DaySection cleared it if we hadn't seen
the day stipulated, even if there had been a conflict (e.g. over year)
before we hit the day-of-week that didn't match the (unset, so
defaulting to) 1st of the month.  Explicitly test for conflict and
only set conflicts (to true) if there is a conflict.  Added regression
test.

Change-Id: I7363eb66a8bb808d341738d14969039834f50db8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-01-29 10:35:03 +00:00
Liang Qi
a81036c3cc Merge remote-tracking branch 'origin/5.5' into 5.6
Change-Id: I7831f560165fa08882ae54efeaea1f0146c3358c
2016-01-29 11:13:41 +01:00
Alex Trotsenko
7ff655360f Integrate QProcess into QIODevice's multistreaming infrastructure
As a result, this patch eliminates double-buffering in QProcess.

Change-Id: I436faa4a5ffc28ce77f959dd6089bef400ac39f6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-29 09:14:44 +00:00
Alex Trotsenko
8f92baf5c9 Adapt QFileDevice to use QIODevice's write buffer
Also, bump the TypeInformationVersion field in qtHookData, to notify
the Qt Creator developers that the offset of QFilePrivate::fileName
was changed and dumpers should be adapted.

Change-Id: I71bc5f509b733c0ab3430cd47ff08961f0388839
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-29 09:14:36 +00:00
Konstantin Ritt
5f472cae71 QFontCache: Centralize the engine type safety check
We depend on the assumption QFontCache::findEngine(key) for key.multi=1
returns a font engine of type QFontEngine::Multi;
guarantee that by checking it in a single place.

Change-Id: I287da4fd62deb22fc5520cde5b0505bc44547609
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-01-28 18:24:08 +00:00
Błażej Szczygieł
58f8dd4f92 QtWidgets: Allow to cover up the window container by another widget
When the window container already has a window handle, allow embedded
windows to use this handle as a parent. This change will allow proper
window stacking and clipping.

Task-number: QTBUG-50477
Change-Id: I8d656ecb99e0c42ae7a7ac461e5e5b5d801f5493
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2016-01-28 17:40:53 +00:00
Tor Arne Vestbø
33bdb93ae1 Remove some old QT_MAC_USE_COCOA cruft
Change-Id: Ib9cb57563274c722023084e94f2cd439088366a8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2016-01-28 16:30:24 +00:00
Pavel Geiger
eedf16c96f uic: Accept an -idbased argument
When we want to use qtTrId function instead QApplication::translate in
generated files it's not possible to use custom function with presented by
the --tr argument due to signature difference between qtTrId and
QApplication::translate function.

With this argument present, uic will generate qtTrId function with second
argument empty. When used together with --tr parameter it will use
presented function instead.

Change-Id: I0d986e4ea25ce58917fd9a2866b1eac0a4671502
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
2016-01-28 14:07:43 +00:00
Samuel Gaist
a40ea0948d MySql: add failing connection test
This test ensure that a connection made to either an invalid host or an
unreachable host fails properly.

Task-number: QTBUG-47452
Change-Id: If31d23d815e496fc21ef2e1e19c34c2723bd3504
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-27 23:53:25 +00:00
Alex Trotsenko
41e59ae0fa QIODevice: make the read/write chunk sizes configurable
By default, the read chunk size is QIODEVICE_BUFFERSIZE and the write
chunk size is 0 (which means that we don't use the internal write buffer).
Derived classes may override these values to define the size of
QIODevice's write buffer or to optimize the read buffer use.

Bump the TypeInformationVersion field in qtHookData, to notify the
Qt Creator developers that the offset of QFilePrivate::fileName was
changed and dumpers should be adapted.

Change-Id: Ib732bc94be8da8a5514a6e5dcc04445895f130d8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-27 06:32:49 +00:00
Alex Trotsenko
1c0494e63b QIODevice: add infrastructure for multistreaming
Some sequential devices allow data to be partitioned into several
channels that have the property of independently sequenced delivery.
Supporting such devices uniformly requires a unified API which provides
the user with a uniform concept of multistreaming.

This patch is based on QProcess's multiplexing model and introduces
the following features:

 - ability to get the number of channels;
 - multiple internal read/write buffers;
 - channel selection functions;
 - notification signals on channel activity.

To keep the source code compatible with single-channel implementations,
introduce a private class that references the current read buffer and
hides multistreaming internals from the user.

Bump the TypeInformationVersion field in qtHookData, to notify the
Qt Creator developers that the offset of QFilePrivate::fileName was
changed and dumpers should be adapted.

[ChangeLog][QtCore] Added multistreaming to QIODevice.

Change-Id: Idcaa6a618927c101c4c7284d2a633913be6a6ee2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-27 06:32:30 +00:00
Liang Qi
f3060312c8 Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/dev 2016-01-26 19:40:45 +00:00
Liang Qi
a15c3d086d Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
	src/dbus/qdbusconnection_p.h
	src/dbus/qdbusintegrator.cpp
	src/dbus/qdbusintegrator_p.h
	tests/auto/corelib/io/qdir/qdir.pro
	tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp

Change-Id: I3d3fd07aed015c74b1f545f1327aa73d5f365fcc
2016-01-26 16:27:28 +01:00
Edward Welbourne
e08fe31f55 Add DST-change test for a date derived via .toLocalTime().
Uses a time derived via .toUTC() to ensure the .toLocalTime() comes
out at the time we expect.

Task-number: QTBUG-49008
Change-Id: I2005127929c7eab1b7a3cbaba8d21df8c9585d17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-26 13:50:09 +00:00
Edward Welbourne
4970a43676 Test .addDays() and .addMonths() are sensible around DST changes.
Task-number: QTBUG-49008
Change-Id: Ie3bf9dfeb67c96b18320e18c14b9680f03cb98e9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-26 13:50:04 +00:00
Timur Pocheptsov
1272bd4d4a qabstractnetworkcache - enable several tests
Remove several test from black-list - they do not seem to fail anymore.

Change-Id: Idb7d6925a4fdea9b47d963e33a455af0afb7b432
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-01-26 13:12:03 +00:00
Liang Qi
0c3ce60c99 tst_qcombobox: Don't use the deprecated QTest::qWaitForWindowShown()
Change-Id: I9a7a5f87e67e6d01d571097e8955d22bc86ca8d6
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-01-26 11:27:40 +00:00
Liang Qi
0a1af55a9b Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/dev 2016-01-26 11:27:37 +00:00
Marc Mutz
cf51e2f33f QStringRef: add missing op[]
[ChangeLog][QtCore][QStringRef] Added subscript operator.

Change-Id: Ia85d5efcb7747d2961ba55922ddabe6a46bdf20b
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-26 11:21:09 +00:00
Borgar Ovsthus
fbd6acedac Add TeamCity logging feature to testlib
This allows TeamCity to parse realtime test-results instead of using
post-build XML Report Processing. This does not support logging of
benchmarks.

[ChangeLog][QTest] Added a new logging mode that allow test-results to
be parsed on-the-fly when using Jetbrains TeamCity as CI-server. This
mode is enabled by using the -teamcity option on the command-line.

Change-Id: Ie730beb643043eb0f448f99abe6c0b5ac48aaf03
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-23 18:30:58 +00:00
Tony Sarajärvi
720d1792f2 Remove insignificant from qabstracttextdocumentlayout test
Task-number: QTBUG-28593
Change-Id: If5a102cd1c8cdad6d77cc8dbcece3ac983a8010b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-01-22 09:13:27 +00:00
Tony Sarajärvi
870e68cd75 Remove insignificant flag from qglyphrun test
Task-number: QTBUG-28593
Change-Id: I04e73947c7f131bdb4341c224fb008b26be22c22
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-01-22 09:13:20 +00:00
Thiago Macieira
7dceb22748 Autotest: make tst_QDateTime pass when LC_TIME != en_US
QDateTime::toString for Qt::TextDate unconditionally uses the system
locale (because QDate::shortDayName and QDate::shortMonthName do).
Setting the default QLocale has no effect. If you ask me, those two
QDate methods are buggy, but they are documented that way.

Change-Id: I408dcb81ba654c929f25ffff1427366b04da5a43
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-22 03:37:54 +00:00
Thiago Macieira
d921a9bd15 Hide better the private API QTextCursor constructors
Both constructors were taking a pointer, so they participated in
overload resolution along with QTextDocument and QTextFrame pointers.

Instead, make them take references and move them to the private section
of QTextCursor. That necessitated adding a method to QTextCursorPrivate
to access that private constructor from non-friend classes.

Change-Id: I7e6338336dd6468ead24ffff1410e3bc534d77dd
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-01-22 03:36:16 +00:00
Thiago Macieira
cfe891eeb8 Add Intel copyright to files that Intel has had non-trivial contribution
I wrote a script to help find the files, but I reviewed the
contributions manually to be sure I wasn't claiming copyright for search
& replace, adding Q_DECL_NOTHROW or adding "We mean it" headers.

Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-21 22:44:21 +00:00
Thiago Macieira
23bd4651c7 Update the Intel copyright year
Not that we require it, but since The Qt Company did it for all files
they have copyright, even if they haven't touched the file in years
(especially not in 2016), I'm doing the same.

Change-Id: I7a9e11d7b64a4cc78e24ffff142b4c9d53039846
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-21 22:44:16 +00:00
Jani Heikkinen
f776595cc1 Updated license headers
From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some
exceptions, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/

Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one
(in those files which will be under GPL 3 with exceptions)

Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-21 18:55:18 +00:00
Jani Heikkinen
18455d5585 Fixed qtbase tests to pass with updated license header
Change-Id: I996a1c3713d0799504bd98ffcdfdc7841c88182a
Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
2016-01-21 18:55:03 +00:00
Liang Qi
158a3a4159 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/corelib/io/qiodevice_p.h
	src/corelib/kernel/qvariant_p.h
	src/corelib/tools/qsimd.cpp
	src/gui/kernel/qguiapplication.cpp
	tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp

Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
2016-01-21 08:17:21 +01:00
Maurice Kalinowski
f05c597ae5 winrt: msvc2015: refactor file handling
msvc2015 reintroduced a couple of functions from the win32 API
towards WinRT.

Enable usage of those and simplify the file system engine.
Furthermore update the autotests.

Change-Id: I9eafffba0ddfd05917c184c4a6b9e166f86d71d9
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-01-21 05:53:17 +00:00
Thiago Macieira
dcc36d7aa3 Autotest: remove the check that broadcast = ip | ~netmask
It's possible to configure an interface so that it isn't the case. I have
no idea if this is a valid scenario, but the unit test shouldn't enforce
that.

ip addr can report:
    inet 192.168.1.1/32 brd 192.168.1.255 scope global vlan0
       valid_lft forever preferred_lft forever

Change-Id: I8de47ed6c7be4847b99bffff141c337575760bd9
Reviewed-by: Richard J. Moore <rich@kde.org>
2016-01-21 05:19:13 +00:00
Jani Heikkinen
7b2fb038ae Merge "Merge remote-tracking branch 'origin/5.5' into 5.6" into refs/staging/5.6 2016-01-21 04:27:06 +00:00
Edward Welbourne
1967accb64 Expand springForward_data() to cover a few more time-zones.
The important one is EET, for the benefit of our CI system; but other
European zones and the USA's coastal zones likely have enough hackers
in them to make this worth checking.

Change-Id: Idcc703bce29808e1a0a6279680cc8d3cbed38dac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 17:11:58 +00:00
Edward Welbourne
f7d9e34b96 Be fussier about setting tst_QDateTime's globals.
Time zones change on the whim of politicians.  Consequently, we can
seem to be in CET/CEST or on UTC (because we tested sample dates when
our zone coincided) when we aren't (i.e. we're in a materially
different zone at the time probed by some particular test).  Make the
initialization of the globals that test this more robust against
governmental meddling and document the unfixable problem with Algeria:
a DST transition *on the epoch*.

Change-Id: I17c5c81d339b80af12f4ffab367e28052dd6c2fa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 17:11:49 +00:00
Edward Welbourne
722df6e0a2 Nomenclature corrections relating to CET.
There are several European time zones; the only one relevant to the
tests here is CET.  They won't work with WET, GMT or EET.  So name
them and related variables for CET, not for Europe.

CET's summer-time isn't called CST; and the (existing) spring forward
test works only in CET/CEST, not elsewhere in Europe.

Change-Id: I55c7544bf792de7495700b749b935ec534831d8b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 17:11:33 +00:00
Kevin Funk
8dad3bf212 Fix toDisplayString(QUrl::PreferLocalFile) on Win
When using QUrl::PreferLocalFile we do want to strip the leading slash,
as toLocalFile() would do as well.

Behavior change by means of an example:
  QUrl url(QUrl::fromLocalFile("C:/file.txt")
  url.toLocalFile() --> "C:/file.txt"

Before:
  url.toDisplayString(QUrl::PreferLocalFile) --> "/C:/file.txt"

After:
  url.toDisplayString(QUrl::PreferLocalFile) --> "C:/file.txt"

Task-number: QTBUG-41729
Change-Id: I7d425541f6077ebcf3fcf46feeb7e0f03a0d7fe2
Reviewed-by: Dominik Haumann <dhaumann@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 13:24:53 +00:00
Eskil Abrahamsen Blomfeldt
4de1d0cb28 Android: Fix some QGraphicsScene tests
1. Use qrc for test data so that it can be found on all platforms.

2. Skip a test which does not work on platforms where show() implies
showMaximized(), as it depends on the window size being 150x150.

3. Skip test for hover event which depends on having a valid
mouse cursor position.

4. Skip a couple of tests that fail on some Android devices.
It's not worth spending a lot of time investigating this at the
moment.

Change-Id: Icb2b7f1d82981546a2154a76535b95606d7f40da
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2016-01-20 07:48:34 +00:00
Thiago Macieira
7ffcafd1b5 Remove all the atomic code besides MSVC and std::atomic
[ChangeLog][Important Behavior Changes] Starting with Qt 5.7, Qt
requires a C++11 compiler with support for C++11 atomics. This affects
user code too: Qt headers no longer compile with a C++98 compiler. The
minimum compiler versions for this release are:
 * Clang 3.4 (found in XCode 5.1)
 * GCC 4.7
 * Microsoft Visual Studio 2012

Change-Id: Ib056b47dde3341ef9a52ffff13ef1f496ea9363f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
2016-01-19 23:41:52 +00:00
Timur Pocheptsov
b530ca770f tst_qtextcocumentlayout::blockVisibility - make the test more robust
The test inserts strings "0" ... "9" into the text document,
takes the half of resulting document's size, makes half of
lines invisible and compares sizes. On OS X 10.11 after inserting
"4" the width changes, so making "4" invisible also reduces the width
and QCOMPARE(currentSize, previosHalfSize) fails. Instead of digits,
insert the same string "A" 10 times.

Change-Id: Ie88a0442703f98949cea9bcdb694cecee59695f3
Task-number: QTBUG-49848
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-01-19 14:48:47 +00:00
Liang Qi
8f569c740a Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
	config.tests/common/atomic64/atomic64.cpp
	configure
	src/3rdparty/forkfd/forkfd.c
	src/corelib/io/forkfd_qt.cpp
	src/widgets/kernel/qwidgetwindow.cpp
	tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
	tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
	tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
	tools/configure/configureapp.cpp

Change-Id: Ic6168d82e51a0ef1862c3a63bee6722e8f138414
2016-01-19 10:03:01 +01:00
Stephen Kelly
99e25dd7d8 CMake: Don't attempt gui-tests if Qt is built with -no-gui
Change-Id: I5f327fa1b0c7827535a4b00ca7d0d4281b1eec7b
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-01-18 13:00:03 +00:00
Alex Trotsenko
294111e25a QHttpSocketEngine: ensure pending EOF triggers a notification
When the remote peer closed the connection, a read notification needs
to always be emitted, otherwise the higher layer does not get the
disconnected signal. From the other side, underlying QAbstractSocket
object could temporarily disable notifications from the engine at
any time. To avoid possible blocking of the socket, take a pending EOF
into account when the read notifications are re-enabled.

Change-Id: Iac9d4e2f790530be3500baf5a2000f1f63df5cc2
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
2016-01-18 11:08:34 +00:00
Alex Trotsenko
184d66caa5 QDataStream: handle incomplete reads from QIODevice
This adds a way to resume reading from a stream after a ReadPastEnd error.
This is done by introducing a stream read transaction mechanism that keeps
read data in an internal buffer and rolls it back on failure.

[ChangeLog][QtCore] Added QDataStream startTransaction(),
commitTransaction(), rollbackTransaction(), abortTransaction()
functions to support read transactions.

Task-number: QTBUG-44418
Change-Id: Ibf946e1939a5573c4182fea7e26608947218c2d9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-13 16:31:33 +00:00
Andy Shaw
8c89a8b1ef [Android]: Java uses some deprecated locale codes so account for these
There are three deprecated language codes that Java still uses for the
locale so we need to account for these inside QLocale by mapping them to
the right language.

Task-number: QTBUG-49632
Change-Id: Ib66b3f2763e085f7384228f2490b048bb56be259
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-13 12:37:56 +00:00
Simon Hausmann
9a969182cf Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/dev 2016-01-13 07:19:44 +00:00
Dan Cape
f7020a31c0 Add ability to specify precision of float/double currency strings
Added a new overload function that allows the developer to
specify the desired precision. Until 6.0, it will require
the symbol and precision to be passed to it. Once Qt is at
version 6.0, it will replace the overload function that
requires a value and optionally a symbol.

[ChangeLog][QtCore][QLocale] Added an overload for toCurrencyString()
that allows the decimal precision to be specified.

Change-Id: I1fb7dde3583f46de2ed20ec2a7abaeca23a903ef
Task-number: QTBUG-46595
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-13 06:35:14 +00:00
Tor Arne Vestbø
af45b352d7 Fix reentrancy regression in QShortcutMap after c7e5e1d9e
When closing a popup dialog using a shortcut, when the popup
was originally opened using a shortcut, the closing-shortcut
would interfere with the state of the first shortcut, and we
ended up sending a key event for the original shortcut.

Task-number: QTBUG-50360
Change-Id: I62e5ddb9ca43b28519ede629775bc0d7598dccc4
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-01-12 22:08:04 +00:00
Alex Trotsenko
771220ebc8 Allow to use QRingBuffer in containers
Make a private member mutable to enable default assignment operator.

Change-Id: I1216875c186ed800e07c6b41a5bae18c3b71b2fa
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-12 18:03:24 +00:00
Alex Trotsenko
7d257aab81 QIODevice: handle incomplete reads
Introduce a transaction mechanism that gives the ability to read the
data atomically. Current implementation supports transactions for both
types of devices. For sequential devices, it records the whole input
stream during transaction. For random-access devices, device position
is saved when transaction starts. If an error occurs, the application
may be able to recover the input stream by rolling back to the start
point.

Also, QIODevice::peek() was rewritten to make use of transactions
internally. The replacement of QIODevicePrivateLinearBuffer by
QRingBuffer is closely entangled with that, which makes it unfeasible
to do separately.

Bump the TypeInformationVersion field in qtHookData, to notify the
Qt Creator developers that the offset of QFilePrivate::fileName was
changed and dumpers should be adapted.

[ChangeLog][QtCore] Added QIODevice's startTransaction(),
commitTransaction(), rollbackTransaction(), isTransactionStarted()
functions to support the read transactions.

Task-number: QTBUG-44418
Change-Id: I3564b343ebeeaaf7c48a1dcdb7ef0a7ffec550f2
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-12 18:00:58 +00:00
Simon Hausmann
6b8c0a5058 Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I5839bded07e23af65ced9491c4f50242f964dd31
2016-01-12 11:07:56 +01:00
Edward Welbourne
81858bf172 Don't pretend we know what DST to use for an offset date.
When QDateTime::addDate() and friends sanitize their end-state, they
were using the DST status of their start-state (if known) to control
it.  This lead to misguided results and, in particular, inconsistent
results given that a raw-constructed QDateTime comes into being
ignorant of its DST, while a .toLocalTime() one knows its DST.

Furthermore, the code to do this was triplicated, tricky and poorly
explained.  So pull it out into a local static function and explain
what it's doing, and why, more clearly and only once.

Task-number: QTBUG-49008
Change-Id: Ia4bb3c5e9267fff8bb963ea705267998218ed623
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-01-12 09:23:55 +00:00
Marc Mutz
08775e4bd7 Revert "QString: preserve embedded NULs when converting from QByteArray"
This partially reverts commit e486d69133.
It broke too many users, even though all of them deserved to be broken.
The new functionality will be provided by differently-named functions,
where possible (problem: equality operators).

I did not revert the fix for the off-by-one error in
tst_qtextdocumentfragment.cpp.

I also didn't revert the change in the inequality relational operators,
since for all strings s1, s2 and s2' where s2' is s2 truncated at the
first NUL, s1 < s2 ⟺ s1 < s2' (since NUL < c for any c != 0), and,
trivially, for ≤, >, ≥, too. This does not hold for = and ≠, of course,
since "foo\0bar" ≠ "foo".

[ChangeLog][Important Behavior Changes][EDITORIAL] Reverted: All
conversions from QByteArray to QString now preserve embedded NULs...

Change-Id: If4b47048b39ae5be6ed08e6d91809626a67ea7f5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-12 06:13:05 +00:00
David Faure
e8479592c5 Doc: mention that Qt::AA_X11InitThreads isn't used anymore
Whether or not to call XInitThreads() doesn't apply since Qt-5.0's switch to XCB.

Change-Id: I5f1e5e664a251c98af6357c87fc9a6bb03a46ce3
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-01-11 17:28:52 +00:00
Kevin Funk
558f69a18b CMake: Ensure that -fPIC is passed in tests.
CMake newer than 2.8.12 automatically adds the
appropriate flag, but CI still runs 2.8.11.

Change-Id: Ie61375f2feb54a92c9d8f0ed6ad5227a67343bc5
Reviewed-by: Stephen Kelly <ske@ableton.com>
2016-01-11 09:53:37 +00:00
Edward Welbourne
89293e6b19 Make DST-transition test more general.
Widen its interval (to work in more TZs) and test spring as well as
autumn.  Anywhere that does have a DST transition probably has it
between August and December; and there's no benefit to using a narrow
window.

There's also no sense skipping the test if we don't know there's a DST
transition: the test should still work, it just won't be testing
anything (about DST transitions).

Combine date and time checks into date-time checks, so that, when one
of them fails, QCOMPARE lets us know how the other changed, too.

Task-number: QTBUG-49008
Change-Id: I145b939ffef0dd0b54fd0e3cdf72a159c57ec00b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-11 07:31:19 +00:00
Thiago Macieira
ac2bde9caf QVariant: make sure two floating points compare equal if they are equal
Not just fuzzily equal. The fuzzy comparison fails for infinities, since
the expression p1 - p2 where p1 = p2 = infinity is NaN. And NaN
comparisons are always false.

As a nice side-effect, we don't do the more expensive computation of a
multiplication if the two numbers really are equal.

Task-number: QTBUG-50036
Change-Id: I11f559ef75544c50b3f8ffff1420cec7c7273295
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-11 05:20:23 +00:00
Thiago Macieira
71c0bb3fd1 Revert "dbus: Add method serial() and replySerial() to class DBusMessage."
This reverts commit 618e2cc081. The
original commit has a section of code that I failed to review properly
and is of questionable functionality.

Change-Id: I61c53d7b8b2aa7c3312292b017a18aba7da11bc5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-11 05:19:41 +00:00
Kevin Funk
000c4358ce CMake: Make all tests link to Qt libraries
This is needed as of commit v5.6.0-beta1~483 (Add an automatic use of
the ELF-versioned QtCore symbol, 2015-10-20).  Even if a translation
unit only contains

 #include <QtCore/QString>

 int main(int,char**)
 {
     return 0;
 }

it must link to QtCore which provides the qt_version_tag symbol.

Change-Id: I827c0a7403320e7e5b384d8608face20fcecdaea
Reviewed-by: Stephen Kelly <ske@ableton.com>
2016-01-09 15:35:20 +00:00
Marc Mutz
1e2b42523f Fix UB in tst_QObject::disconnectDoesNotLeakFunctor()
If CountedStruct is passed a GetSenderObject object,
it will attempt to call a member on it from within
its own destructor.

That works usually quite well, but in this test case,
which tests for function object leaks when a connection
is torn down because the sender object is destroyed,
the destruction of the CountedStruct happens when all
connections are severed in ~QObject. At that point,
what used to be a GetSenderObject instance no longer
is one and the call into one of its member functions
invokes undefined behavior.

Fix by making QObject::sender() public by a using
declaration instead of a wrapper function.

Found by UBSan:
  tests/auto/corelib/kernel/qobject/tst_qobject.cpp:6007:104: runtime error: member call on address 0x7ffc6e7538b0 which does not point to an object of type 'GetSenderObject'
  0x7ffc6e7538b0: note: object is of type 'QObject'

Change-Id: Ia973140037b3c1b5a670a8a3949d09b956f40349
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-09 15:18:50 +00:00
Thiago Macieira
49c743bdb9 QDate: fix calculation of the week number for the last days of 2020
Off-by-one error: we should have calculated whether the current year is
leap, not the next year. This affected any 53-week leap years.

Task-number: QTBUG-50273
Change-Id: I134ce5db2f82468585ffffff14264cb9f12998fd
Reviewed-by: Martin Klapetek <mklapetek@kde.org>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-09 09:13:44 +00:00
Oswald Buddenhagen
5783a915c4 don't rely on transitive dependencies
Change-Id: Ide872b452e02ebefb3eeb51464c8d59e8bf58bc4
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-08 18:51:02 +00:00
Frederik Gladhorn
ad16478a76 Merge remote-tracking branch 'origin/5.6' into dev
Based on merge done by Liang Qi

Change-Id: Id566e5b9f284d29bff2199f13f9417c660f5b26f
2016-01-08 12:35:24 +01:00
Simon Hausmann
c7797184f0 Prospective fix for running cmake tests with -no-widgets
Don't try to run test_interface when Qt is configured without QtWidgets.

Change-Id: If6c376c250215c1d639b06881d16c0141091f288
Reviewed-by: Stephen Kelly <ske@ableton.com>
2016-01-07 19:29:36 +00:00
Marc Mutz
c38b14e251 Fix UB in tst_QSharedPointer::basics()
Binding a reference to the nullptr is undefined
behavior.

Just skip that particular test when 'ptr' is null.

Found by UBSan:
  tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp:258:32: runtime error: reference binding to null pointer of type 'struct Data'

Change-Id: I125588b9d269a6f76716d660d03142f409513885
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-07 13:00:40 +00:00
Marc Mutz
9c7be0a7ec Fix UB in tst_QDialog::showExtension()
Don't cast a QDialog to a subclass it is not.

Fix by creating it as the required subclass in the
first place.

Found by UBSan:
  tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp:203:20: runtime error: downcast of address 0x2b5f5000ad40 which does not point to an object of type 'DummyDialog'
  tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp:203:46: runtime error: member call on address 0x2b5f5000ad40 which does not point to an object of type 'DummyDialog'

Change-Id: I63ae7e782bda6a78d11af5c2bc2f7d88aacd0ac0
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-07 13:00:32 +00:00
Marc Mutz
f5291bf8b4 Fix UB in tst_QObject::noDeclarativeParentChangedOnDestruction()
If QObjectPrivate::declarativeData is set, it is
in various places in Qt expected to point to a
QAbstractDeclarativeDataImpl, from which ownedByQml1
is unconditionally read.

In noDeclarativeParentChangedOnDestruction(), the
declarativeData pointer is, however, set to a local
QAbstractDeclarativeData instance, which, being an
empty class, has size 1 and alignment 1.

Depending on the compiler's idea of bit field order,
this code either read uninitialized data from the
dummy object, or else some random stack memory outside
any (valid) object.

What caught UBSan's attention, though, was the
difference in alignment between the two classes:

  src/corelib/kernel/qobject.cpp:917:9: runtime error: member access within misaligned address 0x7fffc9cf706f for type 'struct QAbstractDeclarativeDataImpl', which requires 4 byte alignment

Fix by providing a properly initialized object of the
correct type.

Change-Id: Iae83a949ee5a7bc98df13e35ea614c063085fa13
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-07 13:00:28 +00:00
Ralf Habacker
618e2cc081 dbus: Add method serial() and replySerial() to class DBusMessage.
This patch includes setup of class member 'msg' in
QDBusMessagePrivate::toDBusMessage() to be able to get the
serial after message sending.

Testcases for comparing the 'reply serial to' with the 'serial'
are included.

Task-number: QTBUG-44490
Change-Id: Iae7c48f5b0c70a6c5ae500904072b38b46dfd876
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-07 07:42:35 +00:00
Marc Mutz
bccbb70de5 Fix UB in tst_QMetaType
Don't pass around meta-type IDs in QMetaType::Type
variables. It leads to reading values from an enum
variable that are invalid.

Fix by passing the IDs around as int.

Found by UBSan:
  tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:408:5: runtime error: load of value 4028, which is not a valid value for type 'Type'

Change-Id: Idd106ee3d7960fe3d8fefc0fc5830fc22d38a513
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-06 22:07:09 +00:00
Marc Mutz
033205bb59 Fix UB in tst_QIODevice::getSetCheck()
The reinterpret cast from a QTcpSocket → QAbstractSocket → QIODevice
to MyIODevice → QIODevice was undefined.

Fix by simply instantiating a MyIODevice, which must then inherit
from QTcpSocket, of course.

Instead of fixing the class name in the overridden setOpenMode()
method, simply make the base class' implementation public with
a using declaration.

Found by UBSan:
  qtbase/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp:84:22: runtime error: member call on address 0x7ffcca2d23f0 which does not point to an object of type 'MyIODevice'
  0x7ffcca2d23f0: note: object is of type 'QTcpSocket'

Change-Id: I939b3548949b9b5765df4a6cc81875e169fd69dd
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-06 17:25:05 +00:00
Timur Pocheptsov
daeed4631a Blacklist failing tst_QFile tests (OS X)
openStandardStreamsFileDescriptors and openStandardStreamsBufferedStreams
fail on OS X: lseek somehow works on sequential streams (standard streams)
but QFile has pos() == 0 (since it's sequential).

Change-Id: I6a6161c012a91de189f59c533880fb8fe7a66d37
Task-number: QTBUG-49841
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@theqtcompany.com>
2016-01-06 09:38:55 +00:00
Alex Trotsenko
02f70004c2 Allow socket events processing with a foreign event loop on Windows
While a native dialog is open, the application message queue is
handled by the native event loop which is external to Qt. In this
case, QEventDispatcherWin32::processEvents() does not run and socket
notifiers will not be activated. So, this patch moves the notifier
activation code into the window procedure, which enables socket
event processing with native dialogs.

Task-number: QTBUG-49782
Task-number: QTBUG-48901
Change-Id: Icbdd96b2e80c50b73505f4fe74957575b83d6cf1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-01-05 13:05:35 +00:00
Ulf Hermann
9d6a4e7094 QLocale: Accept trailing junk in qstrtod()
qstrtod() used to accept trailing junk until libdouble-conversion was
introduced and we need this behavior in order to implement EcmaScript's
parseFloat() correctly. The QString and QByteArray methods should not
accept trailing junk, though.

Task-number: QTBUG-50131
Change-Id: Ide922da0d65b2576be2c9f47f6053057eff77994
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-05 11:29:29 +00:00
Masaru Ueki
e0a5f661e5 QStateMachine: fix ignore high-priority events.
When a high-priority event is posted in overrided
'QStateMachine::beginSelectTransitions', the event may be remained in
event queue, and be not dispatched until another event posted.

Change-Id: Ifda288d9c00ac7985e426b9cc02bda382ebaac35
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2016-01-05 10:05:40 +00:00
Friedemann Kleint
38c8af7231 Revert "Fix global coordinate mapping for child widgets in QGraphicsView."
This reverts commit 56aad2ad60.

QWidget::mapFromGlobal() does not work correctly when the widget is
a child widget of another widget embedded into a QGraphicsView with a
transformation (scaling/rotation). It starts applying offsets going
up the widget tree (just as mapToGlobal) until it hits the embedded widget
not taking into account the transformation.

It would need to go in from to top to bottom or better be reimplemented
such that a QTransform for mapping coordinates from/to global is determined
which is then applied in reverse.

Task-number: QTBUG-50030
Task-number: QTBUG-50136
Change-Id: Iadeb891d793be1938c64942bfbf38d541a281c33
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-01-05 08:18:18 +00:00
Oliver Wolff
190c76f685 winrt: Use winsock2 API for hostname resolution on WinRT/WinPhone
That API has been available for WinRT and Windows
Phone for some time now. By using it to get the
machine name and for hostname resolution we can get
rid of some winrt-only code and use qhostinfo_win.cpp
on WinRT and Windows phone as well.

Additionally the required capability was added to
tst_qhostinfo so that this auto test can be run without
any manual editing.

Change-Id: I63fa5521bf8cdb0c919bd5a0100ea977c865622a
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
2016-01-05 08:14:31 +00:00
Timur Pocheptsov
4ed8733d90 tst_Gesture - fix failing tests on OS X 10.11
This test seems to be quite broken on OS X: qWaitForWindowExposed returns
too early (while no window is on screen) so gestures can not be dispatched
QApplication::topLevelAt(pt) - returns null.
Use qWait + isExposed combo instead (similar to qWaitForWindowExposed, but
there is no isExposed test before the loop).

Change-Id: I85fbd773ccce0ca92b2dceb1749d67ef767aa0cf
Task-number: QTBUG-49849
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-01-05 06:08:18 +00:00
Sebastian Lösch
73ad2bf32f Make ephemeral server key available
When using cipher algorithms with forward secrecy an ephemeral key is
used to generate the symmetric session key. Beside the SSL certificate's
key, this ephemeral key is of cryptographic interest.

The ephemeral key is chosen by the server side - currently statically in
the Qt implementation - so it is only of interest on the client side to
check it. Therefore the ephemeral key is the null key if the connection
is set up in server mode or a cipher without forward secrecy is used.

Change-Id: If241247dbb8490a91233ae47f2b38952c6591bf4
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
2016-01-04 18:10:14 +00:00
Edward Welbourne
374d35d5ba Make use of preprocessor easier to understand.
The #if had a condition that was needlessly hard to understand;
and was widely separated from its #else clause.

Change-Id: I43f4282993f4f2e8c4b5ad07dc2c2e06a6b95aa9
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-01-04 13:59:14 +00:00
Thiago Macieira
b08d84d39e Autotest: Make sure that we can place calls with disabled delivery
This often happens in applications. Besides, we are expecting at least a
call to RequestName to happen.

Change-Id: Ifd2454ffba454fd591d0ffff1425a84563267d19
Reviewed-by: David Faure <david.faure@kdab.com>
2016-01-03 19:16:33 +00:00
Thiago Macieira
0828d4e8ea Autotest: test both libdbus-1 load failure and connection failure
Change-Id: I39cc61d0d59846ab8c23ffff14242294649c1a45
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2016-01-02 02:06:10 +00:00
Thiago Macieira
9510d99f08 Autotest: Mark D-Bus tests that don't connect to the bus as parallel
There's no problem running them in parallel.

Change-Id: I39cc61d0d59846ab8c23ffff142420a127ab6968
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2016-01-02 02:05:52 +00:00
Thiago Macieira
1f6fa1f37a Suspend processing of some messages in the default busses by default
To retain a bit compatibility with applications developed in the last 9
years that expect that QDBusConnections won't process their events until
the event loop runs, we now suspend the handling of incoming messages
in the two default buses (and only in them) and resume when the event
loop starts. This is required because the new threaded QtDBus would
otherwise process incoming messages that the application didn't expect
it to.

For example, if the application first acquires names on the bus and only
after that registers objects with QtDBus, there's a small window in
which the name is acquired and visible to other applications, but no
objects are registered yet. Calls to those objects may be received,
would then be processed in the QDBusConnectionManager thread and fail.

The work around is to disable the actual handling of method calls and
signals in QDBusConnectionPrivate::handleMessage. Instead, those
messages are queued until later.

Due to the way that libdbus-1 works, outgoing method calls that are
waiting for replies are not affected, since their processing does not
happen in handleMessage().

[ChangeLog][Important Behavior Changes] QtDBus now uses threads to
implement processing of incoming and outgoing messages. This solves a
number of thread safety issues and fixes an architectural problem that
would cause all processing to stop if a particular thread (usually the
main thread) were blocked in any operation. On the flip side, application
developers need to know that modifications to a QDBusConnection may be
visible immediately on the connection, so they should be done in an
order that won't allow for incomplete states to be observed (for
example, first register all objects, then acquire service names).

Change-Id: I39cc61d0d59846ab8c23ffff1423c6d555f6ee0a
Reviewed-by: David Faure <david.faure@kdab.com>
2016-01-02 02:05:45 +00:00
Marc Mutz
be94e009ae QFileDialog: optimize string handling in qt_tildeExpansion
- Instead of QString::split()-ing the path, just to inspect the
  first item in the list returned, simply find the location of
  the first separator and work with that.
  -> saves creating a QList, and its QString elements
  -> saves attempted detaches of that list when calling
     first()
- When extracting the user name, don't do it in a QString, do
  it in a QStringRef.
- When constructing the result, don't use QString::replace(),
  use QStringBuilder with a QStringRef into the original string.
- Eradicate the out parameter, it is easily calculated from the
  return value.
- Don't calculate userName on VXWORKS and INTEGRITY, where it
  is not used. Requires a different #ifdef sequence. Fixed
  preprocessor directives' indention as a drive-by.

Costs 84b in text size on optimized GCC 4.9 Linux AMD64 builds.

Change-Id: I61f1e8d558db7fb0c5c1170bdfd6f5ac1f1a9e62
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-01 23:32:13 +00:00
Thorbjørn Martsum
024a52d0d1 QHeaderView - fix broken stretchLastSection
In setStretchLastSection we restore a default section size
if we no longer use stretch. That size was however not
sufficient - we should restore the actual size.

Furthermore we should also always stretch the last section
(last visible index) - and not leave a section with a
huge size and stretch another.

This patch refactors stretch handling and keeps track
of the last section and its size in eg. moveSection,
swapSection, hideSection, showSection etc.

There is an auto test showing and guarding its behavior.

[ChangeLog][QtWidgets][QHeaderView] Fixed some issues
(e.g QTBUG-39010) with restoring of section size after
a section is no longer the last visible section
(in stretchLastSection mode).

Task-number: QTBUG-39010
Change-Id: Id47075b5a9dfeb250027374ecbd10eb8babbf9ef
Reviewed-by: David Faure <david.faure@kdab.com>
2016-01-01 12:56:29 +00:00
Marc Mutz
d681107f1f Add qHash(std::pair)
We already include <utility> in <qglobal.h>, so we might
as well provide a qHash() overload for std::pair.

[ChangeLog][QtCore] Added qHash(std::pair), defined in
<QHashFunctions>.

Change-Id: I0f61c513e82e05ce9d2e56bcf18f3be9e2da4da9
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-30 11:37:53 +00:00
David Faure
72b4f0d474 QMimeDatabase: follow symlinks when checking for FIFO etc.
This was documented, but not what the code did.

Task-number: QTBUG-48529
Change-Id: I4849778c61dcae13be27c62b24717693c0c07d78
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-29 11:06:13 +00:00
Marc Mutz
8f166ccf40 QString: add resize(int, QChar)
This will be used in QTextStream to speed up padding processing.

[ChangeLog][QtCore][QString] Added resize(int, QChar) overload.

Change-Id: Id51f8cdacb167310157100b05cacf20e9a5d2716
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-28 09:14:59 +00:00
Alex Trotsenko
6b6955c2ff QAbstractSocket: do not enable read notifications on TCP in bind()
In bind+connect scenario, rejected connection can trigger a read
notification while the socket is opened. But unlike UDP, reading from
the socket engine or emitting a readyRead() signal is not allowed for
the TCP socket in bound or connecting state.

To make a bind+connect scenario work properly, disable the read
notifications until a connection is established.

Task-number: QTBUG-50124
Change-Id: I7b3d015b0f6021fb9ff9f83560478aa5545f41f5
Reviewed-by: Richard J. Moore <rich@kde.org>
2015-12-24 14:05:26 +00:00
Alex Trotsenko
27479c1323 Enable a test for QFilePrivate::fileName offset on 32 bit Linux
Change-Id: I3577ff7126263ddbe4b7714095480e6f1da7b661
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-12-23 14:36:15 +00:00
Marc Mutz
a2d218cc41 tst_collections: "explicit instantiation of 'NS::QList' must occur in namespace 'NS'"
Probably correct.

The question is just why this code has survived for so many years.

Change-Id: Iaf01850476f9b066243abebb9ee6c5928d7ada19
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-12-23 08:35:49 +00:00
Marc Mutz
29ddfc3be7 tst_collections: "explicit instantiation of 'NS::QList' must occur in namespace 'NS'
Probably correct.

The question is just why this code has survived for so many years.

Change-Id: Iaf01850476f9b066243abebb9ee6c5928d7ada19
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-12-23 07:27:39 +00:00
Friedemann Kleint
3690bcfda3 Refactor tst_QGraphicsWidget::setTabOrderAndReparent().
The test produces compiler warnings in release builds:

tst_qgraphicswidget.cpp: In member function 'void tst_QGraphicsWidget::setTabOrderAndReparent()':
tst_qgraphicswidget.cpp:1521:89: warning: 'w2' may be used uninitialized in this function [-Wmaybe-uninitialized]
tst_qgraphicswidget.cpp:1536:88: warning: 'w1' may be used uninitialized in this function [-Wmaybe-uninitialized]

Use arrays instead of the variables w1,2... and rewrite the helper
function compareFocusChain() to work on iterators allowing to
remove some temporary lists. Also return error messages in a
QByteArray ready for the Q[TRY_]VERIFY2 macros.

Change-Id: I43466921af59521d1faf00b75fe943508418abb3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-22 11:45:47 +00:00
Friedemann Kleint
f7a167223b tst_QTemporaryDir::nonWritableCurrentDir: Add a check for write protection.
/home has been observed to be writable on some CI machines.
Add checks verifying existence and correct permissions.

Change-Id: Ie0f952e20d0d8eb0b57234eea2e2ecb78f5a7b58
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-12-22 10:59:03 +00:00
Lars Knoll
26237f0a2d Fix QJsonValue::fromVariant() if the variant contains a json object
If the variant contains a known json type (value, array, object or
document), simply unwrap those. In the case of the json document
wrap the contained object/array into a QJsonValue.

This should be the expected behavior, and makes more sense than
returning a null QJsonValue.

Task-number: QTBUG-41234
Change-Id: Id084fc11220d51aaf78b7694fd0ebef1411f5c51
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-22 10:00:46 +00:00
David Faure
2e1de7f3c4 QUrl: revert path-normalization in setPath().
Path normalization should happen only when NormalizePathSegments is set.
Use a less intrusive fix for the setPath("//path") issue that
commit aba336c2b4 was about.

This allows fromLocalFile("/tmp/.") to keep the "/." at the end,
which is useful for appending to the path later on (e.g. to get "/tmp/.hidden")

Change-Id: Ibc3d4d3276c1d3aaee1774e21e24d01af38fa880
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-22 09:56:27 +00:00
David Faure
5f03b48cb3 QStandardPaths: warn if $XDG_RUNTIME_DIR doesn't exist
If the environment variable is set, but points to a non-existing directory,
the user would get a warning about chmod failing. Better be clear and
warn about the fact that the directory itself doesn't exist.

Also warn if $XDG_RUNTIME_DIR points to a file rather than a directory.

Task-number: QTBUG-48771
Change-Id: If84e72d768528ea4b80260afbbc18709b7b738a8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-12-22 09:56:23 +00:00
Gabriel de Dietrich
64481bcc67 QWidgetWindow: The alien widget should be from the window's hierarchy
This partially reverts commit 025d6a778c.

Change-Id: I7b964b0d598abe46137c22177fe2b5dcca5bb812
Task-number: QTBUG-49831
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
2015-12-21 23:02:40 +00:00
Joerg Bornemann
e96fa5a780 Fix timeout calculations using qt_subtract_from_timeout
Commit ed0c0070 introduced qt_subtract_from_timeout but used it
incorrectly in several places.

Change-Id: I80ea16088707929a45d5a61ec6f3370f8e63d1cd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-12-21 22:26:40 +00:00
Oswald Buddenhagen
e5f3b653f0 add enablers for printing project errors in cumulative mode
this doesn't actually do anything in qmake.

Change-Id: Ia14953a5a9dc31af56ad6c338017dd5b85bb4494
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
(cherry picked from qttools/08d0cb6f8e90a818bf6d3bec7a6d00f16419b8c0)
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-12-21 16:39:31 +00:00
Oswald Buddenhagen
57ca8d2698 make write_file() capable of making files (not) executable
Change-Id: I9ca96bc3408160261781697a3471c1f446c86c3a
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-12-21 16:34:26 +00:00
Erik Verbruggen
1823c8f2dd Fix utf8->utf16 BOM/ZWNBSP decoding.
When the byte sequence for a BOM occurs in the middle of a utf8 stream,
it is a ZWNBSP.

When a ZWNBSP occurs in the middle of a utf8 character sequence, and the
SIMD conversion does some work (meaning: the length is at least 16
characters long), it would not recognize the fact some charactes were
already decoded. So the conversion would then strip the ZWNBSP out,
thinking it's a BOM.

The non-SIMD conversion did not have this problem: the very first
character conversion would already set the headerdone flag.

Change-Id: I39aacf607e2e068107106254021a8042d164f628
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-21 09:56:49 +00:00
Jędrzej Nowacki
55eaf11bb7 Stabilize tst_qtimeline::resume
Change-Id: Ife0ce27c680196ed1fe3d037ea0367e511560c96
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:53:21 +00:00
Jędrzej Nowacki
8dd84c6420 Speedup tst_qtimeline::finished
Change-Id: Id9ae42663d8830365d4dcfab92b48621eb1b409f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:53:13 +00:00
Jędrzej Nowacki
6606b151c4 Get rid of qWait in tst_qtimeline::restart to make it less flaky
Change-Id: Iba3a9e5dce6bd7ff6e241fae738cfc51386f0c75
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:53:00 +00:00
Jędrzej Nowacki
4e012cb083 Improve tst_qtimeline::value
The test was improved by:
 - Use QCOMPARE instead of QVERIFY
 - Use QTRY_ macro instead arbitrary qWait
 - Use longer time line

The test executes faster and it should be less vulnerable to
an unreliable timer.

Change-Id: I92675015a6251b47eaf20b0fc916f3a36b52d783
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:52:49 +00:00
Jędrzej Nowacki
266511401f Improve tst_qtimeline::currentFrame
The test run faster and it less vulnerable to an inaccurate time.

Change-Id: I19475095395dcf1e6d47fdbba5eeffabab1fc7b9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:52:40 +00:00
Jędrzej Nowacki
70e290411a Improve tst_qtimeline::currentTime
Now the test is less fragile to time and it executes 4s faster

Change-Id: Id3eb8ed2c03317e7d2f2c3cd17f889a8d8e7e5b4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:52:33 +00:00
Jędrzej Nowacki
229c03cd88 Make tst_qtimeline::range less prune to timing errors
Change-Id: I5fd84c58250a9dfa237fcb7fca4da50c35a9f57e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:52:27 +00:00
Jędrzej Nowacki
bcc23e7942 Make tst_qtimeline::duration less fragile to timings
The test still can fail because 1s is quite a short time.

Change-Id: I6f42c182f2932d5a053f6a69667210529c9a7697
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:52:13 +00:00
Liang Qi
beb65dcd79 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/gui/painting/painting.pri
	src/plugins/platforms/xcb/qxcbconnection.cpp
	tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro
	tests/auto/corelib/tools/qlocale/test/test.pro
	tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
	tools/configure/environment.cpp

Change-Id: I9c40f458b89b2c206de2d2c24e90b5f679c93495
2015-12-18 08:37:31 +01:00
Friedemann Kleint
e3288f246b Windows: Restore window geometry after normal->maximized->fullscreen->normal.
- Do not save geometry when going from maximized->fullscreen
- Use SW_SHOWNA instead SW_SHOWNOACTIVATE as otherwise the
  maximized geometry is restored.
- Add a test for Windows.

Task-number: QTBUG-49709
Change-Id: Ic81e7398ee90d499a50b02192a45cb09276a2105
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-12-17 14:58:29 +00:00
Edward Welbourne
d6efc0aab3 qmake: teach findMocs to handle backslash-newline gracefully.
Change-Id: Id71352c0cf71ab84bd81d4f3d11bb19dc7965903
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-12-17 13:47:33 +00:00