Commit Graph

8154 Commits

Author SHA1 Message Date
Simon Hausmann
5881fc0d2d Ignore tst_QFocusEvent failures on macOS 10.12
Task-number: QTQAINFRA-1352
Change-Id: Ia5cad1af74a2ea581d768ce150e480f3a97b6495
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-07-29 09:35:03 +00:00
Simon Hausmann
5a9247166c Ignore failure of qaccessbilitymac on macOS 10.12
Task-number: QTQAINFRA-1351
Change-Id: I9b41e5664cdb6cedcb68be6197fc21b2cc45963d
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-07-29 09:34:57 +00:00
Simon Hausmann
5bce6aabdc Enrich tst_macNativeEvents blacklist
Amends 0c7e4b97a7

Task-number: QTQAINFRA-1292
Change-Id: I599dc1e7d39a96617d48fa32227093c8501b1323
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-07-29 09:34:52 +00:00
Edward Welbourne
8b628bb251 Add test for time zone transitions near the epoch
This needs a zone with transitions near the epoch; and the only CET
with DST that winter was Italy (copied by Malta), for which the Olson
database had a recent (2016) correction to its data, for that winter.
That means we get inconsistent results on O/Sen of different ages.

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

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

Change-Id: I984b46938a2805b93bb2afd6855e317b5d66b386
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-28 08:14:36 +00:00
Soroush Rabiei
5e1408bd0d Test locale propagation from date-time editor to its calendar popup
Done-with: Edward Welbourne <edward.welbourne@qt.io>
Task-number: QTBUG-59106
Change-Id: I5b79b76087f0e980de5ea4ec687e8b8e2184506f
Reviewed-by: David Faure <david.faure@kdab.com>
2017-07-28 08:14:28 +00:00
Thiago Macieira
15df77f683 Fix use of getentropy on larger blocks
Found while working on suppressing the warning about the return value
(which is either 0 or -1) was being ignored.

Task-number: QTBUG-61968
Change-Id: I02d22222fff64d4dbda4fffd14d148b1724547ca
Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-27 23:19:05 +00:00
Jesus Fernandez
763b0a68be Fix QStandardItem::setChild crash when passing a null pointer
Passing a null pointer as a parameter to the setChild function no
longer crashes when calling the
QStandardItemModelPrivate::itemChanged signal. The child is removed
from the model.
The patch also fixes the behavior of deleting a item. A
dataChanged signal is emitted.

Change-Id: I027e8b0d84fe33c5fca056df870f0e60a020824b
Reviewed-by: David Faure <david.faure@kdab.com>
2017-07-27 19:41:06 +00:00
Thiago Macieira
7c45c6a3c4 Revert "Make QFile::open fail when using an invalid file name"
This reverts commit 346cd79192. The bug
report was incorrect, since the suggested file name is actually valid,
it just happens to name an Alternate Data Stream (ADS) "20:803Z.txt" in
file "testLog-03".

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

Task-number: QTBUG-57023
Change-Id: I81480fdb578d4d43b3fcfffd14d4f2147e8a0ade
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2017-07-27 15:42:55 +00:00
Jędrzej Nowacki
7daf0ea581 Blacklist tst_MacGui::nonModalOrder
The test is marked as expected failure for the last 3 years, in CI it
is proven to be somehow flaky and it is failing now because of XPASS
which is not covered by blacklist feature.

This patch extends efforts of 7eba6d039d
and 03b4838cb5 by blacklisting the test
completely.

Change-Id: Ia295d61620fa6bc97b168d4de9456a18ed5c064f
Task-number: QTQAINFRA-1333
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-27 09:08:58 +00:00
Eskil Abrahamsen Blomfeldt
73176d2922 Add API to disable text shaping on fonts
In the past, we had an undocumented text flag that worked with
one of the QPainter::drawText() overloads. This was never intended
as public API and served a specific cause in Qt WebKit at one point.

But there is a general need for such API, as disabling shaping features
easily gives 25% performance improvement on text rendering even for
fairly short strings.

This patch adds a new style strategy flag to disable shaping and
will just uses the CMAP and HDMX tables to get glyph indices and advances
for the characters. In Qt 6, the TextBypassShaping flag can be removed
completely and be replaced by the style strategy.

[ChangeLog][QtGui][Text] Added QFont::PreferNoShaping style strategy to support
improvements to performance at the expense of some cosmetic font features.

Task-number: QTBUG-56728
Change-Id: I48e025dcc06afe02824bf5b5011702a7e0036f6d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-26 10:51:00 +00:00
Jüri Valdmann
af7e756155 Return "en" for QLocale::c().bcp47Name()
Currently QLocale::c().bcp47Name() returns "C" which, according to [BCP47], is
not a valid language tag. In particular it does not conform to the ABNF grammar
in section 2.1 which specifies a minimum length of 2 characters for all language
tags.

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

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

Task-number: QTBUG-61949
Change-Id: I2a381def8fb7156467e01d105da92bb1f4821204
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-07-26 08:22:51 +00:00
Jüri Valdmann
2031196ad1 Add test for QLocale::bcp47Name()
Task-number: QTBUG-61949
Change-Id: I34fece0441afb1e69ea84ae59b90c5e2b7cf133f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-26 08:22:43 +00:00
Edward Welbourne
cff39f1818 tst_QTimeZone: improve readability of code and failure reports
When QCOMPARE(,) reports two 12-digit numbers, it's not always
immediately obvious what the difference is (much less what 1/3600000
of it is); nor is it obvious that (or why) a given 12-digit number is
in fact correct.  In contrast, our eyes can make sense of a
QDateTime's reported value quite well, enabling us to see what's
different; and it's possible to at least confirm the plausibility of
2-or-3 am on a spring or autumn day at a plausible transition (or even
to confirm it exactly by consulting suitable web-sites).  Also
document the actual transition happening in each case (since I *did*
consult a suitable web-site).  So prefer to QCOMPARE(,) two QDateTime
values instead of two 12-digit qint64s.

Where a that would be unsuitable, at least compare the difference to
zero, to make the error easier to understand (except when one of the
twelve-digit numbers consists entirely of 9s; that, for once, actually
is easy to see).

Write various multiples of 3600 as the relevant intelligible whole
number times 3600, rather than premultiplying, to make it obvious to
reders what's going on.

None of this changes what is actually tested.

Change-Id: I488e751283a55d4623c93612af13ad631144900d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-25 14:09:03 +00:00
Edward Welbourne
37b0a4d2e1 Fix a loop-test and the bogus data the loop expected
A loop initialized i = 0 and used i > 2 as its condition; it didn't
get very far.  Consequently, the test it was in never checked whether
CET's 2011 transitions happened at the times expected - which they
didn't, as the times in question were in fact the times at which
Pacific/Auckland had its transitions that year.

Change-Id: I94d1f8df615c5bcfe48e73d41b4c7faf2beccb96
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-25 14:08:55 +00:00
Timur Pocheptsov
410148ef1e tst_QSslSocket::ephemeralServerKey - fix for OpenSSL 1.1
The original test is quite unfortunate - it has cipher names hardcoded,
and it fails with OpenSSL 1.1 - no matching cipher found for 'RC4-SHA'
and QSslContext::initSsl fails with 'Invalid or empty cipher list'.
We skip this test entry for 1.1.

Change-Id: I810b80a62d9e27a60db71fd412af0c80630d976c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-07-25 13:29:32 +00:00
Stephan Binner
7964b7468d Convert features.tabbar to QT_[REQUIRE_]CONFIG
Change-Id: Id21a95cbc61b2559a8f517ee60548b61536e3cc4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-25 11:24:02 +00:00
Stephan Binner
2d02c4c799 Convert features.dockwidget to QT_[REQUIRE_]CONFIG
Change-Id: I1d4b0268df01f8bc0aec28af52cc4b639a376863
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-25 11:23:58 +00:00
Stephan Binner
3ade30a2af Convert features.calendarwidget to QT_[REQUIRE_]CONFIG
Change-Id: I93c2e00828a233f004c599bd0702d0a470ae29ff
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-25 11:23:41 +00:00
Tor Arne Vestbø
185d87708b Fix tst_QAbstractItemView::task200665_itemEntered
Moving the cursor is not synchronous.

Change-Id: I6b820af026585e1fcfef845cc712fa8f6812e941
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-25 10:54:40 +00:00
Allan Sandfeld Jensen
a06148e341 Improve symmetry of variant json conversions
Make QVariant::toJsonValue do conversions as well as
QJsonValue::fromVariant.

Change-Id: I175d43677061470691e2e0104a800be355fbbd3d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-25 09:00:46 +00:00
Andy Shaw
fcfee98f62 QLineEdit: Don't move the cursor after internalInsert() has done so
internalInsert() will set the cursor to the right position which accounts
for any input mask set on the control as well. Therefore it will already
be placed at the next correct position and should not be changed again
after that.

Task-number: QTBUG-40943
Change-Id: Ic0f5fad6999ddd367e435ec4409a5db5b9eacb7b
Reviewed-by: Daniel Teske <qt@squorn.de>
Reviewed-by: David Faure <david.faure@kdab.com>
2017-07-24 09:51:17 +00:00
Tor Arne Vestbø
593719aab5 macOS: Blacklist flakey test tst_QMenu::tearOff()
Change-Id: Id220f10f4ff756230155c7c8f37713d53ed3ca0c
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-24 03:49:37 +00:00
Tor Arne Vestbø
58685a48a6 macOS: Blacklist tst_QMenu::pushButtonPopulateOnAboutToShow
It's flakey/failing on macOS, the menu is opened but opened above
the button, so the intersection test fails.

Change-Id: I6b13a1b0df2b07fa36bbb73071cdeb55547ac93a
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-24 03:49:30 +00:00
Frank Meerkoetter
c4e8726042 Fix warning about self assign
...tst_qlineedit.cpp:1938:9: warning: explicitly assigning value of variable of type 'Qt::Key' to itself
-Wself-assign]
    key = key;
    ~~~ ^ ~~~

Change-Id: I18a46f61e13f6e2c74edce869a1c36a7f3a0fb70
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-07-23 12:18:03 +00:00
Tor Arne Vestbø
f948f96e91 macOS: Blacklist tst_QComboBox::task_QTBUG_56693_itemFontFromModel
Counting draw calls in the style is not a reliable way to count
italic items in the combobox.

Task-number: QTBUG-62080
Change-Id: I6cb6d54535f073f66cfcf61bb19eb645284c835d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-22 06:22:26 +00:00
Tor Arne Vestbø
ab5c28ac55 Fix tst_QListWidget::QTBUG50891_ensureSelectionModelSignalConnectionsAreSet
Don't assume signals will not be emitted during show. The test should
focus on testing that changing the model results in change signals. What
happens before that is not under test, and not stable.

Change-Id: I71e62abc15fc81c069d7685e4342e795449c3632
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-21 22:10:28 +00:00
Thiago Macieira
b91a6ef9cd Deprecate and remove the unused bearer support in QNetworkProxy
This hasn't done anything since at least Qt 5.0. It's possible it was
only used in Symbian, which we removed before the 5.0 release. This only
served to make the tst_QNetworkProxyFactory test slow.

[ChangeLog][QtNetwork][QNetworkProxy] The functions related to
QNetworkConfiguration are deprecated. They've performed no action since
Qt 5.0, so code using them can safely stop doing so.

Change-Id: I84e45059a888497fb55ffffd14d31b7c2978a04e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2017-07-21 18:25:42 +00:00
Tor Arne Vestbø
2e3e8cec89 macOS: Blacklist tst_QMenu::layoutDirection
It's failing when enabling synchronous expose events, but likely
due to making assumptions about expose behavior. Will be looked
at in more detail once the expose event patch is in, so we can
move forward.

Task-number: QTBUG-62092
Change-Id: Ie76b5f11ccf841981a42d2eda19fbcda8b43c36c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-21 13:31:19 +00:00
Daniel Teske
854fdaaf76 QLineEdit: Add selectionEnd() and selectionLength()
Getting the end position of the selection was not possible.

[ChangeLog][QtWidgets][QLineEdit] Added selectionEnd(), selectionLength(),
complementing selectionStart().

Change-Id: Iaecc624063d7c043f9502351f07eb76f869e86f1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-07-20 13:46:26 +00:00
Simon Hausmann
d39ec44e19 Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev 2017-07-20 13:46:11 +00:00
Tor Arne Vestbø
a639a4cc07 tst_QWindow: Wait for platform to ack window states before continuing
Fixes flakiness where we enter and exit window states too fast on macOS,
while also removing 2 second waits in the positioning tests that were
slowing things down needlessly.

Change-Id: Ia4ee4d4812474c520fdd3f76b047f4eabe1a8220
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-19 23:06:21 +00:00
Tor Arne Vestbø
a63494ae12 macOS: Blacklist tst_MacNativeEvents::testKeyPressOnToplevel and friends
They fail when enabling synchronous expose events. Disabled for now
until we can look into why, but it's assumed to be an issue with the
test harness/how we hook into Quartz to send/observe events.

Task-number: QTBUG-62042
Change-Id: I723d049ec5d1029edb0ad3b1f47fffc829a8924b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-19 23:03:50 +00:00
Sergio Martins
29f6b50732 Windows: Don't raise inactive windows when showing a tooltip
The Qt4 Q_WS_WIN ifdef never got ported.

Change-Id: Iad1ca1a3e20bd5254895781eee09897520b7d7d1
Task-Id: QTBUG-39147
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-07-19 14:21:52 +00:00
Marc Mutz
94cf203f36 Use QSharedPointer::create() more
This is the result of running the (experimental) clang-tidy check
   qt-modernize-qsharedpointer-create

Discarded changes:

- tst_qsharedpointer.cpp: not sure we want these replacements there
  (→ separate change)
- tst_collations.cpp: hit in a template specialization that is
  instantiated with both QSharedPointer and QSharedDataPointer.

Change-Id: I203c2646e91d026735d923473af3d151d19e3820
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-19 13:40:42 +00:00
Morten Johan Sørvig
4585889467 Fix race condition in the processEvents test
This test verifies processEvents(WaitForMoreEvents)
behavior by first processing all pending events (in
a loop) and then verifying that a following processEvents
call actually waits.

But there is no guarantee that the OS won’t introduce
more events after the first loop has completed. This
does indeed seem to happen on recent versions of macOS.

Change the test to not require that the processEvents
call blocked and de-blacklist.

Task-number: QTBUG-61131
Change-Id: Ic8fa74a6085165442791264f6f137a2fa6083138
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-19 12:29:53 +00:00
Simon Hausmann
407302fb1b Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/corelib/io/qwindowspipewriter.cpp
	src/widgets/styles/qcommonstyle.cpp

Change-Id: I0d33efdc4dc256e234abc490a18ccda72cd1d9e6
2017-07-19 09:47:29 +02:00
Friedemann Kleint
a9dfdbd06a tst_QStyle::drawItemPixmap(): Check on the image color
Verify that all pixels of the grabbed image are green instead
of comparing an image loaded from file.
The test then also passes when High DPI scaling is active in
which case a twice as big pixmap with DPR=2 is obtained when
grabbing the widget.

Change-Id: Ie5244a39a68ea0defd2590cf30f251d660d0869b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-07-19 07:33:38 +00:00
Friedemann Kleint
1b190e7ea6 tst_QWidget: Fix to pass with High DPI scaling enabled
Scale coordinates in a few places, remove pixmap scaling in
grabWindow() (Windows).

Change-Id: Iba9e5d3ca55422a14eda09c8d04329a455d3acb3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-07-19 07:32:55 +00:00
Thiago Macieira
f3205a4949 Merge qt_error_string and QSystemError
This removes a lot of duplicated code that existed in both qglobal.cpp
and qsystemerror.cpp, including the hack to get the correct strerror_r
signature.

This removes the incorrect use of EACCES, EMFILE, ENOENT, and ENOSPC
from qt_error_string on Windows. qt_error_string is supposed to be used
only with Win32 error codes from GetLastError(), despite there being a
lot of uses in cross-platform and even Windows-specific code that pass
errno constants.

It may or may not work: that depends on whether the constants happen to
match. ENOENT matches ERROR_FILE_NOT_FOUND and one could argue that
ENOSPC matching ERROR_OUT_OF_PAPER is acceptable, but EMFILE isn't the
same as ERROR_BAD_LENGTH nor is EACCES, ERROR_INVALID_DATA.

Change-Id: I1eba2b016de74620bfc8fffd14cccb7f77f4b510
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-18 15:51:22 +00:00
Timur Pocheptsov
07c0e0fdcf QAsn1Element - fix toDateTime function
ASN UTCTime uses two characters to encode a year (YY). When converting it
into QDate, it's quite naive to just add 2000. According to RFC 2459,
these YY represent dates in the range [1950, 2049].
This patch also introduces a helper function doing the checked conversion
from a string to int (to be reused in the following-up patches).

Task-number: QTBUG-61934
Change-Id: I3f6f471d24e8357b83b2f5973023b2b842751389
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-07-18 13:09:16 +00:00
Tor Arne Vestbø
46001e6f49 Blacklist tst_QWidget::setToolTip on all macOS platforms
It's broken due to tst_QWidget::testDeletionInEventHandlers,
but the root cause is not known yet.

Task-number: QTBUG-61986
Change-Id: I5b77efaf6910123d10a1456c54b873100e538a69
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-17 16:42:33 +00:00
Tor Arne Vestbø
64bce9bbff tst_QGL::graphicsViewClipping: Wait for viewport's window handle
The QWidget overload of qWaitForWindowExposed waits for the widget's
top level QWindow, which for the viewport is the graphics-view.

We want to explicitly wait for the viewport to be exposed, as the
viewport is covering the whole graphics-view, preventing it from
being exposed. See a6991376c.

Change-Id: I86df43871126562f09e4ce14931bc6fc7f06263d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-17 14:11:06 +00:00
Tor Arne Vestbø
b2cb4c73d3 Stabilize tst_QWidget::setMaskInResizeEvent on OS X 10.10
Change-Id: I7dbe9c7a91301e0002f9e1827f6d0b495d2b9ec5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-17 13:10:31 +00:00
Tor Arne Vestbø
af00fe5d89 macOS: Skip tst_QWindow::modalDialog
The tests uses QWindow::requestActivate() to verify that a window does
not become active when a modal dialog is running, but on macOS we have
no guards for this, so the test can potentially fail.

In addition, due to a bug in QCocoaEventDispatcher, we end up waiting
5 seconds for that failure to manifest.

Task-number: QTBUG-61965
Task-number: QTBUG-61964
Change-Id: I2f1b62d953e9b6dabf2df0c3023564f27919c498
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-07-14 15:44:01 +00:00
Tor Arne Vestbø
fdfa3b1141 Skip tst_QWidget::testForOutsideWSRangeFlag
The test assumes that resizing a QWidget to 0x0 will result in the
QWindow ending up with that size, and hence not being exposed, but
this is not the case. On a QWindow level we treat 0x0 as a trigger
for the platform layer to set the default size, and the window
ends up exposed.

Ideally QWindows should allow 0x0 sizes, but this is a bigger change.
In the meantime, we skip the tests so that other changes can be
integrated without the test failing.

Task-number: QTBUG-61953
Change-Id: Ib17187b4afd1b06eaa76653be18e93abea555b59
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-07-14 04:43:06 +00:00
Gabriel de Dietrich
d38fe875c7 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
    src/widgets/widgets/qmainwindowlayout.cpp

Change-Id: I306b4f5ad11bceb336c9091241b468d455fe6bb6
2017-07-13 16:36:10 -07:00
Daniel Teske
7051572618 QLineEdit: Fix length calculation for input mask "\\\\"
Consider the raw string \\\\. The previous algorithm would consider
the last 3 \ to be escaped because the previous character is a \ and
thus calculating a maxLength of 3.

But this should be treated as two escaped \ with a maxLength of 2.

Change-Id: I6c4b8d090a2e1c6e85195d5920ce8b80aea1bc2d
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-07-13 14:59:17 +00:00
Andy Shaw
0843c6ca7f QSqlField: Add a means to see what the tablename is for a given field
When you are using a query that pulls from a number of different tables
then it can be ambiguous as to which table a particular field belongs to.
So this will make it possible to determine the table that a given field
belongs to if it is set.

Task-number: QTBUG-7170
Change-Id: I49b7890c0523d81272a153df3860df800ff853d5
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-07-12 09:01:50 +00:00
Allan Sandfeld Jensen
b3f7bea105 Handle conversion and comparison between qvarianthash and qvariantmap
QVariant claims to be able to QVariantHash and QVariantMap, but the
actual conversion implementation is missing.

Task-number: QTBUG-61471
Change-Id: I0cba74642aa77dc423effed289bc7619922a89eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-11 21:10:54 +00:00
Allan Sandfeld Jensen
9423be1f19 Fix deprecation warnings
Switch to QImage::sizeInBytes for huge QImage support.

Change-Id: I0145f204dd2db6670e199c320fff9064b4a97ef4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-07-11 18:59:07 +00:00
Morten Johan Sørvig
a6991376cc Wait for window expose on the viewport widget
The child viewport window covers the entire client
area of the parent window, which prevents the parent
window from being exposed.

This worked by accident until now, and was uncovered
by changes to the cocoa platform plugin implementation.

Change-Id: I0d62a1a33f125e5a9030c8def452a49886e54956
Task-number: QTBUG-50414
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-11 15:24:42 +00:00
Andy Shaw
82e6ac8cdb Implement setDoubleStep for QInputDialog
setDoubleStep works in the same manner as for setIntStep in that it is
just available for input dialogs getting a double.

[ChangeLog][QtWidgets][QInputDialog] Added setDoubleStep to enable
changing of the step amount for getDouble().

Task-number: QTBUG-17547
Change-Id: I5cabcfceb23324f8045f2b1e49017644418db01a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-07-11 12:10:39 +00:00
Timur Pocheptsov
3e3466d28c tst_QSslSocket::protocolServerSide - fixes for OpenSSL 1.1
Several tests are not valid for 1.1 anymore:

1. SSL2 was removed, but there is no OPENSSL_NO_SSL2 and the 'protocolServerSide'
   test is trying to use QSsl::SSLv2 and thus is failing.
2. We now use the generic TLS_server/client_method instead of version specific
   methods we have in pre-1.1 back-end. So, for example, a client socket with
   QSsl::TLS_V1_0 in its SSL configuration will be able to negotiate
   TLS 1.2 if our server socket wants it, while with TLSv1_client_method
   (OpenSSL < 1.1) our test was expecting SSL handshake to fail.

Change-Id: I18efd5921c79b189e4d9529be09299a361a8a81d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-07-11 10:44:08 +00:00
Kevin Ottens
0d196b4268 Add support for parameters in QShaderGenerator
Change-Id: Iff8fec51ddbf9b018cb5ec3aff357125134013eb
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-07-08 09:05:23 +00:00
Kevin Ottens
13ecd686b9 Add support for node parameters in QShaderGraphLoader
Now the parameters from the prototypes are used as default values and
the graph file can overload them.

Change-Id: I9a8a73963c7e578bd0a34e96f76f147a12224f4f
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-07-08 09:05:19 +00:00
Kevin Ottens
5667c870fb Add support for node parameters in QShaderNodesLoader
This will allow to make the prototypes more extensible when referred to
from a graph file while providing some sane defaults.

Change-Id: I1ae10182427d8a7d29c51a64e19e99139494ea92
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-07-08 09:05:16 +00:00
Kevin Ottens
f7fefed2ea Add parameters to QShaderNode
This will allow to create nodes having an entry point for tuning, still
need to be exploited by the loaders and the shader generator. Coming in
further commits.

Change-Id: I8384b0f528c9919e9f8d35102adde2b307f08b80
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-07-08 09:05:13 +00:00
Kevin Ottens
74e9a11386 Complete the QShaderGraphLoader tests to introspect nodes
We forgot to check that the node content was correct and complete when
loading the graph.

Change-Id: Id4ee6aaba6ca268b0785e7fa3fb51a19817e7c9c
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-07-08 09:05:10 +00:00
Allan Sandfeld Jensen
4f88475a96 Allow QImage with more than 2GByte of image data
Changes internal data-size and pointer calculations
to qssize_t.

Adds new sizeInBytes() accessor to read byte size, and
marks the old one deprecated.

Task-number: QTBUG-50912
Change-Id: Idf0c2010542b0ec1c9abef8afd02d6db07f43e6d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-08 08:17:13 +00:00
Edward Welbourne
9381ca77b2 tst_QDateTime::toTimeSpec(): verify round-tripping works cleanly
Change-Id: I811fa4249dae923e5e4e434910d8bf96c15bff25
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-07 18:09:33 +00:00
Edward Welbourne
cf9187f8c9 tst_QFileInfo: generalize old-file test
Now that QFileDevice::setFileTime() provides a portable way to prepare
our test file, we can verify QFileInfo does handle the distant past,
notably including negative time_t values.  The old MS-specific code
used a time back in 1601, which we can't hope to support
cross-platform, so use one in 1901 that's a little inside the range of
32-bit time_t.

Task-number: QTBUG-47985
Change-Id: I2de3e79d8c7864221f92395813b63f373e4d8a3b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-07 18:09:24 +00:00
Edward Welbourne
fcb423d1f2 Q(Date|Time)+: in QDebug's <<, handle invalid explicitly
The output didn't previously make clear that the datum was invalid.
It's now explicitly invalid.  At the same time, use QDebug's space()
and nospace() methods to make spacing choices explicit.
Revised a QDate test to match.

Change-Id: I4699f5897530b4caa31c22fdb07de149832b30f4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-07 18:08:59 +00:00
Edward Welbourne
cc3b9cf3b3 Clarify tst_QDateTime::fromStringToStringLocale() using a macro
Separate the part varying between tests from the common form of all
the tests, so the reader can see the common pattern and know for sure
that there's not a typo or copy-and-paste glitch.

Change-Id: I3145a26ab42c104eb27756d906ac87f937024bad
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-07 18:08:51 +00:00
Gabriel de Dietrich
ac8955794f tst_qstyle: Don't fail on empty scroller subcontrols on macOS
macOS hasn't had SC_ScrollBarAddLine and SC_ScrollBarAddLine
since 10.7, when transient scrollbars first appeared.

We also make the warning message a bit more informative.

Change-Id: Idef4684162456d9bc274eea77908a6afe24fa0f5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-07-07 17:54:53 +00:00
Simon Hausmann
3fb0852091 Skip the dbus abstract adaptor test on OpenSuSE 42.1
It has been crashing for months...

Change-Id: I1d6077f949d642465771c4d618babc64ebc340f6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-07-07 09:40:14 +00:00
Friedemann Kleint
db404fea64 QListView: Fix viewport size when checking scroll bar visibility
Subtract the viewport margins from the contentsRect in
QCommonListViewBase::updateHorizontal/VerticalScrollBar(). This
affects list views in icon mode and list mode / ScrollPerPixel.

Task-number: QTBUG-61383
Change-Id: I6f2f7951ac9344ac21cef1eba061780d130e2467
Reviewed-by: David Faure <david.faure@kdab.com>
2017-07-07 08:10:01 +00:00
Thiago Macieira
bcd19b723a QLocale: fix handling of milliseconds in string format and document
[ChangeLog][QtCore][QLocale] Fixed the conversion of QTime to string
form and parsing from string form to always treat the value as the
decimal fraction of the seconds component. That is, the string format
".z" produces/parses ".2" for 200 milliseconds and ".002" for 2
milliseconds. Use of "z" or "zzz" is discouraged outside decimal
fractions to avoid surprises.

Task-number: QTBUG-53565
Change-Id: Ia19de85ad35e4eb7bb95fffd14792caf9b4a5156
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-07-07 07:21:53 +00:00
Friedemann Kleint
e1d7f7dfbc QFileSystemWatcher/Windows: Recreate handle for files
QWindowsFileSystemWatcherEngine uses one change notification
per directory to watch directories or files within that
directory. Adding files and their directories in a sequence
caused the value in QWindowsFileSystemWatcherEngineThread::HandleForDirHash
to be overwritten.
Relax the check for the flags (watcher attributes) to use >= and recreate
the change notification of a directory should its flags be insufficient.
This triggers when a file is added after its directory since files
require more attributes.

Task-number: QTBUG-61792
Change-Id: I371a72f1934fa82c53aaf84beb907825031f1c81
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-07 07:02:45 +00:00
Aram So
06904a7a77 Make calling QCoreApplication::translate() thread-safe
Fixed crash on QCoreApplication::translate() call from qqmlThread while
QCoreApplication::{install,remove}Translator() is called from the GUI
thread.

[ChangeLog][QtCore][QCoreApplication] Calling
QCoreApplication::translate() is now thread-safe.

Task-number: QTBUG-57095
Change-Id: Ie5340a42040a829f311c01332e05d4bbaf60462c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-06 18:26:41 +00:00
Liang Qi
7f269a5db8 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	.qmake.conf

Change-Id: I43531e087bb810889d5c1fbfcdffb29b78804839
2017-07-06 13:54:25 +02:00
Gabriel de Dietrich
462d26f265 qtabbar manual test: Improve usability
Covers non-document mode, tab icon, and adds a more
useable interface. Some parts are still missing, like
tab orientation and long tab titles.

Task-number: QTBUG-61092
Change-Id: Idbda84f513e3ff7f87fa04ae4476b11bd8bb6bf2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-06 00:58:17 +00:00
Friedemann Kleint
d3d5c22ccb tst_QProcess/tst_QFile: Extend blacklisting to MSVC2017
Extend the blacklisting introduced by
0ebebeb983.

Task-number: QTBUG-48455
Task-number: QTBUG-48504
Change-Id: Idf44948a5ede433435a8d0b61fef6413bb0b69bc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-05 12:42:14 +00:00
Allan Sandfeld Jensen
d866617ea6 Fix polygon stroking with cosmetic pen
Fix a number of issues that caused polygons to not always be drawn
fully connected.

Ensures the original lastPixel is set when drawing closed polygons,
ensure we don't round away from the original starting point, and add
handling of edges that need to be rounded half a pixel sideways to line
up with endpoints.

Task-number: QTBUG-27053
Change-Id: Ib51ee5623a629996af51a0967096383f04e91e2f
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-07-05 12:35:26 +00:00
Jarek Kobus
8e40050efe uic: Don't clear and readd combobox items in retranslateUi
Task-number: QTBUG-61778
Change-Id: If7a15ef69fcfe459f177ff8b671f53a6022ab335
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2017-07-05 12:20:09 +00:00
Edward Welbourne
8095c33bcd Use qRadiansToDegrees() and qDegreesToRadians() more widely
Especially in examples, where we should show off our convenience
functions, prefer calling these functions over doing arithmetic with
M_PI (or approximations thereto) and 180 (give or take simple
factors).  This incidentally documents what's going on, just by the
name of the function used (and reveals at least one place where
variables were misnamed; the return from atan is in radians, *not*
degrees).

Task-number: QTBUG-58083
Change-Id: I6e5d66721cafab423378f970af525400423e971e
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-07-05 10:15:34 +00:00
Simon Hausmann
03b4838cb5 Extend tst_macgui::nonModalOrder blacklist to include 10.12
Change-Id: I9cfe9e8d79a3223c9cdbb039cc3e243b173f5e9c
Task-number: QTQAINFRA-1333
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-07-04 20:03:41 +00:00
Liang Qi
c2b224a758 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/corelib/io/qprocess_unix.cpp
	src/plugins/platforms/xcb/qxcbconnection.cpp
	src/plugins/platforms/xcb/qxcbwindow.cpp
	src/widgets/util/util.pri
	tests/auto/corelib/thread/qthread/qthread.pro
	tests/auto/corelib/thread/qthread/tst_qthread.cpp

Change-Id: I5c45ab54d46d3c75a5c6c116777ebf5bc47a871b
2017-07-04 16:05:53 +02:00
Thiago Macieira
8616b2112c Fix parsing of 0E+1 and 0E-1 (capital 'E')
Since the result is an actual zero, this section of code looking for
underflows kicks in. But we forgot to take the capital letter into
account when parsing the number.

Task-number: QTBUG-61350
Change-Id: Ia53158e207a94bf49489fffd14c6abbd21f0bac0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-07-03 16:01:01 +00:00
Simon Hausmann
5ac03a14bf Blacklist tst_QWindow::positioning on macOS 10.12
Change-Id: I41f46e8387519a691d3df9a4fdcc577916e6d247
Task-number: QTQAINFRA-1332
Reviewed-by: Liang Qi <liang.qi@qt.io>
2017-07-03 11:29:30 +00:00
Edward Welbourne
f881120fd0 Fix offset calculation to be valid at the correct time
tst_QLocale::macDefaultLocale() was determining local-time's current
offset from UTC and using it when working out what to expect the
offset at 1:2:3 today to be.  When a transition happens after 1:2:3 on
its day (which is usual for DST changes in Europe), this lead to using
the new offset to test a time before the transition; the test was thus
wrong and failed.

Use the time to be tested (and current date) to compute the offset to
use, instead of using the current date-time.

Change-Id: I1c02a5579bca859e1d1aeb4f45b24871a08287af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-03 09:03:28 +00:00
Friedemann Kleint
22aa919b76 macOS: Blacklist tst_QToolButton::task176137_autoRepeatOfAction()
The test is apparently flaky.

Change-Id: I4d7b5ad653c46a432d79c9090b9f5d4cc98e5b6e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-03 07:50:41 +00:00
Allan Sandfeld Jensen
989b9da300 Fix BMP ImageFormat for semi-transparent files
Reads the v4 and v5 info-header together with the rest of the info-
headers, and use that to report the correct image format before
decoding.

Change-Id: I69e2bcc54367b7f14820815ae2ae1fa2d8d5dc8c
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-07-03 07:41:56 +00:00
Friedemann Kleint
88c68f4d9e tst_QPrinter: Run in temporary directory
Change-Id: I299b740a43926e4af31c70aadda882f87ba9c362
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-03 06:49:10 +00:00
Oliver Wolff
6b58d3fb98 Require printer config for printsupport auto tests
Change-Id: I171c5d642e41480b4feec102dc0095af5f500098
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-07-03 06:41:35 +00:00
Friedemann Kleint
9656e972d1 Remove remains of wince in .pro files
Task-number: QTBUG-52590
Change-Id: I444fc9eedc8a8e4ad2ede224d66e7c410bedbb48
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-03 05:32:51 +00:00
Sami Nurmenniemi
d23e18189c Skip QThread stress test on Qemu
Qemu uses some memory for each generated thread. This test creates
> 80000 threads and consumes about 10Gb of memory which is too
heavy for a VM.

Task-number: QTBUG-59966
Change-Id: I1bb8a0d7955778f5201948b41befcb9f1f391514
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-02 15:58:40 +00:00
Stephan Binner
2fb9705521 Convert features.filesystemmodel to QT_[REQUIRE_]CONFIG
Change-Id: I862510387e79d04221ec075f3e79896908ee9d8f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-02 10:39:04 +00:00
Sérgio Martins
fd897629bf Fix moving a hidden QOpenGLWidget to another window
A visibile QOpenGLWidget receives a QEvent::WindowChangeInternal which triggers
a QOpenGLWidget::reset(). A hidden QOpenGLWidget never received this event
so it was never reset, resulting in a black rendering.

Includes unit-test that fails without this patch.

Change-Id: I9d2c57d66fa629f631a9829a5ebf4de09998ad75
Task-Id: QTBUG-60896
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-07-02 09:31:01 +00:00
Friedemann Kleint
628f3becf9 macOS: Blacklist tst_QProgressDialog::autoShow()
The test is apparently flaky.

Change-Id: Ib0161fb18cdef1d532c81ac7196c57af1f7c8ee1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-02 09:30:45 +00:00
Thiago Macieira
120ecc976f QRandomGenerator: use getentropy on Linux & OpenBSD
The getentropy function, first found in OpenBSD, is present in glibc
since version 2.25 and Bionic since Android 6.0 and NDK r11. It uses the
Linux 3.17 getrandom system call. Unlike glibc's getrandom() wrapper,
the glibc implementation of getentropy() function is not a POSIX thread
cancellation point, so we prefer to use that even though we have to
break the reading into 256-byte blocks.

The big advantage is that these functions work even in the absence of a
/dev/urandom device node, in addition to a few cycles shaved off by not
having to open a file descriptor and close it at exit. What's more, the
glibc implementation blocks until entropy is available on early boot, so
we don't have to worry about a failure mode. The Bionic implementation
will fall back by itself to /dev/urandom and, failing that, gathering
entropy from elsewhere in the system in a way it cannot fail either.

uClibc has a wrapper to getrandom(2) but no getentropy(3). MUSL has
neither.

Change-Id: Ia53158e207a94bf49489fffd14c8cee1b968a619
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-30 21:19:10 +00:00
Stephan Binner
1ebe68b01f Convert features.filedialog to QT_[REQUIRE_]CONFIG
Change-Id: I9bc229b0d1430b81eeb2cfca2b24474736d5d561
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-29 02:22:48 +00:00
Oleg Yadrov
6e9d24212d QTabBar: fix expanded tabs appearance
Fix regression introduced by 175f33ed8. 'expanding' property set to true
was ignored when QStyle::styleHint() returned Qt::AlignRight for
SH_TabBar_Alignment.

When we calculate tabs geometry, we put an empty tab at the front and
back and set its expansive attribute depending on tab alignment AND
'expanding' property.

Task-number: QTBUG-61480
Change-Id: I6a1827ae8a3f2c6bee5124c18c7f2b1c0a7862f3
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-06-28 22:47:13 +00:00
Friedemann Kleint
5d31b52a12 Fix some MSVC warnings in tests
tst_qvariant.cpp(80): warning C4309: 'initializing': truncation of constant value
tst_qvariant.cpp(4635): warning C4309: 'initializing': truncation of constant value
tst_qbytearray.cpp(1438): warning C4267: 'argument': conversion from 'size_t' to 'uint', possible loss of data
tst_qbytearray.cpp(1440): warning C4267: 'argument': conversion from 'size_t' to 'uint', possible loss of data
http2srv.cpp(64): warning C4018: '<=': signed/unsigned mismatch
tst_qinputdialog.cpp(352): warning C4804: '<=': unsafe use of type 'bool' in operation

Change-Id: Id012d88b7b20c5c9f128f2ef53753cc1d479f358
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-06-28 17:58:13 +00:00
Friedemann Kleint
9131b2ac2a tests: Add Q_FALLTHROUGH to unmarked fallthroughs seen by GCC 7
Change-Id: I70c87912476372097517fc20b3740416c24cb819
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-06-28 17:57:35 +00:00
Friedemann Kleint
9130c4a6bf tst_QSocks5SocketEngine::downloadBigFile(): Output elapsed time
Print time in the error handler to get some diagnostics
about when the network connection is dropped.

Task-number: QTBUG-61673
Change-Id: I376bec81f52d75c9b601f2af9b7e0b63f5883bb0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-06-28 17:54:07 +00:00
Friedemann Kleint
807f3d32b1 tst_QSharedPointer: Terminate hanging qmake-processes
Change-Id: I580ff3ccbecba81c09ce3fc3e082b906f956171d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-06-28 17:53:24 +00:00
Marc Mutz
b1afa3bed4 Stabilize QDnsLookup test
Use 15s instead of 10 (one check took 7.5s on my development machine, even).

Port to QTR_VERIFY_WITH_TIMEOUT instead of rolling our own waitForDone(),
as that reports (within limits) by how much the timeout was exceeded.

Change-Id: Id76a66d5f4fe3a4e814915add329eb4de3d264a7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-06-28 16:30:21 +00:00
Stephan Binner
7f62c5fedc Convert features.tabletevent to QT_CONFIG
Change-Id: Ibd7ed7f269a64afddadee70979b20f1c58398378
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-28 16:15:14 +00:00
Stephan Binner
5ede5706a8 Convert features.wheelevent to QT_CONFIG
Change-Id: I46083a9115c199d1ebe024ed5f64b160a27462f1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-28 16:15:09 +00:00
Liang Qi
80406bd620 Revert "Support more than 62 instances of QWinEventNotifier"
It breaks sth in QLocalSocket which is used in QtRemoteObject.

This reverts commit 5c6210e345.

Task-number: QTBUG-61668
Change-Id: Ib11890923773496e5d998b7709ef93b0a839a759
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-06-28 12:28:39 +00:00
Simon Hausmann
0c7e4b97a7 Ignore tst_macNativeEvents::testPushButtonPressRelease on macOS 10.11
Task-number: QTQAINFRA-1292
Change-Id: I1047b797380820d2636f4d514b41b621c7794486
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-06-28 11:25:39 +00:00
Simon Hausmann
5628d47291 Ignore tst_QOpenGLWidget::clearAndGrab failures on Ubuntu
The test fails for unknown reasons when using the mesa swrast when using
qemu/kvm (as opposed to when using the vmware mesa driver).

Task-number: QTQAINFRA-1318
Change-Id: Ib7e9d894cd368b8c2c12d83ec1e4862622781fe6
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-06-28 11:25:36 +00:00
Simon Hausmann
666f5dbb15 Ignore tst_qwidget::showMinimizedKeepsFocus on macOS 10.11
It's failing for inexplicable reasons not only on 10.10 but also 10.11.

Task-number: QTQAINFRA-1317
Change-Id: Id316764443dfe9e0ae30e2d25d8bae73fa255617
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-06-28 11:25:33 +00:00
Simon Hausmann
3e67f727b8 Ignore failure of tst_qmenu::submenuTearOffDontClose on macOS 10.11
The test is failing inexplicably on macOS 10.11.

Task-number: QTQAINFRA-1315
Change-Id: Ia0162768b6d4fdd016bce62b92c3df0b5d4ed8d0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-06-28 11:25:30 +00:00
Simon Hausmann
f17554fce1 Skip the threaded systemProxyForQuery test on Windows 7
Under qemu/kvm the systemProxyForQuery call - when initiated from a
secondary thread - never completes. Consequently the thread hangs, test
fails and the crashes due to the inability to cleanly terminate the test
thread.

Task-number: QTQAINFRA-1200
Change-Id: I9bd4ed163d215fadd8532a03bbdccd80fc8d9cb1
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-06-28 11:25:27 +00:00
Friedemann Kleint
5a60934aa7 Blacklist tst_QSocks5SocketEngine::downloadBigFile()
Task-number: QTBUG-61673
Change-Id: Id81446e52c6492a22347de708b4785f55a1b0d5d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-06-28 10:36:26 +00:00
Tor Arne Vestbø
b0e4c8f427 Remove requirement to call QWindow::setMask after creating window
Like other QWindow properties we can just store it, and the platform
window should pick it up on creation like other properties.

[ChangeLog][QtGui][QWindow] setMask() no longer requires the window
to be created to have an effect; it can be set at any time.

Change-Id: I55b616363801b770bd61bda5325b443013b99866
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2017-06-28 09:07:28 +00:00
Stephen Kelly
3ffcfc357d QSFPM: Avoid following a reset with unnecessary layoutChanged
Follow the pattern used to guard Private::sort() calls elsewhere in the
class.

Because QAbstractItemModel::sort() is not called in the unit test, the
content is not sorted after resetting.

[ChangeLog][QtCore][QSortFilterProxyModel] QSortFilterProxyModel
now does not emit an unnecessary layoutChanged() following a model
reset.

Change-Id: I0a36c7fbb172bdd06ecddb489c5595debbef6cb9
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2017-06-28 07:00:20 +00:00
Allan Sandfeld Jensen
6ca65dd97d Move qle_bitfield to qendian_p.h
Makes the qle_bitfield template more generic and moves it to qendian_p.h
It is also hardened to be more reliable.

Change-Id: I53214ec99cceee4f5e8934ae688c99e555a5fb42
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-06-27 22:16:56 +00:00
Tor Arne Vestbø
4ac47689fa windowflags: Allow testing of naked QWindows, not just QWidgets
Change-Id: Ia0eddcb385207ada8c3df59d49ff1de27a2aeb71
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-06-27 21:56:56 +00:00
Allan Sandfeld Jensen
88e56d0932 Improve rounding of QRect::toRect
Avoid the dimensions of the rounded QRect being off by more than one
pixel. This ensures the aligned containing rect also contains the
rounded rect.

Task-number: QTBUG-56420
Change-Id: Ib79110e51ab80de2dc83d01ea83fc5fbf3852e75
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-06-26 21:35:38 +00:00
Joerg Bornemann
5c6210e345 Support more than 62 instances of QWinEventNotifier
QWinEventNotifiers were limited to 62 instances, because of
WaitForMultipleObject's limitation to MAXIMUM_WAIT_OBJECTS - 1 handles.

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

[ChangeLog][QtCore][QWinEventNotifier] QWinEventNotifier is not
restricted to 62 instances anymore.

Task-number: QTBUG-8819
Change-Id: I2c749951453a4b699cc50dada0d6017440b67a4a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-06-26 05:05:38 +00:00
Friedemann Kleint
460a591a93 tst_QTreeWidget: Fix GCC 7 warnings about using uninitialized variables
qtreewidget.h:179:53: warning: 'search' may be used uninitialized in this function [-Wmaybe-uninitialized]                                                     ^~
tst_qtreewidget.cpp:1564:22: note: 'search' was declared here
     QTreeWidgetItem *search;

tst_qtreewidget.cpp: In member function 'void tst_QTreeWidget::expandAndCallapse()':
tst_qtreewidget.cpp:2678:18: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]

Change-Id: I19c9dc86aa12f36c26ae2475f1854ed17fad0638
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-06-25 22:04:04 +00:00
Tor Arne Vestbø
5176ebc9ca Merge remote-tracking branch 'origin/5.9.1' into 5.9
Change-Id: Ie585425d2d8d05c6ead283b70b88b00e1e3dc1fe
2017-06-25 15:18:37 +00:00
Mitch Curtis
8dd8acf8bb qt_findAtNxFile(): account for .9 (9-patch image) extensions
Currently a file with a .9.png extension will only have its @2x variant
found if it follows this format:

foo.9@2x.png

Since ".9" should be considered part of the file suffix, it should
ideally be able to look like this and still be picked up:

foo@2x.9.png

This patch makes qt_findAtNxFile() account for .9.* extensions.

This is needed for the image-based style support in Qt Quick Controls
2, which uses 9-patch images.

qmlbench benchmark results using
benchmarks\auto\creation\quick.image\delegates_image.qml with
QT_SCALE_FACTOR=2 show no difference in performance after this patch
is applied.

[ChangeLog][QtGui] High DPI variants of 9-patch images can now be
loaded using the following syntax: "foo@2x.9.png"

Change-Id: I6d1384113bef21b4fe85a104ee6b16869c93b077
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-06-24 21:24:53 +00:00
Kevin Ottens
7e7cd1c294 Sort the keys before comparing them in the test
The return order of the keys is random, so let's sort both first, then
we can compare the lists. Should get rid of the test flakiness.

Change-Id: I2e89d3cc603da6a4667b3677350baa4d40d59b45
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-06-22 11:57:33 +00:00
Morten Johan Sørvig
1dcc91b395 Blacklist qFutureAssignmentLeak on OpenSUSE CI
Flaky test, fails on openSUSE_42_1.

Change-Id: Iea5e262578b9960f9facde4fc4e863192058921f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-06-22 11:36:09 +00:00
Liang Qi
7323cd8dc2 testlib: add key sequence function
[ChangeLog][Qt Test] Added keySequence() function.

Task-number: QTBUG-53381
Change-Id: Ib7c3f966fe607f00475ae74aaf070cb988d00141
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
2017-06-22 07:56:18 +00:00
Kevin Ottens
4d70e03002 [Shader Graph Gen.] Introduce QShaderNodesLoader
This class allows to node definitions from a JSON representation. This
will come in handy to ship preset prototypes for use with
QShaderGraphLoader.

Change-Id: I3f3b5d7852e17d484069b4814ee6e5910997c613
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-06-20 21:35:51 +00:00
Kevin Ottens
093752faf3 [Shader Graph Gen.] Introduce QShaderGraphLoader
This class allows to load a shader graph from its JSON representation.
To avoid duplicating the shader snippets inside of the JSON which would
be a maintenance nightmare, we instead allow to register a set of node
prototypes by their name and only refer to said names inside the JSON.

Change-Id: I3e7b39e8b3c25f51f331a0a59dda883ac8e2bc57
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-06-20 21:35:46 +00:00
Kevin Ottens
ad2faa3c63 [Shader Graph Gen.] Introduce QShaderGenerator
This class is meant to generate code from shader graphs

Change-Id: I1cf22352387f3f9f55e7589aa77a296689836911
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-06-20 21:35:40 +00:00
Kevin Ottens
4212451884 [Shader Graph Gen.] Introduce QShaderGraph::Statement
This is our "byte code" representing a flattened graph. It will be used
as input for the code generation.

Change-Id: Ie02a60d07c035f3d16872e79931eb7cde168a8d1
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-06-20 21:35:36 +00:00
Kevin Ottens
29a748511a [Shader Graph Gen.] Introduce QShaderGraph
This allows to connect our nodes together via ports. This way user code
can assemble a shader from simpler blocks.

Change-Id: I168dcf4af6aa11ad47b68d91e5a55e96ca922678
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-06-20 21:35:30 +00:00
Kevin Ottens
3a78c62bb2 [Shader Graph Gen.] Introduce QShaderNode
Nodes will allow to describe inputs, outputs or value transformations in
a shader graph.

Change-Id: I44f806d9595fd0e68fc9026cda2b4fa0a62af283
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-06-20 21:35:25 +00:00
Kevin Ottens
22cd7b02bf [Shader Graph Gen.] Introduce QShaderNodePort
The ports will be used to connect nodes from our shader graphs.

Change-Id: I9d4fbb1f7bd8320c4373ebb166a4fe13bd1482c9
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-06-20 21:35:18 +00:00
Kevin Ottens
57b6b2f527 [Shader Graph Gen.] Introduce QShaderFormat
This is the first building block toward a node based generator for
shader programs.

QShaderFormat will be used by the other classes to qualify in which
format the code snippets and includes used are.

Change-Id: I11aefc6bb359832a853ed1b6bec302dc3516cfc4
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-06-20 21:35:12 +00:00
Thiago Macieira
0669f71b0c QRandomGenerator: don't internally rely on QT_HAS_INCLUDE
GCC didn't support it until version 5 or 6, so add configure tests for
both <random> and <sys/auxv.h>. Normally I'd say "upgrade", but this is
too low-level and important a feature.

There's a good chance that all our supported compilers have <random>
anyway. As for <sys/auxv.h>, it's present on Glibc, Bionic and MUSL, but
I don't see it in uClibc (AT_RANDOM is a Linux-specific feature).

Change-Id: Ia3e896da908f42939148fffd14c5b2af491f7a77
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-06-20 16:37:35 +00:00
Edward Welbourne
68f19fb630 QDateTimeParser: implement parsing of time-zone specifiers
The serialization of date-times understood time-zones (indicated by a
't' in a format string) but the parsing didn't (so viewed the 't' as a
literal element in the format string, not matched by the actual zone
it needs to parse), although some tests expected it to.
This made round-trip testing fail.

Implemented parsing of time-zones.
Re-enabled the formerly failing tests.

[ChangeLog][QtCore][QDateTime] Added support for parsing of time-zones.

Task-number: QTBUG-22833
Change-Id: Iddba7dca14cf9399587078d4cea19f9b95a65cf7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-06-20 09:54:07 +00:00
Edward Welbourne
02b7ec05d5 Be (somewhat more) consistent about the value of pi
Use M_PI (and friends), where possible, in favor of hand-coded
approximations of various (in)accuracies.  Where that's not available
(e.g. fragment shaders), use the same value that qmath.h uses for
M_PI, for consistency.  Replaced math.h with qmath.h in places that
defined a fall-back in case math.h omits it (it's not in the C++
standard, although M_PI is in POSIX); or removed this entirely where
it wasn't used.

Reworked some code to reduce the amount of arithmetic needed, in the
process; e.g. pulling common factors out of loops.  Revised an
example's doc to not waste time talking about using a six-sig-fig
value for pi (which we no longer do) - it really wasn't relevant, or
anything to be proud of; nor did the doc mention its later use.

Task-number: QTBUG-58083
Change-Id: I5a31e3a2b6a823b97a43209bed61a37b9aa6c05f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-06-20 09:53:46 +00:00
Edward Welbourne
82deb0ad16 Update CLDR to v31.0.1
The formatting of times in Norwegian has changed to use colon rather
than dot between hours, minutes and seconds:
http://cldr.unicode.org/index/downloads/cldr-30#TOC-Other
tst_QLocale gets a matching revision.

Change-Id: I35a16080def5fbadd62144a0b44be8110b9be29b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2017-06-20 09:53:21 +00:00
Shawn Rutledge
9d23aebb27 Add QLocale::formattedDataSize and consolidate use cases
It should be easier to translate sizes in bytes to human-readable
strings consistently rather than having to repeat this code (and the
string translations) in various places.  The FileDialog in QtQuick.Controls
has a use for this, too.

[ChangeLog][QtCore][QLocale] Added QLocale::formattedDataSize() for
formatting quantities of bytes as kB, MB, GB etc.

Done-with: Edward Welbourne <edward.welbourne@qt.io>
Change-Id: I27bca146c3eba90fa7a5d52ef6626ce85723e3f0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-06-20 09:53:14 +00:00
Marc Mutz
4088f4ce4d QAbstractItemView: add isPersistentEditorOpen()
[ChangeLog][QtWidgets][QAbstractItemView/QTreeWidget/QTableWidget/QListWidget]
Added isPersistentEditorOpen().

Task-number: QTBUG-61139
Change-Id: I74997d9626812fed83591d32c503680575ec0f7c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-06-20 08:55:40 +00:00
J-P Nurmi
7011252145 Blacklist tst_QParallelAnimationGroup::deleteChildrenWithRunningGroup()
It is flaky on macOS 10.12.

Task-number: QTBUG-61500
Change-Id: I3dfb6979808dec3a20896c2579dd1f5124c94a70
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2017-06-19 18:33:47 +00:00
J-P Nurmi
c9713bcd68 Blacklist flaky tst_QGuiEventLoop::testQuitLock() on macOS 10.12
Task-number: QTBUG-61499
Change-Id: I6eebe2305b47f9ae7be128c3d7a7535f6f04a4da
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2017-06-19 18:33:22 +00:00
J-P Nurmi
8ae55f0d00 Skip unreliable tst_QTimer::moveToThread() on macOS 10.12
Randomly timeouts in the CI.

Task-number: QTBUG-59679
Change-Id: I28410b747b2033fc0ef6286a11c88cd0c07eb247
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2017-06-19 18:32:55 +00:00
Liang Qi
ce09ef4313 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/corelib/io/qprocess_unix.cpp
	src/corelib/io/qprocess_win.cpp
	src/plugins/platforms/android/qandroidplatformintegration.h
	src/plugins/platforms/windows/qwindowscontext.cpp
	src/plugins/platforms/windows/windows.pri
	src/tools/uic/cpp/cppwriteinitialization.cpp
	src/widgets/doc/src/widgets-and-layouts/gallery.qdoc

Change-Id: I8d0834c77f350ea7540140c2c7f372814afc2d0f
2017-06-19 16:12:34 +02:00
Olivier Goffart
a232251992 Moc: Don't error out when parsing namespace __identifier(...)
Present for example in the Windows's Atlbase.h header.
We should not abort the compilation, just ignore that construct

Task-number: QTBUG-56634
Change-Id: Id6e4c9f03cb1cef46e330f4fbcae80ce4f3730c6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-06-19 07:32:18 +00:00
Oliver Wolff
56a29f0e91 winrt: Fix tst_QDialog::showFullScreen
show will use the platform's default flags but the test actually checks
for the flags that were set before so we have to use setVisible(true)
instead.

Change-Id: I52c055ec07d6f0dee626626318c875aefdf67484
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-06-19 07:06:04 +00:00
Oliver Wolff
9ed46c2853 winrt: Fix tst_qurl
Change-Id: Ia7e33e3892f888ead1357f5cd522480f514421e3
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-06-19 07:06:02 +00:00
Oliver Wolff
0086bf62a2 winrt: Fix tst_qtextstream
Change-Id: I5e8076a344a50f70e9618ff7b2e9258182601957
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-06-19 07:06:01 +00:00
Oliver Wolff
5a1f25a1bd winrt: Fix tst_qlanguagechange
Change-Id: Ic11a81b49cc2e7a3fcb895d1556b44baf8c1d6fe
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-06-19 07:06:00 +00:00
Oliver Wolff
9c75ee6858 Fix tst_QOpenGlConfig for platforms with builtin test data
Change-Id: Ifd57002b730987105554514b3498f5e3bb4962e4
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-06-19 07:05:59 +00:00
Oliver Wolff
096cdb3c04 Fix tst_qfile::size for configurations using builtin test data
As the files are packaged into the binary, they have to be
extracted, before they can be ::open'ed.

Change-Id: Ie83086a2b9a73b6b0de462bdb52a71bb277ae06f
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-06-19 07:05:57 +00:00
Oswald Buddenhagen
dd23ed3dbd Merge 5.9 into 5.9.1
Change-Id: I229386dc3e0283dc7e5ad1c580ffcb335c67601c
2017-06-19 08:19:54 +02:00
Allan Sandfeld Jensen
68bcbe2470 Fix tst_QImageReader::imageFormatBeforeRead
The test was never loading images from a valid path, and thus never
had any fullfill the base option which meant nothing was tested.

Making it work revealed that the Format option on BMP formats doesn't
predict semi-transparent files.

Change-Id: I7035a0f63ebfbce940ce7a17a6142cf177480798
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-06-18 12:59:10 +00:00
Tony Sarajärvi
da8701ff57 Blacklist tst_QGuiEventLoop::processEvents in macOS 10.12
Task-number: QTBUG-61131
Change-Id: Ia54d0976f73e733199503e3510daf3d6fa4253a7
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
2017-06-18 12:59:02 +00:00
Tony Sarajärvi
603963e07d Extend blacklisting of tst_QElapsedTimer::elapsed to cover macOS 10.12
Task-number: QTBUG-58713
Change-Id: I0c467c1abcdd1284910e0a61f98646e943eae377
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
2017-06-18 12:58:58 +00:00
Tony Sarajärvi
8875e28372 Blacklist flaky tst_QTimeLine tests on macOS 10.12
Task-number: QTBUG-61037
Change-Id: I604bbc815c16a5ab436d2ff4936d96d3a2d27dab
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
2017-06-18 12:58:53 +00:00
Friedemann Kleint
bd263452cd Revert "QWidgetEffectSourcePrivate::draw(): Call render() when no shared painter exists"
The change causes drawing artifacts in Qt Creator.

This reverts commit 8b1377fde1.

Task-number: QTCREATORBUG-18322
Task-number: QTBUG-60231
Change-Id: Ic05507b0c23ea612fa5a9b92163380059b6e710d
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-06-14 13:00:35 +00:00
Friedemann Kleint
36f21c5b56 Blacklist tst_QWidget::restoreVersion1Geometry for XCB
FAIL!  : tst_QWidget::restoreVersion1Geometry(geometry.dat) Compared values are not the same
    Actual   (((widget.pos()))): QPoint(90,90)
    Expected (expectedPosition): QPoint(100,100)
    Loc: [tst_qwidget.cpp(3193)]

Remove the previously added QSKIP since this test now passes.

Task-number: QTBUG-26421
Task-number: QTBUG-46116
Change-Id: Ieff474a8a69c14a0df231a9a587aee02df4e8ea7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-06-14 09:24:54 +00:00
Joerg Bornemann
7ad55ca65f Support standard channel redirection in QProcess::startDetached
[ChangeLog][QtCore][QProcess] Added support for standard channel
redirection using setStandard{Input|Output|Error}File to
QProcess::startDetached.

Task-number: QTBUG-2058
Task-number: QTBUG-37656
Change-Id: Iafb9bd7899f752d0305e3410ad4dcb7ef598dc79
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-06-13 16:49:38 +00:00
Dongmei Wang
79a77f7def Manual dialog test: fix use custom directory icon option setting
In FileDialogPanel::options(), QFileDialog::DontUseCustomDirectoryIcons
was set when the "Don't use custom directory icons" box wasn't checked.

Change-Id: I6e9d9b41cf91f4abcc98c02bed44675908a8391d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-06-13 16:14:34 +00:00
Tony Sarajärvi
64a3ca56d7 Blacklist flaky tst_QMdiArea test
Task-number: QTBUG-61381
Change-Id: I5f47315b32b74245479b73297f64944ac929c2b6
Reviewed-by: Liang Qi <liang.qi@qt.io>
2017-06-13 16:00:58 +00:00
Oliver Wolff
876aed331d Fix tst_QIcon for configurations with builtin_testdata
Change-Id: Ibf9fcf7d3a8d58c9c488637a45985593950defaf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-06-13 12:36:29 +00:00
Oliver Wolff
24decb49d6 winrt: Fix tst_QImageReader
Change-Id: I3a7db49329d8f1677c17267f5878d5144ad37823
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-06-13 12:36:23 +00:00
Edward Welbourne
4cb46e27fd generate_expected_output.py: more refinements to filtering of noise
Two more ways line numbers were making it through.
Corrected a doc-string to tell nearer to the truth.

Change-Id: I946aaeb936d47fffe50d7ec15e2524992cc9e428
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-06-13 11:27:38 +00:00
Edward Welbourne
06f956b8f9 generate_expected_output.py: refer to tst_selftests.cpp for test list
Document that the saved output is used by tst_selftests.cpp and use a
crude parse of it to get the list of subdirs that it actually tests.

Change-Id: I73023228c9e547f965b7749dd66de7ef09c3815e
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-06-13 11:27:29 +00:00
Jarek Kobus
73f8b605e3 uic: Fix possible crash when reading the size hint property
It may crash on (probably a bit broken)
qtbase/src/printsupport/dialogs/qpagesetupwidget.ui

Change-Id: Ibca95a3d8aa4899adbc952aee7b46621ac888c6a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-06-13 06:56:10 +00:00
Thomas Sondergaard
65a317e674 Use QMap in QProcessEnvironment so variables are sorted
The motivation for this change is to make it simple to pass a
correctly sorted environment block to Win32 CreateProcess(). It is
also nice in other contexts that the environment variables are
sorted. The change is made for all platforms. This keeps it simple and
the only ill effect is slightly slower lookups.

Concerning the environment block passed to Win32 CreateProcess:

The environment block that is passed to CreateProcess() must be sorted
case-insensitively and without regard to locale. See
 https://msdn.microsoft.com/en-us/library/windows/desktop/ms682009(v=vs.85).aspx

The need for sorting the environment block is also mentioned in the
CreateProcess() documentation, but with less details:
 https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx

Task-number: QTBUG-61315
Change-Id: Ie1edd443301de79cf5f699d45beab01b7c0f9de3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-06-13 06:09:40 +00:00
Andy Shaw
26fd805f50 macOS/iOS: Correctly ignore punctuation in QCollator
When punctuation is ignored then the kUCCollatePunctionSignificantMask
should not be set. This was originally thought to not be working due to
a bug on the Apple platforms, but this is not the case.

[ChangeLog][Platform Specific Changes][macOS][iOS] QCollator now
respects the ignorePunctuation property on Apple based platforms
correctly.

Task-number: QTBUG-41978
Change-Id: I62044076387d6e4479f4aaef3c2f48f49dbd160e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-13 04:08:56 +00:00
Friedemann Kleint
9205110cfe Refactor tst_QStyleSheetStyle::focus/hoverColors()
- Put all widgets in one dialog so that show/setActive occurs only once.
- Use the center of the widget geometry for positioning.
- Remove BypassWindowManagerHint which likely causes qWaitForWindowActive()
  to fail.
- Move the cursor out of the way and subsequently send mouse events
  to the QWindow

Task-number: QTBUG-51400
Change-Id: I2176d8dbaead72d7a6fa89aa769e4c804eea7a0c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-06-12 14:27:04 +00:00
Thiago Macieira
5483b30868 QTemporaryFile: fix the generation of names from templates
First and most importantly, let's not use more than half of the template
for the application's PID. With over 71% of all PIDs on a typical Linux
system and 90% of those on a Darwin system having 5 decimal digits,
using them all in a template that is usually 6 characters long is
wasteful. That leaves only 1 character for the random part, thereby
reducing the number of temporary files possible to only 52. So limit the
PID to half the characters of the template.

Second, let's use QRandomGenerator::bounded to create the the random
part, instead of qrand (which is often unseeded at this point).

Change-Id: Icd0e0d4b27cb4e5eb892fffd14b52eda5e467395
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-12 06:14:43 +00:00
Thiago Macieira
593f022515 Long live QRandomGenerator
This class provides a reasonably-secure random number generator that
does not need seeding. That is quite unlike qrand(), which requires a
seed and is low-quality (definitely not secure).

This class is also like std::random_device, but better. It provides an
operator() like std::random_device, but unlike that, it also provides a
way to fill a buffer with random data, not just one 32-bit quantity.
It's also stateless.

Finally, it also implements std::seed_seq-like generate(). It obeys the
standard requirement of the range (32-bit) but not that of the algorithm
(if you wanted that, you'd use std::seed_seq itself). Instead,
generate() fills with pure random data.

Change-Id: Icd0e0d4b27cb4e5eb892fffd14b4e3ba9ea04da8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-12 06:14:34 +00:00
Simon Hausmann
b598cd0483 Ignore test failures of linkLocalIPv6 on RHEL 6.6 in the CI
The test fails as sendmsg() on the socket trying to deliver a packet to
the IPv6 link-local fe80 address returns with -ENETDOWN. I cannot figure
out why this happens when RHEL 6.6 is run under qemu/kvm but not under
vmware. More details are in the task, but meanwhile the result of this
test is ignored.

This affects only RHEL 6.6, it passes on RHEL 7.2.

Change-Id: I4ade5cd249dd0d1901368ab571dad324e0fd10c2
Task-number: QTQAINFRA-1042
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-06-12 04:43:58 +00:00
Edward Welbourne
3e0bf04d7b Typo-fix: s/looses/loses/g
When an archer lets go of the bow-string, she looses an arrow; when
the hounds are straining at their leashes and the handler lets go, he
looses the dogs.  It's archaic usage now; we'd normally say "lets
loose", "lets go" or "releases".  In any case what was meant here was
that something got lost; a widget loses focus or a network loses its
connection.

Change-Id: Ic1fbe9e1f76185bcb7caf034d6be97ebfeb2e270
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-06-08 13:36:18 +00:00
Laszlo Agocs
2ea90c56f2 Start supporting purely offscreen QOpenGLWidget
Due to popular demand. It does have it benefits (especially when
it comes to convenience) to allow grabbing QOpenGLWidgets even
when they are not part of an actual window and are not actually
visible.

Does not involve much more than dropping the warnings and bailouts
when there is active native window (because the QOpenGLWidget/its
parents are still hidden).

In addition the device pixel ratio from metric() has to be fixed
as well.

[ChangeLog][Qt Widgets] QOpenGLWidget is now able to render and
return its content via grabFramebuffer(), QWidget::grab() or
QWidget::render() even when the widget has not been made visible.

Task-number: QTBUG-47185
Task-number: QTBUG-61280
Change-Id: Icc2b0b3ce9778a3eb6409d54744238568abb0f0d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-06-08 13:34:54 +00:00
Tor Arne Vestbø
c3a115b90d json: Add operator[] to QJsonDocument for implicit object and array access
Makes it easier to pull out data from a document when the structure is
known up front, while still supporting default values if the structure
does not match the expectation, eg:

 int age = QJsonDocument::fromJson(ba)["users"][0]["age"].toInt(-1);

Change-Id: Ief0899bbb81610f6f22a56e2ac846121bffe77a0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-08 11:23:55 +00:00
Tor Arne Vestbø
a7823b4878 json: Add operator[] to QJsonValue for implicit object and array access
Saves a lot of manual toArray() and toObject() calls when the
JSON structure is usually known anyways. Read only access for now.

Change-Id: I5fd787144198e0443e4da285a11ce2597b66f99f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-08 11:23:46 +00:00
Chris Wilson
147aa29162 Fix sending UTC-offset QTimeZones through QDataStream
QTimeZone("UTC") should be valid, as "UTC" appears in the list of
availableTimeZoneIds(), and tst_QTimeZone::dataStreamTest() constructs
timezones like this, which are considered valid.

The internal representation of a QTimeZone("UTC") as created by
QTimeZone::QTimeZone(const QByteArray &ianaId) is a QUtcTimeZonePrivate
which isValid(), so the containing QTimeZone isValid() too.

When QTimeZone is serialized into a QDataStream, it calls
tz.d->serialize(ds) which is QUtcTimeZonePrivate::serialize. This
writes QStringLiteral("OffsetFromUtc") followed by the IANA ID and
the offset (etc.) to the datastream.

When QTimeZone is deserialized it looks for this marker string, and if
present, it passed all of the parameters to the QTimeZone constructor
(not just the name). However, that constructor does not support standard
IANA timezones (only custom ones), and when it detects that the supplied
IANA ID is actually listed in availableTimeZoneIds(), it leaves the
pointer to the QTimeZonePrivate uninitialized (NULL), which leaves
the QTimeZone invalid (isValid() returns false).

Thus, a valid timezone which was serialized and then deserialized has
become invalid. This also affects serialization of QDateTimes with
timezones.

Fixed by calling the name-only constructor first, which works (only) for
IANA standard timezones and leaves the QTimeZone invalid (isValid()
returns false) otherwise. In which case, we can call the many-argument
contructor to create a custom timezone with the same offset as the one
which was originally serialized.

[ChangeLog][QtCore][QTimeZone] Fixed sending IANA standard UTC-offset
QTimeZones through QDataStream, which previously came out invalid after
deserialization.

Task-number: QTBUG-60595
Change-Id: Id9c47e8bda701faae4d800e012afb6db545b2fe9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-06-08 08:34:31 +00:00
Oliver Wolff
5441f399af Fix tst_QDir::emptyDir
It is possible that tmpdir already exists as a leftover from previous
tests. That is no reason for the test to fail.

Change-Id: I010633fb92defb064093af9872ae6fd2178f07dd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-06-08 07:40:16 +00:00
Oliver Wolff
8e776d39ff Fix tst_qresourceengine for platforms with embedded test data
load(resources) makes embedding the test data into the executable
fail for platforms that use builtin test data. As the load call
is only used to obtain QMAKE_RCC we can avoid that call by
assuming that rcc was not renamed and assembling the path ourself.

Change-Id: I25b982d10f5617d9a213803e7e4bcc85fc66b2e7
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-06-08 07:40:15 +00:00
Albert Astals Cid
f78a189da5 QSSLSocket::readData return -1 when socket is not connected
As QAbstractSocket::readData does and as the documentation of QIODevice says
"this function returns -1 in those cases (that is, reading on a closed
socket..."

Change-Id: I1e64673f6a6d792a640bd6cb28b2bb5a0f18dc36
Reviewed-by: Aleix Pol
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-06-08 04:00:54 +00:00
Friedemann Kleint
6a6cdccee4 tst_QSharedMemory::readOnly: Skip on macOS
The binary hangs rather than segfaults on that platform.

Task-number: QTBUG-59936
Change-Id: Id7d38edb7c746e3c0cd4b4941e0e19b3d42a628a
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-06-07 16:21:49 +00:00
Sérgio Martins
0265a23bb0 Fix crash when calling QWidget::grab() on a QOpenGLWidget
By avoiding unneeded nested QPainters.

Crash was:
ASSERT: "s" in file /data/sources/qt/qt5/qtbase/src/gui/painting/qpaintengine_raster.cpp, line 2239

s was nullptr because the inner QPainter had called updateState(0), which is then dereferenced by the outer QPainter.

Task-number: QTBUG-61036
Change-Id: I7aad648f805f1abac4d38dfbefa2292da8b52af4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-06-07 14:49:13 +00:00
Liang Qi
7cbee56296 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/widgets/widgets/qmenu.cpp

Change-Id: I6d3baf56eb24501cddb129a3cb6b958ccc25a308
2017-06-07 14:02:43 +02:00
Olivier Goffart
94a2aec05b moc: Don't error out when defining a keyword
Normaly, in C++ It's not valid to define a keyword, but it turns out that some
system header do, so we just silently accept it.

[ChangeLog][moc] moc no longer errors out if a C++ keyword is #define'ed

Task-number: QTBUG-61204
Change-Id: Ia4d3ff9c77b6ff261b6140c220cfb81bd13f1d6d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-06-06 22:53:07 +00:00
Thiago Macieira
74111ce590 Continue to blacklist the utun interfaces on macOS
There were two more places that blacklisted certain interface types that
commit e579c822c5 didn't catch. This
commit adds those two.

Task-number: QTBUG-61263
Change-Id: Ia58d0480a9169f0f121aec03bf2e8900a58939cd
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2017-06-06 22:53:04 +00:00
Jesus Fernandez
5b24f0a6bb Add QLocalServer::socketDescriptor
Adds a function to return the native socket descriptor. It allows
threaded or forked applications to reuse a previously created socket.

[ChangeLog][QtNetwork][QLocalServer] Added a function to retrieve
the socket descriptor.

Task-number: QTBUG-55043
Change-Id: I556e97000d2c02ad2bdd636984de6c7564381c6a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-06-06 17:46:50 +00:00
Joerg Bornemann
ea57a23d7a Remove QWinOverlappedIoNotifier
This class in unused in qtbase since Qt 5.6.1.

The only outside usage was in qtserialport, which got its own copy of
QWinOverlappedIoNotifier in commit qtserialport/65dba188.

Change-Id: I7668e67a1cc49c4418c66141784b180cd5f9d479
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-02 20:01:43 +00:00
Marc Mutz
1e503d7634 Move QGestureRecognizer test to widgets/kernel
It's the subdir where the implementation also lives. There's no
src/widgets/gestures, either.

Change the mac: into a darwin: scope in the .pro file, so Sanity Bot
does not complain.

Change-Id: I7608d6da05af4a1117db585798a87a20ae80717a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-06-02 18:36:11 +00:00
Alexey Chernov
8b6d6d4832 Do its best in QComboBox to map completer's index
Add additional code paths to map the index passed by QCompleter in its
activated() signal in case when QCompleter's model isn't the same as
QComboBox's one.

Task-number: QTBUG-52027
Change-Id: I1d74037fccbe19962bb7f242aa7b1c2441aa5d54
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-06-01 17:09:21 +00:00
Oliver Wolff
61f67c12fa winrt: Use styleHint as clue for fallbacks for font families
Similar on how it is done for Windows desktop we also use the given
style hint when building the list of fallbacks a font family.

Change-Id: I71378581d07f20ebe5bf0bc757bba919cc70e118
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-06-01 08:23:51 +00:00
Tony Sarajärvi
40a7c57ba9 Blacklist tst_QTimer::basic_chrono on macOS
Task-number: QTBUG-61013
Change-Id: I1c877aeb3e141e0e19b71bf9e595ff478e313b10
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-01 07:27:59 +00:00
Thiago Macieira
c214c000cc qEnvironmentVariableIntValue: fix the case of a non-numeric value
The documentation says that it's equivalent to
    qgetenv(varName).toInt()

But the implementation wasn't. QByteArray::toInt() verifies that the
entire string was consumed, so QByteArray("1a").toInt() == 0, but
qstrtoll alone doesn't. That is, qstrtoll("1a", ...) == 1.

The implementation also detected the base, a behavior I kept. Instead, I
updated the documentation.

Change-Id: I0031aa609e714ae983c3fffd14676ea6061a9268
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-06-01 06:02:10 +00:00
Liang Qi
e3bc01b0e3 Merge "Merge remote-tracking branch 'origin/5.9.0' into 5.9" into refs/staging/5.9 2017-05-31 18:54:04 +00:00
David Faure
f33cf18d88 QAbstractItemModel::supportedDragActions: fix regression
This method now returns -1 by default, due to commit 6255cb893d
which mistakenly replaced -1 with Qt::IgnoreAction (0x0).

As a result, dropping is forbidden in a number of applications
(I detected this in zanshin).

Change-Id: I4922451216e08d5d3fe36f8ba87364a361b691bf
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-05-31 18:54:00 +00:00
Allan Sandfeld Jensen
32a94e54b5 Do not always use argb32pm for subsurfaces
A number of drawing paths were never tested by lancelot because we
always used argb32pm for subsurfaces. This patch switches the
subsurfaces to use the painter format or its alpha version. This means
changes to composition tests as it changes precision, especially of
alpha in the a2rgb30 formats.

Change-Id: I24d53bf6e1db8cca36bda69e2ddf07f20256b3c8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-05-31 18:53:57 +00:00
Tony Sarajärvi
600454578d Extend blacklisting of tst_QSemaphore
tryAcquireWithTimeout(0.2s) was already blacklisted and
now the same failed with "(2s)".

Task-number: QTBUG-58745
Change-Id: I82363238c08056d2969a7616e3a6e5af080d537d
Reviewed-by: Liang Qi <liang.qi@qt.io>
2017-05-31 18:53:50 +00:00
Oliver Wolff
72e9aee500 winrt: Fix tst_QPainterPath
We have to use a temporary data path for winrt, as the applications
are sandboxed and cannot just put data anywhere.

Change-Id: I8f95de132e5b5ac77441cbbf26af873b8018c7cb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-31 13:10:05 +00:00
Oliver Wolff
00d9033fa0 Fix tst_QFile for configurations without process support
Change-Id: Icca2d55f0b9402bf4bcb009d972f21075d144f87
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-31 13:10:04 +00:00
Oliver Wolff
a0d3b5bb2b Fix tst_qmessagehandler for configurations without process support
Change-Id: If61a7b1e389e7fffb9cfa85d6b5d77a7b777215f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-31 13:10:03 +00:00
Liang Qi
7ee80242de Merge remote-tracking branch 'origin/5.9.0' into 5.9
Change-Id: I2d7a3f3a80e6287e135e55b650f74f9a540332bc
2017-05-31 08:11:37 +02:00
Stephan Binner
dbeb748de3 Convert features.printdialog to QT_[REQUIRE_]CONFIG
Change-Id: Ifb016ae2a0986b436f788b34513c81ea91f3804a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-05-30 17:21:26 +00:00
Mitch Curtis
c25ad981a3 QWidgetWindow: don't give focus to windows that are being destroyed
In the referenced bug report, dismissing a QFileDialog while the
Qt Virtual Keyboard was in use would result in a crash.

Dismissing a file dialog created with
e.g. QFileDialog::getOpenFileName() causes it to eventually be
destroyed. When this happens, it starts deleting its children. Each
child widget's destructor calls clearFocus(). In clearFocus(), there is
a block of code that emits QWindow::focusChanged(), passing the result
of focusObject() called on that widget's window.
QWidgetWindow::focusObject() could end up using itself as a fallback
focus object if it had no other focus objects (e.g. children) to use
instead, even though it was in the process of being destroyed; as were
all of its children. The Qt Virtual Keyboard plugin would then try to
use the focus object, even though it was in an invalid state.

To fix this problem, we return early from QWidgetWindow::focusObject()
if the window is in the process of being destroyed.

Task-number: QTBUG-57193
Change-Id: I137cf9415812ce2e0419c0afe8076ce150f248cb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-05-30 10:49:36 +00:00
Mitch Curtis
64a4216254 tst_QFiledialog: use escape to close dialogs instead of timer
This makes the test a lot faster and perhaps more reliable.

Change-Id: I055cfde627c75f71735eabbf01af2a196bd8b00a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-30 07:19:42 +00:00
Thiago Macieira
e579c822c5 tst_qudpsocket: Blacklist "utun" interfaces on Darwin
Packets sent to to link-local addresses on it are never received. We
don't know why this happens, as the tooling provided by Apple for
development is close to useless. So we just ignore this interface.

Task-number: QTBUG-61041
Change-Id: Ia608df1fff6bdee5238e107d8a50292a1f9e5c03
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2017-05-29 17:03:41 +00:00
Mitch Curtis
a089de0d99 Fix tst_QWidget::translucentWidget() on high DPI displays
It was grabbing a QLabel without accounting for the size of
the window in the case where the DPI is larger than 1:

FAIL!  : tst_QWidget::translucentWidget() Compared values are not the same
   Actual   (actual.size())  : QSize(32x32)
   Expected (expected.size()): QSize(16x16)

Change-Id: I4873f3c6364ee2696f5612d91e6c97c60b2cd915
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-29 10:35:46 +00:00
Friedemann Kleint
8b1377fde1 QWidgetEffectSourcePrivate::draw(): Call render() when no shared painter exists
Task-number: QTBUG-60231
Change-Id: If07274a01bb9a4b9323865a3e061b3674507fd5b
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-05-29 10:23:01 +00:00
Liang Qi
6a772fd201 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	.qmake.conf
	mkspecs/common/msvc-desktop.conf
	mkspecs/win32-g++/qmake.conf
	mkspecs/win32-icc/qmake.conf
	src/platformsupport/fontdatabases/mac/coretext.pri
	src/plugins/platforms/cocoa/qcocoawindow.h
	src/plugins/platforms/cocoa/qcocoawindow.mm

Change-Id: I74a6f7705c9547ed8bbac7260eb4645543e32655
2017-05-29 10:54:41 +02:00
Tony Sarajärvi
315f634180 Fix autotest not to open too many files on a Unix
tst_QSharedPointer can't create a pipe as the OS has too many files
open. Systems like macOS have a lower limit to these simultaneous files
open.

Task-number: QTBUG-60410
Change-Id: I21e89f992ada2a7d09b706522a05b5952f00ec33
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-05-29 06:46:50 +00:00
David Faure
f6b36eaafe QHeaderView: fix visual/logical index corruption when restoring state
This is a followup to 77a8e90cdd which
didn't handle the case where no columns had been moved.
visualIndices and logicalIndices are empty until initializeIndexMapping()
is called, in which case appending is wrong.

As a result, visualIndex(i) would return -1 for the values over
those added by read(), and an assert would happen at painting time.

The fix is to leave visualIndices and logicalIndices empty if
they are empty already, leaving it to initializeIndexMapping()
to fill them later if necessary (e.g. when moving a column).

Task-number: QTBUG-60837
Change-Id: Ia7e4b9d3122647984acd434dfaa0400df319d065
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2017-05-26 12:43:31 +00:00
Tony Sarajärvi
b09c4cc48e Blacklist tst_QEventLoop:testQuitLock as it is flaky on macOS
Task-number: QTBUG-60992
Change-Id: I9474fd67b6429f01ddbbc9ae17af4ae8635e53df
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-23 14:52:31 +00:00
Tony Sarajärvi
1c13d130c6 Extend blacklisting of qeventdispatcher to cover macOS
They have been blacklisted on windows previously and now fail on
macOS 10.12 as well.

Task-number: QTBUG-60993
Change-Id: Ib7a3acfc7f2285c0a587d4abd88a4a218391d623
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-23 14:52:09 +00:00
Andy Shaw
d67410c615 Ensure status tips for a headerview section are handled
When the mouse is moved over a header section then if there is a status
tip then this should be sent as an event like it would for a typical
QAbstractItemView.
Also adds a test for the StatusTipRole for the QTreeView itself as well as
the header.

Task-number: QTBUG-2066
Change-Id: Iaef8d91f1bd621c2463cde2dff4b2291fb037975
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-05-23 11:51:03 +00:00
Albert Astals Cid
2ca187caa3 moc: Allow NOTIFY signals defined in parent classes
Limitation is that the signal needs to be parameter-less

[ChangeLog][moc] moc now supports NOTIFY signals of parent classes in Q_PROPERTY

Change-Id: Iad64c96c3ec65d4be8ad9ff1a9f889938ab9bf45
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
2017-05-23 11:11:52 +00:00
Liang Qi
d6248ed80e Merge "Merge remote-tracking branch 'origin/5.9.0' into 5.9" into refs/staging/5.9 2017-05-19 20:27:29 +00:00
Friedemann Kleint
c4addd221e tst_QTimer::timeout(): Use QTRY_VERIFY_WITH_TIMEOUT
The test has been observed to be flaky on Windows. Introduce
QTRY_VERIFY_WITH_TIMEOUT for diagnostics.

Change-Id: I72abdd2e5544f8f35199876486ab15151f60e5f2
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-05-19 17:42:24 +00:00
Liang Qi
550e16b814 Merge remote-tracking branch 'origin/5.9.0' into 5.9
Change-Id: Ia8ac1960387c0f78c32f9d0385bb0aa9a8209af1
2017-05-19 08:57:59 +02:00
Frederik Gladhorn
b8094e4b22 Stabilize tst_QSqlThread::readWriteThreading
According to the test metrics this test failed 10 times in the last two
days. Interestingly the log shows that usually 5.5 seconds would have
let it pass.

Change-Id: I38f21f35bd6624f1d3de1e1e811a4d107136a241
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2017-05-18 21:18:02 +00:00
Allan Sandfeld Jensen
c25bce109e Add QPolygon::intersects() methods
Corresponds to the similar function QPainterPath::intersects() and is
faster than calculating the intersection and then checking if it is
empty.

Change-Id: I694bb2206ed330a456a41d4118a952a68177b7a2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-05-18 08:55:16 +00:00
Thiago Macieira
19296bc7b0 Add Q_FALLTHROUGH to QtDBus tests
There was only one place that needed it.

Change-Id: I067fcfe299b34ab6a771fffd14bf2945f1953d10
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-05-17 16:16:02 +00:00
Allan Sandfeld Jensen
07fd674740 Fix painterpath rect intersections with points on the rect
QPainterPath could in certain cases where sub-path points were on the
border of a rect fail to calculate intersects() correctly.

The patch adds handling of such cases by looking if end points cross in
or out of the rect. Other cases are already caught.

Task-number: QTBUG-31551
Change-Id: I6284da8ff8646d4636702923a76362302dde5767
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-05-17 11:56:46 +00:00
Allan Sandfeld Jensen
13de0e5129 Add test-case for intersection equality
Test-case taken from QTBUG-17027

Task-number: QTBUG-17027
Change-Id: I92ceb76addc4a61d19963d89f89e1f6386d8a049
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-05-17 10:21:19 +00:00
Jesus Fernandez
904788e3c6 Add swap and move operator to QHostInfo
Also mark as shared-come-qt6,

[ChangeLog][QtNetwork][QHostInfo] Added swap() and move operator.

Change-Id: I8f422868f0487a37aeba3bc74685dc4912e9b3a4
Coverity-Id: 168204
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-05-16 09:55:46 +00:00
Marc Mutz
cafefd1d33 QStringView/QLatin1String: add trimmed()
... using the same qt_trimmed(), qTrimmed(), Q..::trimmed() split we've
been using for all other out-of-line string-view member functions to
avoid forcing string-view objects onto the stack for the passing of 'this'.

In the test, had to fix nullness not being propagated from a QByteArray
to the QLatin1String constructed from it. Probably worth fixing in
QLatin1String(QByteArray), too.

[ChangeLog][QtCore] Added qTrimmed() free functions.

[ChangeLog][QtCore][QLatin1String] Added trimmed() function.

Change-Id: I73c18ef87e203f30f7552c10dd5c84223bcfae0e
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-05-16 09:34:59 +00:00
Marc Mutz
3c592a17f1 QStringView: add constructor from pointer pair
This is often more natural than (ptr, len), and I need it in the
implementation of QStringView::trimmed().

Change-Id: I1d99b5ddaf76eee0582150b0233ef6ce9c37d25d
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-05-16 09:34:50 +00:00
Eirik Aavitsland
5dc0e4b285 Simplify code by factoring out brush transformation for gradients
Emulation of non-logical coordinate mode gradients was implemented by
essentially 3 x 2 repetitions of the same manipulation of the QBrush
transform. Avoid the code duplication by extracting a common method.
Add lancelot test scripts that excersizes these code paths.

Change-Id: I7baa921923231ef9e83e443dba996b82b32ad1e7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-05-15 22:55:06 +00:00
Gabriel de Dietrich
639d6c4d0d QMacStyle: Replace QAquaWidgetSize with WidgetSizePolicy
No need to have two enums for the exact same purpose.

qmacstyle auto-test updated as well.

Change-Id: Ia601648191e39c0cbbaa7477143441005ae063c2
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-15 22:39:28 +00:00
Tor Arne Vestbø
cb9afb0627 Blacklist tst_QGraphicsScene::removeItem on OS X 10.11 in CI
Known to fail now and then, most likely due to the mouse cursor
moving while the test is executing.

Task-number: QTBUG-60754
Change-Id: Id8f0786416d0df33f197a7a8f99b7aad1341a6be
Reviewed-by: Liang Qi <liang.qi@qt.io>
2017-05-11 10:32:38 +00:00
Frederik Gladhorn
9eb00a3397 Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev 2017-05-11 09:55:44 +00:00
Morten Johan Sørvig
d7a9e08f0a Make QWindow::setVisible() work for widgets
QWidget has its own setVisible() code that needs to
be run in order to correctly transition widget visibility.

It is desirable to be able to show and hide (native)
widgets also from the QWindow side, for example from
the platform plugin, or from generic QWindow handling
code in QtGui.

Add a new virtual QWindowPrivate::setVisible() and
move the QWindow visibility implementation there.
Subclasses can now override this function to add custom
code.

Make QWidgetPrivate::show/hide_sys() call the QWindowPrivate
setVisible implementation instead of the QWindow setVisible
public API.

Change-Id: I082f174b100659e1221d5898b490f8a9f498abdf
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-11 07:22:51 +00:00
Oliver Wolff
5c38bbf9ba winrt: Fix tst_QSocketNotifier::asyncMultipleDatagram
Change-Id: I90de7487b0ddcd5655434e99a05eef7f29def59b
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-05-11 06:37:36 +00:00
Oliver Wolff
7e7bc031e9 winrt: Fix tst_qcoreapplication
On winrt, the default application version is determined by its
manifest file. The template's default version is 1.0.0.0.

Additionally addRemoveLibPaths should not fail if libraryPaths
only contains currentDir.

Change-Id: Ifdd517f1bfe2fdf641f3d728ebe1fa144df1a8ca
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-05-11 06:37:34 +00:00
Marc Mutz
38bbd8fbac Add some missing breaks in switch statements
Found by GCC 7.

Change-Id: I90267617a038558e5b5213c598a949baf8d4d9be
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-05-10 16:09:42 +00:00
Frederik Gladhorn
6881e1613a Merge remote-tracking branch 'origin/5.9' into dev
Change-Id: I172e3e19ddcc5b7665e6c8382d725e7cc4f9794f
2017-05-10 10:11:57 +02:00
Frederik Gladhorn
7f80c96432 Stabilize tst_QApplication::touchEventPropagation
CI metrics show that this test was flaky ~38 time in 3 days.
The problem is old: after we get a surface, a window manager can still
decide to re-position the window.
The fix is to simply send the touch event in a position where it is sure
to hit the window (usually the offset is the title bar height).

The blacklisting seems to not have worked, I could reproduce the failure
on a linux/xcb machine.

Change-Id: I5229fe020ba75c984fd3b6c322ad00d769707573
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-05-10 04:52:04 +00:00
Filippo Cucchetto
be0a221ae4 Fix missing handling of columns when merging selection ranges
This commit fixes two bugs:
1) Two ranges should not be merged if they are of different columns.
The old code would have merged (0,0) with (1, 1). Tranforming a selection
of just two indexes in a rectangle of four indexes.
2) The QItemSelectionRange appended had wrong column and worked only for
indexes of the first column. For example if 'tl' was (0, 1) than br was (0, 1)
so the QItemSelectionRange would have be ((0,1), (0, 1-1)) so ((0,1), (0,0)).
This QItemSelectionRange is invalid because topLeft columns is greater than
bottomRight column. The fix take in consideration the bottomRight column.

Task-number: QTBUG-58871
Change-Id: I591ef0bcc63926f24a7b1ced002af9b7737a4b6e
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2017-05-09 13:46:51 +00:00
Teemu Holappa
16f950c702 Skip failing autotests with b2qt toolchain
Task-number: QTBUG-59966
Change-Id: I36d114107187db22841ebfeff8fa8175daff6d03
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-05-09 08:11:18 +00:00
David Faure
74d79fcf1a QMimeDatabase: update freedesktop.org.xml to shared-mime-info 1.8
... and update the unittest accordingly.

Compared to the 1.8 release there is one change in freedesktop.org.xml,
the magic for application/x-java-keystore was changed from host32 to
big32, as done upstream, see https://bugs.freedesktop.org/show_bug.cgi?id=99328

Task-number: QTBUG-60608
Change-Id: I47de71c9396cfc3eabc884d5679c73a3e4850a17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-05-08 18:04:24 +00:00
Giuseppe D'Angelo
b7da94ce52 QObject: turn the narrowing test into static_asserts
The conditions checked are compile-time conditions anyhow.
Simplify or strenghten a few conditions while at it.

Change-Id: If07f2aedca4c3632d852a8fdb2b3f7eb55a96c93
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
2017-05-08 14:24:02 +00:00
Sami Nurmenniemi
be36fca32b tst_qmessagehandler: fix qMessagePattern for arm with optimizations on
Backtrace logging tests were not passing for arm when -O2 option was used.
Set "-fno-inline" on for the app whose backtrace is to be inspected.

Task-number: QTBUG-59966
Change-Id: Id1bbf78c31dc524357a30c7d39c239689621b155
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-05-08 11:18:10 +00:00
Alberto Mardegan
a6f3bb21e3 QMimeType: add Q_GADGET
The QMimeType class can be quite useful to graphical QML applications,
especially on the desktop.

[ChangeLog][QtCore][QMimeType] Add Q_GADGET, so that QML applications
can make use of QMimeType's properties and methods.

Change-Id: I03e6e82062558a72f5b97e65bbddfc4b7470e735
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Jeremy Katz <jeremy@panix.com>
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-08 06:51:29 +00:00
Glen Mabey
cab9bc8fba Eliminate ambiguous casts involving qfloat16
The operator double() and operator long double() members of qfloat16
are causing cast ambiguities.  This removes them, leaving only
operator float() which seems to be adequate.

Also, additional arithmetic operator tests were added which without
this removal fail to compile.

Change-Id: Id52a101b318fd754969b3de13c1e528d0aac2387
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-05-07 16:44:55 +00:00
Liang Qi
d1ea481345 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/network/access/qnetworkreply.cpp
	tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp

Change-Id: Iadf766269454087e69fb216fc3857d85b0ddfaad
2017-05-07 13:08:18 +02:00
Marc Mutz
b92267cd4c Remove some more register keywords
They're deprecated since C++11 and removed in C++17.

Change-Id: Ia2acd9312707bfee96838743645a04ae1780e5dd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-05-06 16:59:18 +00:00
Samuel Gaist
ae292be869 Implement key-value iterator
This patch implements an iterator that returns a pair containing both the
key and the value of an entry in QHash/QMap.

[ChangeLog][QtCore][Containers] Added an stl-like iterator to go through
QHash/QMap returning both the key and the value of the element pointed to.
That lets QHash/QMap interoperate better with stl's algorithms like
std::set_union.

Change-Id: Idbf8a8581510b3493648c34ab04c556de9fa4aa7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-05-05 14:25:56 +00:00
Giuseppe D'Angelo
dbd55cdaf3 QHash/QMultiHash: fix operator==
The existing QHash::operator== does not work when the same
keys appear in different order between the two hashes being compared.
However, relying on iteration order on a QHash is (as usual) a bad
idea and one should never do it.

Task-number: QTBUG-60395
Change-Id: Ifb39a6779230e26bbd6fdba82ccc0247b9cdc6ed
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-05 12:18:25 +00:00
Marc Mutz
38134ff41e Enable c++17 in the QStringApiSymmetry test
Because it's the correct thing to do.

Change-Id: I1d9fb482ffed6f4c36b4bc25d05cabcd07d87a78
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-05 07:11:57 +00:00
Frederik Gladhorn
d517c386b2 Enable tst_qaccessibilitymac
The test was disabled because it was checking if we had the right
permissions. It does seem as if the permissions do not matter as
long as everything is in process though.
As seen by the regression in fafdb171e0
it's important to run the test. This regression would have been
caught.

Change-Id: Ia1938e683badd1de2657aa6dc8a3b3bbe430e8c8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-05-04 11:18:14 +00:00
Tor Arne Vestbø
58114b5ab0 tst_qscopedpointer: Actually test what test name says it should test
Change-Id: Idda6e34c4438d1695f8268426fe923ad51ff6d10
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-05-03 20:10:00 +00:00
Marc Mutz
2a86c565e8 tst_QStringApiSymmetry: add checks for trimmed()
All good (now).

Change-Id: I666773856a239826e646398a943e7df30bd81671
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-05-03 19:58:02 +00:00
Marc Mutz
96edd0e440 tst_qstringapisymmetry: also check potential rvalue overloads of transformations
For transformations, regardless of whether they're currently
overloaded on rvalue-this or not, check the results of calls to const
lvalues as well as mutable rvalues.

Use the new mixed-type QCOMPARE more.

Change-Id: Ibaa436cd88b40e5c0823c3bbe5b04a9964e7e987
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-03 19:57:52 +00:00
Gabriel de Dietrich
a30c746ea4 Introducing multiscreen-menus manual test
We have been noticing several menu popup sizing issues
in the presence of multiple, heterogenous displays.
Most remarkably, we'd often pick the primary display's
geometry when computing the menu's size hint. This results
in usability issues if the primary display is smaller than
the display onto which the menu popup is being displayed.

This manual test covers menu bar, context and push button
menus. Torn-off menus are also enabled. We turn off the use
of native menu bars to cover a few more cases.

Change-Id: I29658ebdc56e41aa1bf99d06d96aed6bfb5461b3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-03 08:35:49 +00:00
Palo Kisa
46aecbd72b QIconLoaderEngine: Fix actualSize() for no-entry
Return an empty size if no suitable entry found to avoid mismatch with
the returned pixmap()'s size (the QIconEngine::actualSize() returns the
originally requested size).

Change-Id: Ia278719a54392b62c5f9fc0529476baba5cd7df0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-05-03 06:56:07 +00:00
Alex Trotsenko
124b9a6ff8 Improve suppression of spurious socket notifications under Windows
There were still two cases where spurious notifications would be
possible:

    - user calls hasPendingDatagrams()/pendingDatagramSize() on UDP
      socket somewhere outside the slot connected to readyRead()
      signal (::WSARecvFrom posts FD_READ notification, even if
      a notification for incoming datagram already exists in the
      message queue);
    - a socket was registered to receive several types of event and
      WM_QT_ACTIVATENOTIFIERS message is located between the
      different events for this socket in the queue.

Provided patch ensures that the message queue is synchronized with
the Qt event processing mechanism and adds a way to detect spurious
notifications inside the window procedure.

Task-number: QTBUG-58214
Change-Id: I49609dace601f300de09875ff1653617efabd72f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Peter Seiderer <ps.report@gmx.net>
2017-05-03 06:46:18 +00:00
Alex Trotsenko
91c1b5490e QWindowsPipeReader: fix possible invalid invocation of ReadFileEx()
If the user calls QLocalSocket::setReadBufferSize() with a value less
than the current size of the pipe buffer, startAsyncRead() would call
ReadFileEx() with invalid parameters:

  ReadFileEx(handle, nullptr, some_big_value, ...);

Change-Id: I3d153e3ec34f8038dc001c1c896aeceb666a8979
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-05-02 05:21:29 +00:00
Olivier Goffart
9d918495ee Add a few std::move in functions accepting slots
This allows the use of move-only function objects

Task-number: QTBUG-60339
Change-Id: If3595fca338cf7f3039eb566cc02e4e73cd04c86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-29 08:24:24 +00:00
Olivier Goffart
a6c091c2d1 Support move-only function objects in QObject::connect
[ChangeLog][QtCore][QObject] Added connect() support for move-only
function objects.

Task-number: QTBUG-60339
Change-Id: Iae5e48432bb64517b0607b0c2ba23931957f432e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-29 08:24:18 +00:00
Friedemann Kleint
425986acf3 Windows: Fix tst_QFileDialog2::completionOnLevelAfterRoot()
Change the check for the unambiguous match to be case insensitive.

Task-number: QTBUG-60466
Change-Id: Iaa019cc803a56b015f45309fb1b3a7a8a3d82ee4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-29 07:39:09 +00:00
Marc Mutz
3644e722c2 QLatin1String: add startsWith()/endsWith()
[ChangeLog][QtCore][QLatin1String] Added startsWith(), endsWith().

Change-Id: I7f75a5a1f0409f4b9d3e41b73f4fb5d137572b09
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-28 16:41:42 +00:00
Marc Mutz
d21a147e2b QStringView: add startsWith(), endsWith()
Change-Id: I72aef9236daedc3013c62d3f1d737159f85572b8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-28 16:41:36 +00:00
Marc Mutz
5f3d6ce570 QString/Ref: add startsWith/endsWith(QStringView) overloads
[ChangeLog][QtCore][QString/QStringRef] Added startsWith(), endsWith()
overloads taking QStringView.

Change-Id: Ice6332492d19fd7477d5ac43ecbf6b70175b23ca
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-28 16:41:26 +00:00
Jesus Fernandez
99d809bd75 Add move special member functions to QSqlError
Also mark as shared-come-qt6 and add member-swap.

[ChangeLog][QtSql][QSqlError] Added swap().

Coverity-Id: 168223
Change-Id: Iaad4dee383900b9d11856e860b0647780a81a505
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-28 12:50:34 +00:00
Thiago Macieira
cf0c44fe83 Fix test build with ICC: QFlags does not auto cast to uint
I don't know why.

 tst_qflags.cpp(114): error: no instance of function template "verifyConstExpr" matches the argument list argument types are: (Qt::MouseButton)
 tst_qflags.cpp(91): note: this candidate was rejected because there is a type mismatch after argument substitution

Change-Id: I84e363d735b443cb9beefffd14b9581d77933cb8
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2017-04-28 12:37:09 +00:00
Allan Sandfeld Jensen
82c06fb0f5 Fix return of empty paths with multiple points on intersections
The intersection algorithm for intersection with rects, might return
one edge of the rect even if that edge does not intersect with the path.
To deal with that we collapse paths with empty bounding rects to the empty path.

Task-number: QTBUG-60024
Change-Id: I3e305983c66548e772d7d7ce3de99d715edbdd1b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-04-28 07:58:25 +00:00
Nikita Krupenko
7ef398e8fa QFileDevice/QFileInfo: Add fileTime() and setFileTime()
[ChangeLog][QtCore][QFileDevice] Added fileTime() and setFileTime().

[ChangeLog][QtCore][QFileInfo] Added fileTime().

Task-number: QTBUG-984
Change-Id: I84dfb05b9454a54e26b57b78edee5773dc4c5c3c
Initial-patch-by: Raphael Gozzo <raphael.rg91@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-27 18:44:15 +00:00
Marc Mutz
8d32204592 QStringRef: fix trimmed() returning null strings on empty input
The QString API symmetry test strikes again, showing that this is
inconsistent with both QString and QByteArray, which both return empty
for empty inputs.

The fix actually makes the implementation simpler.

Extend the QStringRef test to cover null inputs, too. I can't merge
the trimmed() test in the API symmetry test until everything is
actually consistent.

[ChangeLog][QtCore][QStringRef] trimmed() now returns an empty
string-ref for an empty input. Before, it would return a null one.

Change-Id: I6b35c5f498053c4e15a4a9dd465bc696258e7393
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2017-04-27 17:04:32 +00:00
J-P Nurmi
5dbd040d1c Fusion: desaturate the brown shades
The reference images in tst_qframe had to be updated to match the palette.

[ChangeLog][QtWidgets][QFusionStyle] The default palette used by the
platform agnostic Fusion style has been desaturated. Previously the window
background color, and other colors derived from it, were brown shades. Now
these colors are neutral gray that fit better on any desktop.

Change-Id: Id6a05e05563b8cbc8f378ee415a64b8f99012b60
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-04-27 16:03:15 +00:00
Timur Pocheptsov
b6968f508c Revert "Blacklist tst_QSslSocket::protocolServerSide on OS X 10.11"
This reverts commit 96c27f0dfa.
We now use a custom keychain that should fix the original
problem with the test.

Change-Id: I52e4105f34a46ad7080750d9a62480ebe3a56e68
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-27 12:25:51 +00:00
Marc Mutz
e63daaa2ac tst_qstringapisymmetry: merge truncate() test into left() test
Less code duplication, since truncate() is the action version of
left().

This is done in preparation of adding more actions for the string
transformations we have.

Change-Id: I55027b5143ad3349d46091ac1cc3d24a9707caee
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-27 04:35:21 +00:00
Gabriel de Dietrich
445191bba8 QMenu: Display the menu title on the torn-off menu's title bar
Change-Id: If16e262a6c8b39dff517cc105cf55686d4c22582
Task-number: QTBUG-11693
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-04-26 22:27:53 +00:00
Thiago Macieira
4ba740b3ba QHash: make it so a zero seed selects a constant algorithm
That's the only value for which we will guarantee a stable result across
Qt versions and across invocations of the same application on different
architectures is zero. For any other value, we reserve the right to
change the algorithm. We'll now print a warning when we detect that.

Task-number: QTBUG-47566
Change-Id: I27b55fdf514247549455fffd14b1135e10d24ab4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2017-04-26 15:22:44 +00:00
Timur Pocheptsov
5218a80bd1 Revert "tst_qsslsocket::protocolServeSide - fix for macOS 10.11"
The fix is outdated - the tests it was fixing - pass on 10.11.

Change-Id: I8b42c1d3d2f1279382b15c20587dcc93cf1b6b40
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-26 13:18:20 +00:00
Sami Nurmenniemi
e5a1c7fff7 Fix tst_QLineEdit for offscreen and minimal platforms
Unselecting with offscreen and minimal platforms behave similarly as in
Windows and QNX. If left or right key is used for unselecting, cursor
position is changed.

Change-Id: I022cd2fec80ad1875fec983e1e3536a105e18bb2
Reviewed-by: Teemu Holappa <teemu.holappa@qt.io>
2017-04-26 12:42:08 +00:00
Marc Mutz
309b4b877f tst_qstringviewapisysmmetry: add a check for startsWith()/endsWith()
All good.

Can't check QByteArray::startsWith(), as it is lacking the
Qt::CaseSensitivity parameter.

Change-Id: I7f2379e520617c14514fc66d8fb3413cfb7c9147
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-26 09:12:54 +00:00
Sami Nurmenniemi
a1e94bcfbb Fix tests that assume system files are owned by root for qemu
If QEMU is provided sysroot with QEMU_LD_PREFIX, it opens files from there. If their
owner is the current user, testing their access rights based on assumption that they
are root fails. Skip the tests in that case similarly as is already done when the
tests are run as root.

This fixes following tests:
- tst_QTemporaryDir::nonWritableCurrentDir
- tst_QNetworkReply::getErrors(file-permissions)
- tst_qstandardpaths::testCustomRuntimeDirectory

Task-number: QTBUG-59966
Change-Id: I972ce37b4b5a7747cdd732a8e4a737ef09cbc6a5
Reviewed-by: Teemu Holappa <teemu.holappa@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-26 09:12:12 +00:00
Sami Nurmenniemi
9b52cfd64c Fix tst_QWindow modal dialog tests for offscreen and minimal platforms
Changed testing of focus of modal dialogs to match behavior on offscreen
and minimal platforms.

Change-Id: Ife3ea41b4b78df2e64c8d8e740332914b1e5a67c
Reviewed-by: Teemu Holappa <teemu.holappa@qt.io>
2017-04-26 09:11:53 +00:00
Sami Nurmenniemi
ba21e42463 Fix tst_QWidget for platform "offscreen"
Some features are not implemented by "offscreen" platform. Skip tests
failing because of that. Some failing cases are also already skipped or
blacklisted on "xcb" platform.

Change-Id: I17269169379c270bd7d6f2ddda03ad9b114a71ce
Reviewed-by: Teemu Holappa <teemu.holappa@qt.io>
2017-04-26 09:11:41 +00:00
Marc Mutz
979f9f4d34 QLatin1String: fix qt_compare_strings(QLatin1String, QLatin1String) for null strings
qstrcmp sorts null strings before empty ones, while the Qt string
classes consider them equal.

The qt_compare_strings() overload for QLatin1String was using
qstrcmp(), but is supposed to implement the semantics that Qt string
classes use, so we need to add an extra check.

Was uncovered by tests for QLatin1String::startsWith(), but added a
new test for qCompareStrings() now, which is a bit more complicated
than desired, due to the lack of QUtf8String.

Change-Id: I0493c4491df928a68861a1bc7f0962f1c870a416
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-26 09:11:27 +00:00
Thiago Macieira
9e2c6899e0 QUrl: fix IDN conversion when the ACE form is invalid
We guarded against the Unicode form being invalid and did not produce an
encoded form. But we did not guard against proper Punycode sequences
that decode to forms that had not passed the proper Nameprep stage. So
check for that and, if it fails, just keep the label in the form we
found it in (it's valid STD3 anyway).

[ChangeLog][QtCore][QUrl] Fixed a bug that caused certain domain names
that look like Internationalized Domain Names to become corrupt in
decoded forms of QUrl, notably toString() and toDisplayString().

Task-number: QTBUG-60364
Change-Id: Iadfecb6f28984634979dfffd14b833142cca8d0d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-25 00:51:43 +00:00
Tony Sarajärvi
2d1a115f9f Blacklist tst_MacGui autotest in macOS 10.11
Task-number: QTBUG-60385
Change-Id: I6e692ff55d26b9070343d612e2f872091d5c343d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-04-24 22:09:12 +00:00
Marc Mutz
09f6227653 QtTest: add support for printing QStringViews
[ChangeLog][QtTest][QCOMPARE] Now supports printing QStringViews in
case of test failures.

Change-Id: I4dc2542cd1013fd63c094c249e721d7102387bde
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-24 19:35:11 +00:00
Thiago Macieira
21dd5d314a QUrl: fix IDN whitelist checking when the TLD is in Unicode
The whitelist is kept in ACE form, so if the TLD came in Unicode, we
need to run ToASCII before we can check the whitelist. This is slightly
inefficient because we'll run the same operation later in this domain.

Change-Id: Iadfecb6f28984634979dfffd14b831f37b0f4818
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org>
2017-04-24 19:29:57 +00:00
Marc Mutz
ff93eddfd5 tests/auto/gui: use new QTest::addRow() more
... for calculated test data names.

In tst_qimage.cpp, use QLatin1String instead of QString for image
format pretty-printing, to avoid needless memory allocation and, more
importantly in the context of this patch, to make the result usable
with addRow(), which does not support %ls.

Change-Id: Ib1953aee2da235ae912917a450491ac8be69ca3a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-04-24 19:22:53 +00:00
Michael Brasser
47fdb2c8e3 Add support for scoped enums to QMetaObjectBuilder
Change-Id: I7b3c3973ff4396a854014f5b2b671b71007e80da
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-04-24 19:19:44 +00:00
Giuseppe D'Angelo
597d4ff796 QThread: add static create function
In the spirit of std::thread, which takes a function to call and its
parameters, and runs it in a new thread. Since the user might want to
connect to signals, move QObjects into the new thread, etc., the new
thread is not immediately started.

Although technically all of this _should_ be implementable in pure
C++11, there is nothing in the Standard to help us not reinvent all the
plumbing: packing the decay'd parameters, storing them, invoking the
function over the parameters (honoring INVOKE/std::invoke semantics).
std::function does not do the job, as it's copiable and therefore does
not support move-only functors; std::bind does not have INVOKE
semantics.

I certainly do not want to reimplement all the required facilities
inside of Qt. Therefore, the full blown implementation requires C++17
(std::invoke).

In order to make this useful also in pre-C++17, there are two additional
implementations (C++11 and C++14) that support just a callable, without
any arguments passed to it. The C++11 implementation makes use of a
class to store and call the callable (even move-only ones); basically,
it's what a closure type for a C++14 lambda would look like.

An alternative implementation could've used some of the existing
facilities inside QObject::connect implementation that store a functor
(for the connect() overload connecting to free functions), namely:
the QtPrivate::QFunctorSlotObject class. However:

* QFunctorSlotObject does not support move-only callables (see
QTBUG-60339);
* QFunctorSlotObject itself is not a callable (apparently by design),
and requires to be wrapped in a lambda that calls call() on it;
* the moment QTBUG-60339 is solved, we'd need the same handwritten
closure to keep QFunctorSlotObject working with move-only callabes.

So: just use the handwritten one.

The C++14 implementation is a simplified version of the C++11 one,
actually using a generalized lambda capture (corresponding to the
handwritten C++11 closure type).

All three implementations use std::async (with a deferred launch policy,
a nice use case for it!) under the hood. It's certainly an overkill for
our use case, as we don't need the std::future, but at least std::async
does all the plumbing for us.

[ChangeLog][QtCore][QThread] Added the QThread::create function.

Change-Id: I339d0be6f689df7d56766839baebda0aa2f7e94c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-24 15:24:22 +00:00
Tony Sarajärvi
148188fef3 Rename macos blacklisting to osx
Change-Id: I7e370ad8e1e2cb87188e149c96681e4c18abaa4f
Reviewed-by: Liang Qi <liang.qi@qt.io>
2017-04-24 07:24:08 +00:00
Tony Sarajärvi
485b6c99db Blacklist tst_qsemaphore on macOS 10.12
Task-number: QTBUG-58745
Change-Id: I085a2ac60cc24c287140788a88512657238a2c4b
Reviewed-by: Liang Qi <liang.qi@qt.io>
2017-04-24 07:24:01 +00:00
Joerg Bornemann
b137734e6b Support setCreateProcessArgumentsModifier in QProcess:startDetached
Factor out both CreateProcess calls into one function that also calls
the modifier callback for the CreateProcessArguments struct.

Task-number: QTBUG-57687
Change-Id: I9d2ef4f2d7cd077aa4c3eba926ab4dfb9e570291
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-23 18:10:50 +00:00
Gatis Paeglis
41eefd7493 Deprecate QCoreApplication::flush()
... as it has outlived its original purpose:

Qt3 implementation on X11:
void QApplication::flush() { flushX(); }
void QApplication::flushX() { if (appDpy) XFlush( appDpy ); }

Qt4 implementation on X11:
Did nothing when QApplication::flush() was called (the flush()
overrides in {unix,glib} event dispatchers with empty bodies).

In Qt5 this function somehow has been repurposed (inconsistently)
to do what QCoreApplication::sendPostedEvents already does:

QAbstractEventDispatcher::flush() = 0;
 => QCocoaEventDispatcher::flush() {}
 => QEventDispatcherCoreFoundation::flush() {}
    => QIOSEventDispatcher (does not override ::flush())
 => QEventDispatcherGlib::flush() {}
    => QPAEventDispatcherGlib (does not override ::flush())
 => QEventDispatcherUNIX::flush() {}
    => QUnixEventDispatcherQPA (when QT_NO_GLIB=true)
       ::flush() { if (qApp) qApp->sendPostedEvents(); })
       ==> QAndroidEventDispatcher (does not override ::flush())
 => QEventDispatcherWin32::flush() {}
    => QOffscreenEventDispatcher::flush() {
         if (qApp) qApp->sendPostedEvents();
         QEventDispatcherWin32::flush();
       }
    => QWindowsGuiEventDispatcher (does not override ::flush())
       => QWindowsDirect2DEventDispatcher (does not override ::flush())
 => QEventDispatcherWinRT::flush() {}
    => QOffscreenEventDispatcher::flush() {
         if (qApp) qApp->sendPostedEvents();
         QEventDispatcherWinRT::flush();
       }
    => QWinRTEventDispatcher (qminimaleglintegration.cpp) (does not override ::flush())
    => QWinRTEventDispatcher (qwinrteventdispatcher.h) (does not override ::flush())

Whatever this function was doing on macOS in Qt3 and Qt4 also has been
dropped in Qt5. It appears that the other event dispatchers in Qt5 that
have overrides for flush() have simply copy-pasted this logic.

Clearly the documentation of QCoreApplication::flush() is outdated and
has nothing to do with the actual implementation in Qt5.

This function is rarely used in Qt5 sources. It should be safe to remove
the calls to QCoreApplication::flush() from Qt source code, as this
function has been doing nothing on most platforms anyways. Repurposing
it even broke handling of posted events (see QTBUG-48717).

[ChangeLog][QtCore][Event loop] QCoreApplication::flush() is now
deprecated. Use QCoreApplication::processEvents() and
QCoreApplication::sendPostedEvents() instead.

Task-number: QTBUG-33489
Task-number: QTBUG-48717
Change-Id: Icc7347ff203024b7153ea74be6bf527dd07ce821
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
2017-04-22 15:18:01 +00:00
Olivier Goffart
d4cdc45426 Fix QMetaMethod::invoke and automatic type registration
This was simply not working for two reasons:
 - The index passed to QMetaObject::metacall was not right (there was an offset
   because of the return type)
 - If the registration succeeded, the arguments were not even initialized.

The tests in tst_moc always called QMetaMethod::parameterType before calling invoke,
which was properly registering the type. So this was not seen in the tests before.

[ChangeLog][QtCore][QMetaMethod] Fixed crash in invoke() with QueuedConnection and
types whose metatype gets automatically registered.

Task-number: QTBUG-60185
Change-Id: I4247628484214fba0a8acc1813ed8f112f59c888
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-22 11:25:49 +00:00
Marc Mutz
dfc2a4a537 QLoggingRegistry: remove rules vector
It only contained a concatenation of the individual rule sets,
probably to fix their order in a central place, as well as
simplifying iteration in defaultCategoryFilter().

Fix these two issues differently, but introducing a RuleSet
enum that lists rule sets in the order in which they should
be applied by defaultCategoryFilter(), and turn individual
rule sets vectors into a C array of vectors.

This enables two nested loops in defaultCategoryFilter to
replace the one loop over 'rules'. Apart from building up
'rules' in updateRules(), this was the only access to that
member. That leaves updateRules() with just the task of
running defaultCategoryFilter() on the new rule sets.
Consequently, a call to updateRules() can now replace the
identical loop in installFilter().

Performance should not suffer. Iterating over a fixed-size
array of vectors is hardly any slower than iterating over
a single vector, and while the construction of 'rules'
was probably a one-off task in most programs, this way
of keeping the rules also saves memory because rules are
not kept in two different vectors.

It is also more maintainable, of course.

Change-Id: Ibc132d096c8137dd02b034752646212e51208637
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-04-21 07:16:33 +00:00
Joni Poikelin
ecf440d89d Fix CSS line-height property multiplier value handling
CSS style such as "line-height: 1.5;" should be used as a multiplier,
but Qt uses it as percentage which makes line spacing way too small. To
workaround this, convert it to percent and use as
QTextBlockFormat::ProportionalHeight instead.

[ChangeLog][QtGui][Important Behvior Changes] Changed CSS line-height
property with multiplier to follow CSS spec

Task-number: QTBUG-56848
Task-number: QTCREATORBUG-17683
Change-Id: Icc98f7c0d4d07542a220702c287f23fa450ef875
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-04-21 07:10:51 +00:00
Marc Mutz
5311eb0d8e Use new Q_STDLIB_UNICODE_STRINGS and Q_COMPILER_UNICODE_STRINGS
... instead of the combination with Q_OS_WIN we used so far.

This patch adapts ocurrences that are new in 5.10.

Change-Id: If392df481713e56c776c2326e0e02324a3a80c89
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-20 18:10:59 +00:00
Marc Mutz
7d4bf142d7 QUuid: add fromString(QStringView/QLatin1String)
As for the formatting code, de-duplicate the parsing code by only
parsing char*s, converting QChars to Latin-1 first in a small buffer.

The QUuid(const char*) ctor performed no length checking, relying
instead on the checks performed within _q_uuidFromHex(), which
includes an implicit check for premature end (because NUL is not
a valid token for the parser).

The (QString) and (QByteArray) ctors did perform length checking.
To the extent possible, this is removed, since it is handled by
_q_uuidFromHex(). Failure cases need not be optimized. Only the
QLatin1String overload needs to do some checking, because views in
general are not NUL-terminated. The QStringView overload can just
append a NUL when it converts to Latin-1.

The only check I added to _q_uuidFromHex() is that for src ==
nullptr. It would otherwise be duplicated in several callers.

While touching the internal functions, port to passing and returning
by value.

Saves 1.6KiB in text size on optimized GCC 6.1 Linux AMD64 builds,
even though we added new API.

Port some users to the new functions. Expand fromString() test.

[ChangeLog][QtCore][QUuid] Added fromString(QStringView/QLatin1String).

Change-Id: I519339419129550c86e0ea80514865cd6a768f5d
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-20 17:02:44 +00:00
Giuseppe D'Angelo
af211b3993 QVariant: fix the test
8a375341cf added swap() to QJson* classes
and marked them shared-not-movable-until-qt6.

That unveiled a broken test in QVariant which was relying on QJsonDocument
being not relocatable. So fix the test by using a proper datatype for the task.

Change-Id: Ic35f09f936b00dfaeb368ccb42aecf35cc506029
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-04-20 15:33:49 +00:00
Tor Arne Vestbø
eec388865f Skip tst_QMdiArea::setViewport on macOS due to flakey failures in CI
Task-number: QTBUG-58520
Change-Id: I582c190de45e85e2dfb397289720c655ec8d781c
Reviewed-by: Liang Qi <liang.qi@qt.io>
2017-04-20 14:45:24 +00:00
Sami Nurmenniemi
718216ee0b Fix tst_QTcpServer for QEMU
QEMU does not support all syscalls needed for tcp socket testing.
Skipped tests that can't pass on QEMU.

Task-number: QTBUG-59966
Change-Id: Ib6d12d0fc4c913a0222e13db57f0864b7fdf21ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-20 11:46:14 +00:00
Liang Qi
7950b6b283 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/corelib/tools/qbytearray.h
	src/corelib/tools/qdatetime.h
	src/corelib/tools/qstring.h
	src/corelib/tools/qversionnumber.h
	src/plugins/platforms/android/qandroidplatformintegration.cpp
	tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp

Change-Id: Iefd92a435e687a76cd593099e40d9a9620a1454d
2017-04-20 12:31:27 +02:00
Giuseppe D'Angelo
0794d61c82 QMetaType: fix the test
8a375341cf added swap() to QJson* classes
and marked them shared-not-movable-until-qt6.

This change made QMetaType start reporting that QJson* classes were
movable; however, the test used QTypeInfo and not QTypeInfoQuery to
double check that information.

Port the test to QTypeInfoQuery.

Change-Id: I3227a70a8f24c0013257e180e9cb9cfebe9947f9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-20 07:19:57 +00:00
Marc Mutz
126c4eae84 Split Q_COMPILER_UNICODE_STRINGS: add Q_STDLIB_UNICODE_STRINGS
Since commit bf2160e72c, we can rely on
charNN_t support in all compilers except MSVC 2013, and since that
commit, we use (in 5.10, not 5.9, yet)

  !defined(Q_OS_WIN) || defined(Q_COMPILER_UNICODE_STRINGS)

when we only need charNN_t, the type, as opposed to its library
support (u16string, char_traits<char16_t>, ...).

This patch splits the Q_C_UNICODE_STRINGS macro into two, adding
Q_STDLIB_UNICODE_STRINGS for when we need std::uNNstring, leaving
Q_C_UNICODE_STRINGS for when we need just charNN_t support.

In QDebug, when constructing a QChar out of a char16_t, cast to ushort
first, since QChar(char16_t) was only officially introduced in Qt 5.10.

[ChangeLog][Potentially Source-Incompatible Changes] The internal
Q_COMPILER_UNICODE_STRINGS macro is now defined if the compiler
supports charNN_t, even if the standard library does not. To check for
availability of std::uNNstring, use the new Q_STDLIB_UNICODE_STRINGS
macro.

Change-Id: I8f210fd7f1799fe21faf54506475a759b1f76a59
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-20 06:50:36 +00:00
Tor Arne Vestbø
924b02aecb Revert "Initialize QLoggingRegistry rules on first use, not qApp construction"
This reverts commit 47cc9e23a3.

We use QCoreApplication::applicationDirPath in the logging initialization to find
a possible qtlogging.ini file. Because QCoreApplication::applicationDirPath requires
a QCoreApplication instance this leads to a qWarning, which in turn leads to a
recursive call to the logging initialization, and in turn to a recursive mutex deadlock.

Task-number: QTCREATORBUG-18031
Change-Id: Ic75e1e8c062eb647991725378489bf87c9648cca
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-04-19 22:59:43 +00:00
Elvis Angelaccio
8043202114 QLineEdit: fix broken test
Commit 288bfb0bbd added a test that uses QLineEditIconButton, which
requires QT_BUILD_INTERNAL to be defined in order for the findChild()
call to work as expected.

Change-Id: Ieda18f4e26a91322e8a83c14f8d1fbbe4313ecf0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-04-19 22:59:41 +00:00
Allan Sandfeld Jensen
ee3ac3a3bf Fix PNGs saved from QImage transform of 8-bit images
Fixes two separate errors. QImage::transform was incorrectly adding
colors to the color-table of the returned image when the converted image
would not be indexed, and qpnghandler was looking at non-empty color-
table instead of color format.

Task-number: QTBUG-43708
Change-Id: Ife14b6428ca65ac7d3a0b36a89a73e56d64586b4
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-04-19 10:08:41 +00:00
Elvis Angelaccio
288bfb0bbd QLineEdit: Make the clear button always the leftmost button
QLineEditIconButton currently draws a fully transparent pixmap in its
paintEvent() function, when the line edit is empty. This does not work
when there is another trailing QAction that is visible even when the
line edit has no text, as reported in QTBUG-59957.

To fix this issue, make sure the clear button is always the leftmost
button.

Task-number: QTBUG-59957
Change-Id: I8a4f96aae07856aa0e1053ebb338ba9bdf052a16
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-04-19 08:49:49 +00:00
Tor Arne Vestbø
47cc9e23a3 Initialize QLoggingRegistry rules on first use, not qApp construction
Allows categorized logging before QCoreApplication has been created,
which otherwise would silently fail to output anything because the
category would never be enabled, despite QT_LOGGING_RULES being set.

Change-Id: Ia733105c5b6f28e22af511ced5271e45782da12b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-18 21:09:43 +00:00
Friedemann Kleint
9595622e36 QGraphicsBlurEffect: Fix for high DPI scaling
Preserve the device pixel ratio in the various helper functions
and when drawing.

Task-number: QTBUG-60026
Change-Id: Ieac9360b00044b6aedd0d3e1ad6e3b16d436f20f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-04-18 20:27:36 +00:00
Marc Mutz
a21a9efacb QLatin1String: add chopped(), chop(), and truncate()
[ChangeLog][QtCore][QLatin1String] Added chopped(), chop(),
truncate().

Change-Id: I69b31aae560e94a120d7e8a36e06ea957ccd2003
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-18 09:43:32 +00:00
Marc Mutz
fc8cc2573c QStringView: add chopped(), chop(), and truncate()
Change-Id: I33925f5b2b3e0904f47f18f3cbab480d7f844734
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-18 09:43:26 +00:00
Marc Mutz
d176808eef QByteArray, QString, QStringRef: Add chopped()
We have two functions to get a substring without doing some
calculations involving size():

- mid(p):    mid(p, size() - p)
- right(n) : mid(size() - n, n)

(left does not involve size(), so isn't in that set). What was missing
was a name for

- f(n): mid(0, size() - n)

As an action, it's called chop(), so call the transformation version
chopped().

I made chopped(n), n < 0 or n > size(), undefined, because QString(Ref)
::left() is broken[1], while the QByteArray implementation is not. This
is the only way to get consistent behavior among the three classes.

I's also the correct thing to do.

[1] instead of returning the empty string for negative indexes, it
returns the whole string.

[ChangeLog][QtCore][QString/QStringRef/QByteArray] Added chopped(n), a
const version of chop(n).

Change-Id: I6c2c5b16e0060fa924ced5860f21f2d0f23bd023
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2017-04-18 09:43:18 +00:00
Liang Qi
18934bcb0c Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
	src/corelib/global/qglobal.cpp

Change-Id: I375fa4afa662fa411a15f212ebd5f2f0dffdba7f
2017-04-18 10:46:22 +02:00
Marco Martin
7fffc04335 Reset d->mouseDown only if it's the menu being hidden
If the mouse cursor is over a menu entry with a submenu, and the
submenu is open, quickly moving the mouse to a near menu entry and
clicking it sometimes results in the click being eaten: this happens
when the mouse is pressed before the submenu disappears and released
after it disappeared: the submenu resets d->mouseDown that is a static,
causing the mouse release event on the action we want to have no effect.
Set d->mouseDown to 0 only when the window is hiding is the actual
window that contains the mouseDown, otherwise is still valid.

Change-Id: I2c981b9432728e9e7518c30a146c9595199f8afe
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-04-18 08:18:57 +00:00
Ihor Dutchak
d1210281e4 Fix undefined behavior in QSharedPointer::create()
Initialize a deleter for a new object, created by
QSharedPointer::create(), only after the object is actually
constructed.

[ChangeLog][QtCore][QSharedPointer] Fixed undefined behavior when
creating an object with QSharedPointer::create() and its conscructor
throws an exception.

Task-number: QTBUG-49824
Change-Id: I07f77a78ff468d9b45b8ef133278e8cdd96a0647
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-04-17 09:56:15 +00:00
Jake Petroules
4f3249f32d Pluginize the platform styles
This enforces decoupling and in the case of QMacStyle, isolates
QtWidgets and therefore end user applications, from Carbon/HITheme.

Windows and Fusion are platform independent, so they remain built-in
(but mostly because the Windows style is tightly coupled to other styles
like QStylesheetStyle).

Task-number: QTBUG-59428
Change-Id: Id6519fe0c5269c1bce5b5921f9db06257032a1c9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-04-14 17:07:54 +00:00
Dongmei Wang
ae6ef2e3ec QMenu: Fix torn-off menu display crash issue
When tearing off either a non-scrollable multi-colume menu
or a scrollable menu, displaying the torn-off menu crashes.
The root cause is when the torn-off menu is created, the
tear-off menu's style, margins and other attributes are not
set to it. The patch is to ensure the torn-off menu has
the same attributes as the tear-off menu does and set the
torn-off menu with a correct menu size.

Task-number: QTBUG-24815
Change-Id: Icea45f149ea8792671af4a62e62cad6ee01a1f95
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-04-14 17:06:12 +00:00
Dongmei Wang
eea585ad0b QMenu: Fix margins related display issues
Currently the contents margins and the menu paddings are not considered
for calculating the menu size, the positions and the size of tear-off
bar, scrollers and the positions of the menu items when scrolling the
menu, which results in the following problems when valid contents
margins and/or menu paddings are set:

- The tear off area is displayed in a wrong position. The mouse events
are not handled correctly in the tear off area. For example, when you
click in the tear off area, the menu should be torn off but nothing
happens
- For a multi-column menu, the menu width is not calculated correctly
- For a scrollable menu,
  - the menu width is not calculated correctly
  - the menu items are not displayed in correct positions
  - the scrollers are not displayed in correct positions
  - menu items are displayed on the area of borders and margins when
    scrolling the menu
  - the last menu item is not displayed above the bottom of the content
    area when scrolling the menu to the end.

The changes are to fix the problems above.

Change-Id: I7931e1088dff0029f2d4825e2aa34b4e32fdccd9
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-04-14 17:06:00 +00:00
Marc Mutz
e1c8451ffe QVariant: implement QByteArray ↔ QUuid conversion
Seems like an obvious omission.

[ChangeLog][QtCore][QVariant] Can now convert QUuid to and from
QByteArray, not just QString.

Change-Id: Ib56ae86ca0c27adaf1e095b6b85e64fe64ea8d18
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-14 12:54:21 +00:00
Marc Mutz
5662234afa QMatrix4x4: fix aliasing problem in operator*=
When multiplying a QMatrix4x4 by itself, we were clobbering the very
matrix we read from. Employ read-caching to avoid this aliasing problem.

[ChangeLog][QtGui][QMatrix4x4] operator*=() now calculates the correct
result even if the RHS and LHS are the same object.

Change-Id: I8534d56cfdd62c336577125127f05173fcec2873
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-04-14 12:29:35 +00:00
Jake Petroules
401d9b5278 Remove the Windows XP style from public accessibility
Later, the Windows XP style will be removed entirely by means of
being merged with the Windows Vista style (which inherits from the
XP style).

There was actually no reason for these styles being separate
classes in the first place, because both result in the same
appearance for controls on the running version of Windows.
Therefore, the windowsxp style merely appears as a "broken"
version of the windowsvista style, with only minor differences
based on the additional metrics that the vista style provides.
The windowsxp style does NOT, and never did, allow users to get
a Windows XP style appearance on Windows 7 and above (which is
currently Qt's minimum supported platform). Therefore, now that
Qt no longer supports Windows XP, the windowsxp style is unusable.

[ChangeLog][QtWidgets] The windowsxp style is no longer available
as a separate style, because it did not (and cannot) actually
provide an XP-style appearance on currently supported Qt platforms.

Change-Id: I513d9bce3f247f97cfb28dfee88fe888469e0a6f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-04-13 21:39:09 +00:00
Liang Qi
94c576cf66 Merge remote-tracking branch 'origin/5.8' into 5.9
Change-Id: I3bd83a839b16822035ed56a5cffe77bd6bc3f08d
2017-04-12 20:08:56 +02:00
Simon Hausmann
2ad7f6ddf5 Preserve last modification timestamps of installed files
On non-windows platforms, we use the "-p" parameter of install(1) to
preserve the last modification timestamps of files. On Windows the use
of copy does not preserve them. As a cross-platform solution, this patch
introduces a simple built-in install command in qmake to copy files.

Task-number: QTBUG-59004
Change-Id: I3064d29a2b8c7b009a1efbf8f00b84c079ea5417
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-04-12 15:50:51 +00:00
Marc Mutz
58a4f41af2 QDate/Time: add toString(QStringView) overloads
[ChangeLog][QtCore][QDate/QTime/QDateTime] Added toString() overloads
taking the format as a QStringView.

Change-Id: I322fa22e6b13fe8ba4badf0a3133425bd067ef32
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-12 11:12:09 +00:00
Marc Mutz
d68c162c1b QLocale: add toString(Q(Date|QTime)+, QStringView format) overloads
While at it, change the interface of qt_repeatCount() to just take
a single QStringView, since QStringView::mid() is so cheap. Add some
\internal docs.

[ChangeLog][QtCore][QLocale] Added toString(QDate/QTime/QDateTime)
overloads taking the format string as a QStringView.

Change-Id: Ic078796677a6db06227c8a3e276dbdb1039ceead
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-12 11:12:04 +00:00
Sami Nurmenniemi
6e649f9714 Skip testing of QOpenGlConfig on platforms that don't support it
Task-number: QTBUG-59966
Change-Id: If74657d0a0133c67f57bf92ae96d2d868d523f0e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-12 08:36:39 +00:00
Sami Nurmenniemi
a890337433 Fix tst_toolsupport on 32-bit arm platform
On 32-bit arm platform, qint64 gets aligned differently than on 32-bit
x86. First difference between the platforms on QFilePrivate member
offset happens in QFileDevicePrivate::cachedSize:
- On 32-bit x86 it's offset is 148 (4-aligned)
- On 32-bit arm it's offset is 152 (8-aligned) and offsets of all the
  remaining members are +4 compared to x86
- On 64-bit architectures the offsets are the same

Change-Id: If110da27ea08504e78b167c0a21599420eaa9630
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-12 08:36:27 +00:00
Thiago Macieira
cdc5f47aeb Restore compatibility with Qt 5.7.0 and 5.6.1
QSysInfo::productType() returned "osx" for all versions of macOS, even
10.12. Change 3e2bde3578 was incorrect.

[ChangeLog][Important Behavior Changes] QSysInfo::productType() and
QFileSelector behavior on macOS was restored to match what Qt used to
return in version 5.7.0 and earlier. The behavior found in Qt 5.6.2,
5.7.1 and 5.8.0 is removed.

[ChangeLog][Future Compatibility Notice] The identifiers that
QSysInfo::productType() and QFileSelector will use to identify macOS
systems will change in Qt 6.0 to match the Apple naming guidelines which
will be current then.

Task-number: QTBUG-59849
Change-Id: Ib0e40a7a3ebc44329f23fffd14b2b39392210c4f
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-04-12 05:14:19 +00:00
Thiago Macieira
e7493c8b54 tst_qhashfunctions: Test non-zero seeds too
Change-Id: Ib0e40a7a3ebc44329f23fffd14b2e927021a1a2e
Reviewed-by: David Faure <david.faure@kdab.com>
2017-04-11 06:38:14 +00:00
David Faure
c0ecfc08e3 QTextDocument: improve import of DIV tags
<div>1<br/></div>2 was inserting two newlines between 1 and 2, while all
tested web browsers only insert one newline - as long as there is nothing
between the <br/> and the </div>.

This was the cause for extra newlines being inserted in KMail when
replying to HTML emails, such as those generated by gmail.

Change-Id: I5145d977701e68913264357bba22780e7cdd3f7d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-10 09:44:01 +00:00
Filipe Azevedo
07bd5a90a3 Fix hidpi support for opengl window grabbing
Now set the QImage devicePixelRatio so the content is correct on all
screens.

Task-number: QTBUG-53795
Change-Id: Ic92eee98f691ebb1e0212498c1ae13ede74bca93
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-04-09 13:42:34 +00:00
Marc Mutz
de3785b8bc QVersionNumber: add fromString(QStringView/QLatin1String) overloads
The parsing code anyway operated on a QByteArray created from
toLatin1(), so expose this to the user by providing a QLatin1String
overload.

Also provide a QStringView overload, since we can. Port one user (in
qmake) to the new overload.

[ChangeLog][QtCore][QVersionNumber] Added QStringView and
QLatin1String overloads of fromString().

Change-Id: Idbff44c3997f5cfa86ea1bce8b3da4b700a3d9cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-08 05:40:52 +00:00
Thiago Macieira
23d08ce2ed Fix QDir::mkpath() when the path contains "symlink/../"
It is incorrect to collapse a "symlink/.." segment because the parent
directory of the symlink's target may not be the directory where the
symlink itself is located.

[ChangeLog][QtCore][QDir] Fixed a bug that caused QDir::mkpath() to
create the wrong directory if the requested path contained a symbolic
link and "../".

Change-Id: Iaddbecfbba5441c8b2e4fffd14a3e367730a1e24
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2017-04-07 20:26:02 +00:00
Thiago Macieira
795a54ff96 QDataStream: add operator<< and >> for std::nullptr_t
std::nullptr_t is nullary: it accepts only one value, nullptr. So we
don't need to read or write anything. This commit simply adds the two
operators that allow generic code to operate on std::nullptr_t if
required.

This commit also adds the actual use to QMetaType::load/save, even
though there's no change in behavior.

[ChangeLog][QtCore][QDataStream] Added operator<< and operator>>
overloads that take std::nullptr_t, to facilitate generic code.

Change-Id: Iae839f6a131a4f0784bffffd14aa37e7f62d2740
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-07 17:41:06 +00:00
Marc Mutz
399ab058c9 Add front()/back() to QString, QStringRef, QByteArray and QLatin1String
These STL-compatibility functions are present on our generic
containers, but not on the string classes.

[ChangeLog][QtCore][QString/QStringRef/QByteArray/QLatin1String] Added
front() and back() for STL compatibility.

Change-Id: I536019396b319abd1e2daf9c64ebab4e7a35b334
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-07 08:32:32 +00:00
Marc Mutz
5dc1e08c8c Add qConvertTo{Utf8,Latin1,Local8Bit,Ucs4}() and corresponding QStringView methods
Like the qt_compare_strings()/qCompareStrings() split, distinguish
between the internal and exported functions.

Because of the circular dependency between qstring.h and qvector.h,
the inline toUcs4() function has to be in qvector.h.

At some point, we need to refactor the headers so qvector.h is lower
in the dependency chain than qstring.h. It's not the first time this
bites.

Change-Id: Ief9f3bd92c83cdd1f31c51c700f42e146916eefd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-07 08:54:16 +00:00
Liang Qi
191a210478 Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev 2017-04-07 09:38:34 +00:00
Marc Mutz
dea78262e5 tst_QStringApiSymmetry: Add tests for truncate() and chop()
All good.

Change-Id: Id791a04fd5e2c9bc7f54660eaaa95d6db61a5674
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-07 08:34:49 +00:00
Marc Mutz
95263dbf7a Add a test for container API symmetry
Akin to the successful tst_QStringApiSymmetry, add such a test for
generic containers, too. Yes, we have tst_collections, but it's a
cut'n'paste mess that makes it hard to systematically perform
cross-class checks for consistency. This new test, still in its
infancy, uses templates and thus ensures that exactly the same checks
are run on all containers.

Starting out with front()/back(), which the string classes were found
to lack, we will build this test up, as we did and continue to do with
the string API one.

Change-Id: I07323340b5612ecc658232b2776d788018010d0d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-07 08:32:24 +00:00
Marc Mutz
5e93361888 Add a test for consistency of hash values between QString{,Ref,View}
Change-Id: I64a169fd6c8e2444bfe67e3ecd5375ea7b6a81ee
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-07 08:30:17 +00:00
Liang Qi
5d6073be27 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	mkspecs/linux-icc/qmake.conf
	mkspecs/macx-icc/qmake.conf
	mkspecs/win32-icc/qmake.conf
	src/gui/painting/qgrayraster.c

Change-Id: Ib08c45ea3215be05f986ecb3e1f4b37d209aa775
2017-04-07 10:24:33 +02:00
Sami Nurmenniemi
ac76b2424d tst_qmessagehandler: fix qMessagePattern for arm
Backtrace logging tests were not passing for arm. Added compile option
-funwind-tables to support backtrace on arm.

Task-number: QTBUG-59966
Change-Id: I5e2443b1e3a644a239dab68db990e75ae8fade24
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-07 08:12:14 +00:00
Sami Nurmenniemi
c7e7a785c6 tst_QFocusEvent: Fix checkReason_ActivateWindow for offscreen and minimal platforms
Widgets in platforms offscreen and minimal don't get focus back
automatically after hiding focused window. Extra activateWindow
is needed.

Task-number: QTBUG-59966
Change-Id: Iaf3d4e60483c4b2600472af199f7a7cd51b3fa6e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-04-07 08:11:54 +00:00
Sami Nurmenniemi
bbb67ca32c Fix tst_Collections for gcc/arm
- Alignment test was not compiling or passing on GCC / arm
- Using C++11 alignas() enforces maximum limit for the alignment, which
  at least on GCC / arm is __BIGGEST_ALIGNMENT__ multiplied by 8
- On GCC 6.2.0 / x86_84, maximum alignment accepted by alignas is 128
- On GCC 5.3.0 / arm, maximum alignment accepted by alignas is 64
- This change calculates biggest tested alignment on ARM targets
  and compilers supporting alignas() to the value calculated
  from __BIGGEST_ALIGNMENT__

Task-number: QTBUG-55492
Change-Id: If2b70000ff9cdc5ae8c5a00e39f79efcc6ba1221
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-07 05:54:04 +00:00
Sami Nurmenniemi
5c6d132408 Fix tst_QDirModel for qemu
QTBUG-43818 does not affect only Android, it can be reproduced also
with qemu.

Change-Id: I6364c09b3c7f860b34899e26056ad562b7c338f2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-07 05:53:47 +00:00
Marc Mutz
f672bd6316 Extend the check for null and empty QString hashing to QString{Ref,View}
Change-Id: I5c41287991f6dd2eeb3d54699da0f653bfac59be
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-06 22:19:41 +00:00
Samuel Gaist
c608ffc56a Improve pair-like class handling in tests
Currently when doing comparison with pair-like classes the fallback
toString method is called which returns a Q_NULLPTR thus not allowing
proper diagnostic of the values that triggered an error. This patch
adds support for QPair and std::pair to improve the tests output
readability.

[ChangeLog][QtTest][QCOMPARE] Now outputs contents of QPair and
std::pair on failure.

Change-Id: Ib0b4aad7640590d56275b6f1306fb9fb39fa81bc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-06 21:46:32 +00:00
Liang Qi
c50f6a8329 Merge "Merge remote-tracking branch 'origin/5.8' into 5.9" into refs/staging/5.9 2017-04-06 14:35:54 +00:00
Sami Nurmenniemi
60f6e4428f Fix tst_QFile for qemu
Qemu does not report /proc/self/maps size correctly. Added expected
failure for it

Change-Id: I4019884702b8f9a33717b02e79c9e0c042b2449f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-06 12:19:55 +00:00
Sami Nurmenniemi
42b3ed763f Fix network tests on qemu/arm
Function if_indextoname fails on qemu because SIOCGIFNAME is not
supported. Expect failure if emulation is detected.

Change-Id: I53b41286d82458661e7fa723af385f323582ce7e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-06 12:19:46 +00:00
Liang Qi
0fc569184c Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
	src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
	src/platformsupport/fontdatabases/freetype/qfreetypefontdatabase.cpp
	src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
	src/widgets/widgets/qtabbar.cpp

Change-Id: Iaa9daee5f7a6490d56257a3824730a35751ceb05
2017-04-06 14:16:31 +02:00
Marc Mutz
e1e6506c8d QString: add QStringView/QLatin1String overload of (non-multi) arg()
Use the new overload directly in QXmlStream*.

Saves 129B in QtCore text size on optimized GCC 6.1 Linux AMD64
builds, even though we added two more functions.

[ChangeLog][QtCore][QString] Added arg(QStringView),
arg(QLatin1String) overloads.

Change-Id: Idf7236dcab763824593f34182e4e0b16b5ed4321
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-06 12:06:18 +00:00
Marc Mutz
c928d08267 QTextCodec: add QStringView overloads
[ChangeLog][QtCore][QTextCodec] Added fromUnicode()
and canEncode() overloads taking QStringView.
[ChangeLog][QtCore][QTextEncoder] Added fromUnicode()
overload taking QStringView.

Change-Id: I2599f25570480d967921ccd4414e092bfc90d821
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-06 12:05:33 +00:00
Marc Mutz
be49235266 QStringView: use qssize_t as size_type
Nothing changes, we've just given 'QIntegerForSizeof<size_t>::Signed'
a better name in qglobal.h and now use it in QStringView API and
users.

Change-Id: Ibea1ae26e95b3a96708400fd4b0cd120459d57b6
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-04-06 02:38:25 +00:00
Allan Sandfeld Jensen
efb84b6189 Copy stretch to multifont fontDef
If we do not the fontDef of the multifont will be the default 0.

Task-number: QTBUG-59443
Change-Id: Ib223517975b2a57b2371e309d12cd8f918d30825
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-04-05 11:27:15 +00:00
Tony Sarajärvi
63ef26d583 Extend blacklisting of a tst_QMenuBar's test to cover Ubuntu 16.04
tst_QMenuBar::taskQTBUG4965_escapeEaten() already failed on
Ubuntu 14.04 and reproduces in 16.04.

Task-number: QTBUG-24326
Change-Id: I46170c9ce397f4042b308ca485b19364e6ee0663
Reviewed-by: Liang Qi <liang.qi@qt.io>
2017-04-05 10:31:00 +00:00
Liang Qi
aeb3f9d168 Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev 2017-04-04 16:15:55 +00:00
Liang Qi
9419dfe8ee Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
	src/plugins/platforms/xcb/qxcbwindow.cpp

Change-Id: Ic747c3c50e68c005b425e7a1ec2a90965527c8bd
2017-04-04 18:09:33 +02:00
Giuseppe D'Angelo
5eb74ad4f5 QRegularExpressionMatch: add QStringView-related functions
Change-Id: Ia81ba131cc2c7f56acb3312fbc7d62ffe5e18da4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-04 15:35:22 +00:00
Sami Nurmenniemi
cd8d2c1743 Skip testing of QOpenGLWidget on platforms that don't support it
QOpenGLWidget is not supported on all platforms. Skip tests on those.

Change-Id: I0f9500553427903f20d248acaa20803276e3ab00
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-04 14:13:03 +00:00
Marc Mutz
8b5aa7b6c4 QStringView: add an array ctor
With sufficient enable_if magic, the array ctor can overload the
pointer ctor and statically determine the size of the array passed.
Consequently, remove the sizeof in QStringViewLiteral again.

Change-Id: I486baa3cafefde60ccc5f2b47eb94ee53cefe63c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-04 11:33:08 +00:00
Sami Nurmenniemi
6d6a826038 Skip OpenGL tests on platforms that don't support OpenGL
Change-Id: Iff38950a940d602fbfcc35595624e56399aab53a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-04 11:06:38 +00:00