Commit Graph

24520 Commits

Author SHA1 Message Date
Marc Mutz
6d44fa53e1 QItemSelection: fix a quadratic loop
QList::erase(it) is a linear operation. Calling it in a loop
constitutes quadratic behavior.

Fix by using the erase-remove idiom.

Write a generic function object QtFunctionObjects::IsNotValid, instead
of a lambda, because I am building up a collection of such function
objects in my tree, to be submitted any time now™, so this will reduce
the churn once that gets merged. Wrap it in the unnamed namespace to
avoid ODR violations in case this pattern repeats.

Replace an existing erase-remove idiom's isNotValid lambda function
with the new function object.

Change-Id: I4f0af04e7b201eb168e79beeda332eee3c6f33c3
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-22 18:16:38 +00:00
Edward Welbourne
fe8e0da33e QDateTimeParser: pass down an actual current value where expected
Method parse() was passing down its default value argument to various
methods that expected an argument reflecting what's been parsed thus
far.  Pass them what they expected !  Most are fairly insensitive to
the details at present, but the zone parsing I intend to add needs to
know the right date to compute its offset.

This makes it necessary to work out a sensible date and time to use,
from the fragments seen so far, using the default value to fill in
gaps but deviating from it wherever it conflicts with the actual
values seen.

Change-Id: I76750fcd92c1bdcad15c7dd4d8002cb90cec94ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-05-22 13:00:00 +00:00
Allan Sandfeld Jensen
7fbc7c9600 Optimize conversion from unpremultiplied to opaque formats
Save unnecessary premultiply and unpremultiplication when converting
from an unpremultiplied format like ARGB32 to any opaque format like
RGB32 or RGB16.

Change-Id: I73f58200ff5c62fb07910e6f2b1c29b7e254d327
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-05-22 11:04:16 +00:00
Tor Arne Vestbø
e794c1bb79 macOS: Remove workaround when adding view as subview
a6b34517e introduced this code as a workaround for stale QCocoaWindow
pointers during event delivery, but these days QCocoaWindow is a
QObject and guarded by QPointer. Disassembly of AppKit also shows that
the view is removed for us, so there's no need to do it explicitly,
especially as this causes two distinct event callbacks from AppKit
for what should be one atomic operation.

Task-number: QTBUG-42059
Change-Id: I212c894adf6aee51256ceff03c9821a995c2a63d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-05-22 10:57:53 +00:00
Tor Arne Vestbø
1051abc480 macOS: Remove workaround when setting view as content view
abde2a59c6 introduced this code on the basis that setContentView
does not remove the view from its superview, but disassembly of
AppKit shows that it does. Since commit 52767b8ee7 we also
ensure that the previous NSWindow has its contentView property
cleared, so this workaround is no longer needed.

Task-number: QTBUG-39628
Change-Id: I21e179263d006f3af1f8a55e9e2f7e8eeab2a632
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-05-22 10:57:49 +00:00
Marc Mutz
5336e061ec QVulkanWindow: return QMatrix4x4 by value
The function never returns nullptr, so return the matrix by value.

Change-Id: I7c1eeb43b9693866049763565b575348ddd35548
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-05-22 09:23:15 +00:00
Marc Mutz
85554be25f QWizard: move 'initialized' bit into QWizardPage
... as suggested by a code comment.

This avoids the external bookkeeping using a QSet, and will allow, in
Qt 6, when we can port QWizardPage to the NVI idiom, maintaining the
bit as part of the initialize and cleanup functions directly.

Change-Id: I25a4dbf4c42f2c0286aa1a72ab9c59463d44c5df
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-22 09:21:23 +00:00
Marc Mutz
d3f1076d0a QVulkanWindow: use QVector, not QSet, for small int set
Apart from being more efficient to construct and test, for the
expected very small number of entries, the example code itself shows
that a sorted vector is much more useful than an unordered set.

Change-Id: Ic5e38df0176ac4be08eac6a89c2e1cabab2a9020
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-05-22 08:50:05 +00:00
Eskil Abrahamsen Blomfeldt
33c59be551 doc: Add warning about QTextLayout::beginLayout() and clearLayout()
If you keep around QTextLines referring to the previous contents of
the layout, you can experience crashes when using these after the
layout has been cleared. Since QTextLine is a value type, this is
not very obvious in the API, so we should at least give a warning
in the docs.

Task-number: QTBUG-60804
Change-Id: I81b2b640eec5f62b0af1e878aadd9fa23654ec18
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-05-22 05:40:09 +00:00
Timur Pocheptsov
c21cee827f QSslSocket (OpenSSL) make supportsSsl return false, if v >= 1.1
Our OpenSSL backend allows missing symbols and in general protected
from possible related failures. Unfortunately, for OpenSSL 1.1 this
means not only missing symbols (removed functions), but new incompatible
opaque data-structures and our 1.0 code trying to use them and probably
accessing some data-members via macros - we end up in UB and crashes.
SSLeay, which returns a version number, was removed in 1.1. A failure
to resolve this symbol we consider as a version mismatch and we make
'supportsSsl' to return false.

Task-number: QTCREATORBUG-18137
Change-Id: I5cd270f9c61a729105149779ee7277816f9467d7
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-05-21 09:46:16 +00:00
Sérgio Martins
6ec3a97297 Remove a QT_STRICT_ITERATORS ifdef
Having special code paths defeats the purpose of QT_STRICT_ITERATORS
and is ugly.

Change-Id: Ie0bdbf1a9639a0903bcd020f526629ab2e69883b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-05-20 16:00:07 +00:00
Tor Arne Vestbø
da8ace713a QWidgetWindow: Forward incoming events with their original spontaneous state
The events may come from QPA, as spontaneous events, or from other parts
of Qt, as non-spontaneous events. We should keep the state of the original
event.

Introduces QCoreApplication::forwardEvent() as a wrapper around the
opaquely named notifyInternal2. Ideally this would be the behavior of
sendEvent, with an enum argument to override the flag, but that ship
has sailed.

Change-Id: Ib0209f2b99744bd10590c63239ee7a97b60be4fd
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-20 12:26:28 +00:00
Martin Porcelli
f78ef9753c macOS: Ctrl LMB override can be set on a per window basis
QNSView instances check the _q_platform_MacDontOverrideCtrlLMB
window property along with the QT_MAC_DONT_OVERRIDE_CTRL_LMB
environment variable during creation.

Change-Id: Id6457fccdce2dff1fa83448dd2bc4d2757a87e9d
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-05-19 21:51:43 +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
Błażej Szczygieł
53335315ff HiDPI: Scale mouse position on enter event
Task-number: QTBUG-60892
Change-Id: If800ecaadc5b19c10a954658ece484f30b7f313f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-19 18:06:33 +00:00
Oliver Wolff
3137410594 Revert "Enable "combined-angle-lib" for ANGLE builds"
Combining libEGL and libGLESv2 into QtANGLE cannot be the default
any longer, as the change was binary incompatible. We just had to
return to previous behavior temporarily to be able to fix
qtlocation.

This reverts commit 97ab65076e30d8cd0cbe6bdbdb51d1dc2c0ff7e7.

Task-number: QTBUG-60795
Change-Id: I3095cb5f9da30e2d873d9a186cfbc5aee3fb10b2
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2017-05-19 17:40:12 +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
Friedemann Kleint
9301d48543 QGuiApplication: Initialize and clear static variables
Running:

tst_qapplication focusMouseClick touchEventPropagation

produced:

FAIL!  : tst_QApplication::touchEventPropagation() 'window.seenMouseEvent' returned FALSE. ()

since QGuiApplicationPrivate::mouse_buttons was not cleared
when destroying and re-instantiating QGuiApplication.

Add more initialization and clear screen list on exit.

Change-Id: I0d814852c362d4a86f1ff5d6a94ab00d32ed30b9
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2017-05-19 06:16:00 +00:00
Gabriel de Dietrich
9954187adb QCocoaMenuBar: Keep smart reference to platform window
Change-Id: Ib3a5b071f1cc66992969a85a092f8111e57dea44
Task-number: QTBUG-60786
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7da9fa2890)
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-05-18 21:18:47 +00:00
Thiago Macieira
9406bef6b3 Revert "Add qt_safe_ftok wrapper for ftok"
This reverts commit ac0184d608. That
commit added the use of qHash in qt_safe_ftok, which made ftok even more
unsafe than previously. Since the algorithm in qHash can change across
Qt versions, we need a stable algorithm instead.

[ChangeLog][Important Behavior Changes] Reverted a change that caused Qt
5.6 through 5.8 not to connect to QSystemSemaphore and QSharedMemory
created by running applications using Qt earlier than
5.6. Unfortunately, this means that Qt 5.9 will not connect to 5.6-5.8.

Task-number: QTBUG-60771
Change-Id: Ibc3472e1c11d46358357fffd14bf51aeb48ef2c8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-18 21:17:52 +00:00
Timur Pocheptsov
6b17d995b7 QNSPanelContentsWrapper - call [super layout]
Docs say that we have to explicitly call [super layout] from the overriding
-layout. On macOS < 10.12 missing -layout call results in a noisy debug
message.

Task-number: QTBUG-58699
Change-Id: I58ce442f1e3640a6b1ec32774078e2385d73f085
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-05-18 09:11:38 +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
Oliver Wolff
acc134c8ea winrt: Skip host lookup for http connections
While QAbstractSocket is already changed in a way that winrt only
connects to host names and does not do IP lookups, http connections
still do a lookup to check, whether to use IPv4 or IPv6. As this
information is not needed on winrt anyways and hostnames are to be
preferred over IP addresses on winrt (automatic lookup & proxy handling
internally), we skip the lookup for http as well.

Task-number: QTBUG-59989
Change-Id: Ibc11f5ac07faf23e7af508fd20ee4880b24f79a8
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-05-18 05:18:47 +00:00
Thiago Macieira
087b4fc6cd Remove unnecessary FunctionPointer::ChangeClass
Those were added by accident.

Change-Id: I067fcfe299b34ab6a771fffd14bf28f2d3c096f0
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-05-18 02:48:27 +00:00
Oliver Wolff
b53858e609 Enable "combined-angle-lib" for ANGLE builds
As qtlocation's mapboxgl plugin links to QtANGLE if dynamic opengl is
used, we have to keep the combined library being the default until
qtlocation is fixed.
As soon as the qtlocation fix has landed in 5.9.0 this change should be
reverted.

Task-number: QTBUG-60795
Change-Id: I0781695e085a28a8971a6245a352413c0f779025
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-17 13:42:53 +00:00
Lars Knoll
51f095e655 Revert "Merge the QDBusMetaType's custom information to QDBusConnectionManager"
This reverts commit daeb334039.

The commit was causing race conditions, and random failures in CI.

Task-number: QTBUG-60792
Change-Id: I6e49b733965632a1a268f0e88809794098465ec0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-17 13:42:47 +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
Glen Mabey
1eea9e60d0 improve docs for qfloat16
added a proper \title, \ingroup, and \brief

Change-Id: I85ac845d8e5415793e6de02cd653c60e2712faa5
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Glen Mabey <Glen.Mabey@swri.org>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-05-17 11:52:58 +00:00
Friedemann Kleint
ff8ce00cae Add debug operators for QOpenGLVersionProfile QOpenGLContext(Group)
Change-Id: I2bf06761bc3a19aa1f0973d9b2f32cec4cbdca0c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-05-17 06:11:09 +00:00
Tor Arne Vestbø
b545a6359b macOS: Don't create NSWindow for embedded views
An embedded view does not have a QCocoaWindow parent, but that doesn't
mean it's a top level.

Improved debug logging to make issues related to this code easier to
spot in the future.

Change-Id: I15b5acdd8d7112600618465a3b65b64fddc306f7
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-05-16 17:16:02 +00:00
Gabriel de Dietrich
6775cfa054 QMacStyle: Remove unused default button logic
The auto-default button part must remain, but the pulsating
animation logic can go. Same for the pressed button logic.

Change-Id: I0e9a755f86601780a219296fbc02a1eb2b703aea
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-16 17:03:46 +00:00
Filipe Azevedo
b30ce06992 iOS: Fix the shortcuts bar not correctly hidden
To avoid a compiler warning due to a wrong Apple api, a wrong
workaround was introduced. This caused the hide of the shortcuts as
expects but the visual space reserved for shortcuts was still visible
as at top with a height of ~55pixels.
While this is not important because the default virtual keyboard
is always shown, it become a problem when one want to introduce his own
virtual keyboard (UIResponder.inputView) with no shortcuts bar.
This fix really hide the shortcuts bar.

Task-number: QTBUG-60812
Change-Id: I0da44dfc3fda15af3351543c0a05aac973b899b9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-05-16 14:36:09 +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
51e1374bae QLatin1String: add constructor from pointer pair
This is often more natural than (ptr, len), and I need it in the
implementation of QLatin1String::trimmed().

[ChangeLog][QtCore][QLatin1String] Added a constructor taking two
pointers, complementing the constructor that takes a pointer and a
length.

Change-Id: I0606fa0e3f820af1c3c1e261a340e5a941443e4f
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-05-16 09:34:54 +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
Marc Mutz
221653cbea Move Q_REQUIRED_RESULT to first in line in qstringalgorithms.h
Necessary to support C++17's [[nodiscard]] attribute, which needs to
be placed at the beginning of a function declaration.

Change-Id: I31494d13c7be558e86378782ab8684ef2956730b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-05-16 09:34:37 +00:00
Gatis Paeglis
5963528820 xcb: rename QXcbConnection::{setButton,buttons,m_buttons}
... to {setButtonState,buttonState,m_buttonState}. This is more
consistent with the naming from XCB events:

  xcb_button_press_event_t->state
  xcb_button_release_event_t->state
  xcb_motion_notify_event_t->state

Change-Id: I51ebb858defbdfee4a2009922178f0e58658e6b6
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-05-16 07:54:46 +00:00
Shawn Rutledge
d0a1135f00 QDirIterator docs: add a cool recursive file-finding snippet
This is one of the main use cases for QDirIterator, but it wasn't
obvious enough that it's possible.

Change-Id: Idae11cfe75dd0e16f1a960bba2470b1695d11241
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
2017-05-16 06:00:47 +00:00
Gabriel de Dietrich
7da9fa2890 QCocoaMenuBar: Keep smart reference to platform window
Change-Id: Ib3a5b071f1cc66992969a85a092f8111e57dea44
Task-number: QTBUG-60786
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-05-16 01:06:18 +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
92a07c6289 QMacStyle: Move disclosure triangle into cocoaCell() logic
Change-Id: Ica7766dabba57af3107ea275aa48514bc65158fb
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-15 22:40:28 +00:00
Gabriel de Dietrich
6f3b59bfe4 QMacStyle: Use NSStepperCell for QSpinBox buttons
Includes painting and subcontrol rectangles.

Change-Id: I9a4c704bdea4f20f8dca94de24063f3e14dbaf91
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-15 22:40:18 +00:00
Gabriel de Dietrich
ee1868df2b QMacStyle: Remove a couple void *, dead code
Change-Id: If05fbdf8cc5ced81adfd75232313969223bf1453
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-15 22:40:05 +00:00
Gabriel de Dietrich
cdc5f7ab5c QMacStyle: Move NSScrollers into cocoaControl() logic
This patch amends b113107419.

Change-Id: Ib305554763457ae4b5a441e41947304cff2853a2
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-15 22:39:59 +00:00
Gabriel de Dietrich
d422ba6b4a QMacStyle: Refactor NSGraphicsContext setup logic
Change-Id: I00d473454bf970ef55f44d6094039b3f02221155
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-15 22:39:47 +00:00
Gabriel de Dietrich
0d3a11acee QMacStyle: Remove brushed metal related code
Change-Id: I000d70c7bcc839c04a89cb87052187eeec62243f
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-15 22:39:36 +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
Gabriel de Dietrich
33833d4225 QMacStyle: Replace HIRect, HIPoint with CGRect, CGPoint
We probably changed how rounding is done between CGRect
and QRect coordinates, but we expect more things to change
in the near future.

Change-Id: If961849c46edc5fcfee9aef2acda57f386b2928b
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-15 22:39:23 +00:00
Gabriel de Dietrich
6faa349eb0 QMacStyle: Remove HITheme for CE_MenuItem, etc.
Includes the unlikely non-native menu bar.

Change-Id: Ibc36cbdbe5add3798fe65066d87c48e84804ec33
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-15 22:39:18 +00:00
Friedemann Kleint
329a029c36 Windows QPA: Do not raise/lower windows with Qt::WindowStaysOnTop/BottomHint
Prospectively helps to fix Qt::WindowStaysOnTopHint not working reliably
on Windows by preventing HWND_TOPMOST being cleared in raise().

Task-number: QTBUG-50271
Change-Id: I88f916a1cf8a2082236360b9eab874ad22b85762
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-05-15 20:31:28 +00:00
Tor Arne Vestbø
942675f12b macOS: Guard on platform window instead of window delegate in QNSWindowHelper
The platform window is cleared in detachFromPlatformWindow, just like the
delegate, but the platform window may be cleared due to other reasons as
well, so use that as a guard before calling functions on the pw.

Change-Id: Ie0773182073d4932b2bca8bc0fc8af24b8895a9d
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-05-12 11:47:15 +00:00
Oswald Buddenhagen
791df9821d fix random build error with -no-feature-commandlineparser
when the dbus tools are bootstrapped (which is the case in x-builds and
when above feature is disabled), they are built asynchronously to the
corelib module. but as qdbusxml2cpp's project file needs to check the
need for bootstrapping, it needs corelib's configuration. so pull it in
explicitly.

Change-Id: I559c7590a3eba8d3f8a03c44fe3a6d56f1c56db0
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-05-12 11:40:16 +00:00
Kai Koehne
c608520766 Doc: Remove platform support table for bearer management
The table is woefully outdated. Instead of shipping stale documentation
I think it's better to just reference the generic API for this.

Change-Id: I619113ab5140ccf65b774e69e836b27001bb0a18
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-05-12 09:44:54 +00:00
Bernhard Übelacker
df57011bdc Make relation of currentChildBeingDeleted and isDeletingChildren more obvious
Add a comment, to describe the relation of
QObjectPrivate::currentChildBeingDeleted and
QObjectData::isDeletingChildren, given that this field is defined
in an entirely other file on a base-class, making it severely
non-obvious to the reader.

Task-number: QTBUG-57714
Change-Id: I7b8b24693c4ccc6192e9f9f34f951202b7fdddb0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-05-12 08:12:06 +00:00
Gabriel de Dietrich
4bb64b0ee5 QMacStyle: Remove HIShapeGetBounds hack
Link to ApplicationServices since that's where this function
is located. Whether this framework may be removed with Carbon
is unknown at the moment. It does remove an obscure dependency
nonetheless.

Change-Id: If6514f70ca434298f1c88457adac51d38a1afa22
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-12 05:13:07 +00:00
Gabriel de Dietrich
ff238f60fd QMacStyle: Get rid of GetTheme* metric functions
Change-Id: I88f52db58a57ff8ff9aeee9e475d193186a7abb9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-05-12 05:11:55 +00:00
Gabriel de Dietrich
4c45f64512 Cocoa QPA: De-Carbonize system palettes
We use the NSColor system/developer palette instead of
HITheme brushes.

Change-Id: I11b34c7049ca98057eaeca5a0d0b8f64dbe3e5ab
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-12 05:11:42 +00:00
Friedemann Kleint
7b6d200503 Add debug operator for QOpenGLTexture
Change-Id: If87730725d9eba8d4c1e0158056cdeaa7c1bc12f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-05-11 19:35:28 +00:00
Friedemann Kleint
6a8a93a2a1 QOpenGLTexturePrivate::destroy(): Make error messages more verbose
Distinguish missing and non-sharing contexts, output values.

Change-Id: If52555098c1b46e6016e00f9dbbfad8e4b5d3a2d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-05-11 19:34:46 +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
Oliver Wolff
3f1548ae82 Restore behavior of using libEGL and libGLESv2 as default for angle
As Qt applications using OpenGL are linked against these libs, merging
them into QtANGLE by default (780105f906)
was a binary incompatible change. This change restores the default
behavior to the one before given change.

If the user wants the libraries to be merged, he can pass
combined-angle-lib to configure.

Task-number: QTBUG-60373
Change-Id: Iedbd3f2ce9284fdde924cfae8d915d6d5fef00db
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-05-11 08:35:54 +00:00
Thiago Macieira
67f466505e Fix some QtDBus crashes during application destruction
It's possible that some code executes after QDBusConnectionManager is
destroyed and still tries to access QtDBus. Protect against such
crashes.

Change-Id: I87e17314d8b24ae983b1fffd1453c13fbd3cf48e
Reviewed-by: René J.V. Bertin <rjvbertin@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-05-11 08:35:33 +00:00
Thiago Macieira
daeb334039 Merge the QDBusMetaType's custom information to QDBusConnectionManager
This allows us to get rid of two Q_GLOBAL_STATIC in QtDBus, which means
fewer opportunities for screwing up the order of destruction. And since
QDBusConnectionManager now ensures that the types are initialized, we
don't need to re-initialize them everywhere.

The Q_GLOBAL_STATIC for QDBusConnectionManager ensures the proper
thread-safe locking, so we don't need to lock for every type that we're
trying to register. This should make things faster.

But as a side-effect, trying to register a D-Bus metatype will cause the
QDBusConnectionManager thread to start too.

Change-Id: Ifea6e497f11a461db432ffff1449a4e535234485
Reviewed-by: René J.V. Bertin <rjvbertin@gmail.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-11 08:35:24 +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
Jake Petroules
cf969f0be3 Add undeclared CoreFoundation and Foundation deps to coretext.pri
This fixes shared library builds of Qt on iOS and tvOS.

Change-Id: I29d4c7e779e51b1adc19ca9dc18bc46a45a60093
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-05-11 05:57:08 +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
Tor Arne Vestbø
3ae34b7ead Make qNextPowerOfTwo constexpr when building as C++14
Change-Id: Ic29dcbf1c4b70516ebb436b90962e3fdeb0e5608
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-05-09 19:55:59 +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
Tor Arne Vestbø
0c310367a4 macOS: Reduce usage of m_nsWindow to manipulate the view's NSWindow
With the right guards for isContentView() we can use m_view.window
directly. The only instances left of m_nsWindow are during window
creation, which will be removed in a followup.

Message send syntax for reading or writing Objective-C properties
has been replaced with dot syntax where appropriate.

Change-Id: I86925753612516625c93ea5bbedc98a3ddd8fec4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-05-09 12:39:28 +00:00
Shawn Rutledge
3d77e1396c Add QDebug operator for QFileInfo
So far it only shows the path.

Change-Id: Ibfecc20ddacce12a178e1ddb297b0e7b91f29f05
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-09 09:25:11 +00:00
Tor Arne Vestbø
ce3a77eed5 macOS: Add a few more platform window checks in QNSView
And unify all of them to use regular pointer check syntax, to stay
consistent with other uses of non-smart pointers.

Change-Id: Ic55d7a16f2010120aaa8eac5b2df8189490671a2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-05-08 19:08:35 +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
Allan Sandfeld Jensen
ab059940aa Revert gamma-corrected handling of transparent destination buffer
Due to the text blend routines being used by ARGB32 and due to another
bug on invalid premultiplied buffers, we need to keep using the naive
blend on non-opaque pixels for now.

Task-number: QTBUG-60562
Task-number: QTBUG-60571
Change-Id: Idfbb2c2e24dd840189c4fbed4e167f03bbc6ca8d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-05-08 18:04:12 +00:00
Friedemann Kleint
b97a703613 Windows QPA: Call InvalidateRect() for GL windows when Aero is off
Some AMD cards have been reported to not update otherwise.

Task-number: QTBUG-60527
Change-Id: I84d57a57eb2b76fb31255ae42b79b96ab7b257c9
Reviewed-by: Kimmo Leppälä <kimmo.leppala@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-05-08 15:14:58 +00:00
Stephan Binner
f12e4903c7 Warn if files are not found because of features.filesystemiterator
Change-Id: Ife3197aa1c56ba3ab6e7f530fbcbcf761f223b16
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-08 14:10:21 +00:00
Tor Arne Vestbø
7124096f2b macOS: Reduce usage of m_nsWindow in favor of isContentView()
The m_nsWindow member both indicates whether or not the QCocoaWindow
represents the content view of a NSWindow, and provides access to that
NSWindow. The former is better expressed through isContentView(), which
allows us to then replace m_nsWindow entirely in a followup with access
though m_view.window, removing the need to cache the NSWindow.

Change-Id: I6e7de4b6d64b29fc9023222be045254f18be28cd
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-05-08 13:30:33 +00:00
Tor Arne Vestbø
4a5a4245b7 macOS: Add root level NSAutoreleasePool for objects autoreleased in main()
Any objects directly or indirectly autoreleased in main(), before we start
the event loop, will never be released, as there are no pools present yet.

This includes all resources allocated during application and window setup,
unless those function have local pools. Ideally that setup code would be
called from within the runloop callstack, where there is a pool present,
but that requires a new main/startup-API for Qt.

To aid in debugging object ownership and hierarchies within Qt, we set up
our own root level pool tied to QApplication, which ensures that most objects
autoreleased in main() will eventually be released and have their dealloc
methods called.

The feature can be disabled by setting an environment variable:

  QT_DISABLE_ROOT_LEVEL_AUTORELEASE_POOL=1

Combined with OBJC_DEBUG_MISSING_POOLS=YES, this allows breaking on the
function objc_autoreleaseNoPool to weed out codepaths in Qt that should
have local pools.

Change-Id: Id02e1edaaaeaa04c53862d7228e519214c99ab51
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-05-08 11:01:39 +00:00
Thiago Macieira
225a35a2ab Use QNetworkReply::ProtocolFailure in HTTP/2 failures
ProtocolInvalidOperationError are meant for actual replies from the
server indicating that the operation is not valid (HTTP 400 Bad
Request).

Change-Id: I9ad33fff8b634979bdbafffd14bbc57e4b21d6bf
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-05-08 09:39:16 +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
James McDonnell
fb00b4199e OpenGL function lookup for QNX
Qt no longer supports using OpenGL ES2 via static linkage.

Task-number: QTBUG-60457
Change-Id: I754ff1c084ecdfdf7bea0bd691c8f0fc47a2fcb0
Reviewed-by: Dan Cape <dcape@qnx.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-05-07 16:44:32 +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
Robin Burchell
1c87d4e1a1 QClipboard: Downgrade a warning to a debug message
Clients don't (or shouldn't) care if a selection clipboard is supported
for instance. They should just try to use it. There's nothing they can
usefully do if the platform doesn't offer a selection clipboard (like
Mac).

Change-Id: I0adb79766807806a4754353b48e33ed8acf9100a
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-05-06 08:30:05 +00:00
Marc Mutz
50faf34442 [doc] QStringView: remove documentation of removed constructor
Change-Id: I3b5ad8deabd67f2327c45fe8aa914c0e7883513c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-06 07:33:14 +00:00
Thiago Macieira
02700cf6c2 Add an extra check for qssize_t's size and type
The definitions of size_t and ptrdiff_t ([support.types.layout] p2 and
p3 respectively) do not specify that they need to be as big as a
pointer. They just need to be big enough to hold the size of the largest
object and the biggest array subscript, respectively, the platform
supports (e.g., 16-bit DOS would have them as 16-bit in all memory
models, except huge).

But we depend on them actually being the size of a pointer in many
places, such as in QArrayData::offset, that stores the linear distance
from the end of the structure to the beginning of the data, wherever it
is in memory.

It's also a good idea to verify that qptrdiff and qssize_t are the same
type.

Change-Id: I9ad33fff8b634979bdbafffd14bbd1223afc58e8
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-05-06 02:57:41 +00:00
Alex Trotsenko
9e1f60053a QWindowsPipeReader: remove code duplication in read()
QRingBuffer::read() implements the same loop.

Change-Id: I480fe07e2400dfaee560f22bdbf07d6cdd013eb2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-05-05 15:45:54 +00:00
Frederik Schwarzer
0b1ec78c2d Fix description starting with a fullstop
Change-Id: Ie8ed872547aa16a2bca2b3886d8c58bffb92b279
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2017-05-05 15:02:09 +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
Gatis Paeglis
c2c5026891 cleanup: remove redundant QGuiApplicationPrivate::buttons
This variable was introducing during Qt 5.0 Q{Gui}Application
refactoring days (2011 or even before) and since then has been
used interchangeably with QGuiApplicationPrivate::mouse_buttons.

This patch removes the duplicate member variable as it is
redundant and could be a source of potential errors.

Initially I was thinking that ::buttons might be used for
the purpose of QTestLib, but it is not. QTestLib delivers
mouse events directly via qApp->notify() (mouse button state
is update via QGuiApplicationPrivate::mouse_buttons from notify()),
or via window system interface QWindowSystemInterface::handleMouseEvent
(which goes through QGuiApplication::processMouseEvent).
Looking at QGuiApplication, it is clear that ::buttons
and ::mouse_buttons always have the same value, as there
is only one assignment to these members in QGuiApplication:

mouse_buttons = buttons = e->buttons;

And there are no other places that would assign to
QGuiApplicationPrivate::buttons.

Change-Id: Ib60d366bf056a98b15bb4538a569693e7bd022e2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-05-05 13:54:48 +00:00
Erik Verbruggen
3727474421 Prevent 2 unnecessary QString allocations for QString::number(0u)
QLocaleData::unsLongLongToString uses qulltoa, which will allocate a
zero-length QArrayData. Then with padding a single 0 was put in a
QString, which gets prepended to the result. By taking care of this
special case, we can now also fast-path the common case where base=10
and no flags nor precision was provided.

Change-Id: Ia893b0ea4c77634c24e7cef5aafb06d0ef44c507
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-05-05 12:28:45 +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
Thiago Macieira
05f22d6eb2 QtCore: include mocs
Compilation and link times in CPU seconds with GCC 7, using precompiled
headers (not including moc, rcc, uic, etc. steps or headersclean):

                Before  After
Debug -O0       198,1   180,3
Debug -Og       240,7   229,2
Release -O3     267,1   249,2
Release LTO     239,4   229,8

QtCore required a little manual adjusting because some files are
bootstrapped into moc itself and into qmake.

Change-Id: I84e363d735b443cb9beefffd14b8b57c10e7da36
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-05-05 03:03:30 +00:00
Thiago Macieira
f45c6c1804 QInternal::unregisterCallback: don't crash on unregistering during exit
Task-number: QTBUG-60558
Change-Id: Ica9894dc9b5e48278fd4fffd14bb34c6d98d2555
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-05-05 03:03:20 +00:00
Thiago Macieira
fb89364e3a AreArgumentsCompatible: Replace a derived struct with template alias
There's no need to derive. This fixes the build with MSVC 2017 under
/permissive-. I don't know what was wrong (ICC, Clang and GCC don't
complain), but it must be related to "Lookup members in dependent base"
in [1].

[1] https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance

Change-Id: I9ad33fff8b634979bdbafffd14bb8016f5dc98b3
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-05-05 03:03:07 +00:00
Oleg Yadrov
e2e874415e QClipboard: make dataChanged() signal work on Android
This part has not been implemented before.

Also replace deprecated android.text.ClipboardManager with modern
android.content.ClipboardManager.

Task-number: QTBUG-58548
Change-Id: I190208042af8a6c87ed391c6c72f3f51e58dfad3
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-05-04 19:43:33 +00:00
J-P Nurmi
63d08003cf Fusion: draw DPI-scaled arrows
Replace the "hard-coded" fusion_arrow.png with qt_fusion_draw_arrow()
that scales appropriately on high DPI screens.

Task-number: QTBUG-40277
Change-Id: I2c4a134de757a39d7744977bd41accff69810521
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-05-04 16:37:13 +00:00
J-P Nurmi
edcc71be87 Fusion: DPI-scale menu items
The sub-menu arrow indicator is still tiny. The Fusion style uses
a pre-made pixmap (fusion_arrow.png) for drawing the various arrow
indicators for sub-menus, spinboxes, combo boxes, scrollbars etc.
This will be addressed in a separate patch.

Task-number: QTBUG-40277
Change-Id: Id82c564340854e922b3b5f5bcf038ec535ed6cf4
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-05-04 16:37:01 +00:00
Oswald Buddenhagen
464a43d43c Merge 5.9 into 5.9.0
Change-Id: Id3fc911f024cba292a5c426b36aa94ff9f3c0ef7
2017-05-04 14:03:11 +02:00
Kai Koehne
4ad030de71 Doc: Do not abbreviate directory in documentation
Change-Id: I26e8c5caca31e842adc7a09151b6de2cc17698ed
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2017-05-04 11:23:00 +00:00
Venugopal Shivashankar
877ef0594d Doc: Add information about styling QTableView::indicator
Task-number: QTBUG-60245
Change-Id: I068d74d3d1d3ffb872ac6fec830367d67b65049d
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-05-04 09:06:18 +00:00
Pier Luigi Fiorini
ec6c21717a xcb: Decode EDID blob
Retrieve and parse EDID blob.
Return screen product information from EDID.

[ChangeLog][Platform Specific Changes][Linux/XCB] Add screen product
information from EDID.

Change-Id: Ic54429cdc90c41342c37511bcaebce95c175f517
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-05-04 08:10:31 +00:00
Marc Mutz
b1debc11c1 QStringAlgorithms/private: prefer to trim whitespace from the end
When calculating what to trim in trimmed_helper_positions(), first
trim the end, then the front.

This way, a string that consists of just whitespace will remain
anchored at its front, and we do not run into the memmove case in
trimmed_helper_inplace, which, even though there's zero elements to
move, still calls a potentially-out-of-line function (memmove()).

Change-Id: I7024ffa1f7ae2effb9c5166ec8f30a42b8d51079
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-05-04 07:20:55 +00:00
Jarek Kobus
b53f8bf040 Keep in sync uic sources with qttools module
Change-Id: I680505b8d68f363e6dc86d090632ec9b021ee981
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-04 06:55:27 +00:00
Gabriel de Dietrich
35f927e719 QMenu: Ensure popup() gets the right screen geometry
Many QMenu related functions end up calling sizeHint() which
does call updateActionRects(). Since we try not to update the
action rects if no action has changed, we must be careful to
call it the first time with the right screen geometry. Other-
wise, multi-display setups may get the action rects based on
the wrong display.

In QMenu::popup(), this can be solved by using the position
passed as argument. Incidentally, we were already computing
the right display geometry in the same function, only a bit
later. The updated position around an eventual push button
menu should not change the screen onto which the menu popup
will be displayed.

Tested with the multiscreen-menus manual test.

Change-Id: Id7fc24be6908b4a9d24b8b9c8b8006efe45d69be
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-05-04 06:43:52 +00:00
Shawn Rutledge
64967461ee QVulkanWindow: fix fatal warning on Clang 4
qtbase/src/gui/vulkan/qvulkanwindow.cpp:1882:42: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
        VkClearColorValue clearColor = { 0.0f, 0.0f, 0.0f, 1.0f };
                                         ^~~~~~~~~~~~~~~~~~~~~~
                                         {                     }
1 error generated.

VkClearColorValue is a union, so it wants to be clear that we are
initializing only one of the union's members, apparently.
(Even though initing more than one wouldn't make sense.)

Change-Id: Id4afa3ddc1b4ce7e24e681fb93c0ee9083c41e08
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-05-03 14:04:49 +00:00
Tor Arne Vestbø
226a20dff8 macOS: Replace deprecated NSOKButton usage with NSModalResponseOK
Change-Id: Ibecda9bcafc1f366315b5aac8c14d50c49ccf10d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-03 13:57:40 +00:00
Oswald Buddenhagen
98c1d516b7 alloca: detect whether alloca.h exists
We can't depend on QT_HAS_INCLUDE for such an important functionality in
QtQml, so detect at configure time.

alloca() is not a POSIX function (it apparently first appeared in
Version 32V AT&T UNIX), so the actual header that defines it varies from
system to system. Clearly, if alloca.h exists, that's the one, so we try
it first. On most other systems that don't define it, it's in stdlib.h.
The only exception is Windows, where it's actually defined in malloc.h.

Task-number: QTBUG-59700
Started-by: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b4b2b389a4684e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-03 12:19:57 +00:00
Marc Mutz
d58c600543 Remove QAddConst
It was added to support qAsConst(). When <type_traits> became mandatory,
porting qAsConst() to std::add_const was forgotten.

Change-Id: Ifb9b54d12554ce19dca4664642a8644f49aeb6af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-05-03 09:21:41 +00:00
Alex Trotsenko
979c8b746b QCFSocketNotifier: fix registering a source in the run loop
Even if a callback type is not automatically re-enabled, callbacks are
implicitly enabled when the source has been added to the run loop.
In this case, calling CFSocketEnableCallBacks() could produce an extra
notification if there is a pending event in the queue.

The bug is quite unstable and completely depends on the internal OS
delays. So, it can't be tested inside Qt.

Task-number: QTBUG-59930
Change-Id: I751b8b8cf99cb86b80055f2214a42a638f01abe4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-05-03 08:31:38 +00:00
BogDan Vatra
0fefed996c Fix different look when running the application second time
The problem was introduced in Qt 5.7.

Task-number: QTBUG-60297
Change-Id: I46265b24e104e08fe5b8026e5441514a438582c9
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2017-05-03 09:43:12 +00:00
Nico Vertriest
2714531aad Doc: correct minor link issues
qobject.cpp:4288: warning: Can't link to 'Q_ENUM_NS'
qobject.cpp:4314: warning: Can't link to 'Q_FLAG_NS'

Change-Id: I0fa5a1d4f9b4868a1a98ce6d3b5f6bb9b34c5dd2
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-05-03 08:30:25 +00:00
Marc Mutz
47cf309190 [doc] QSet: fix return type of insert()
It's an iterator, not a const_iterator. Let QDoc figure out the correct one.

Change-Id: I7ddd1568adbf811b801c170794465ba14ceed05e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-05-03 07:22:41 +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
Stephan Binner
2f92bd7cd7 Fix warning for -no-feature-graphicsview
Change-Id: I3229fccd2f837b8b8b4da2a149d4584cb4a54dab
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-03 05:15:08 +00:00
Eric Lemanissier
8e83d61501 Adapt to the C++ SIC introduced by P0012: noexcept specialization
complements commit c5e687895d
added missing noexcept (void)StoredMemberFunctionCall specialization
to disambiguate template selection.
Without these specializations, StoredFunctorPointerCall was a better
match, which led to compilation failure

Task-number: QTBUG-58142
Change-Id: Ibd41057d9a497f057a895d73277902e90300ed7a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-05-03 02:39:56 +00:00
Gabriel de Dietrich
46543bb462 QMenu: Refactor column layout logic
Change-Id: I30f1c87092447abf1c94e69c0124eeeee43666e2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-03 02:21:35 +00:00
Tor Arne Vestbø
60865878e4 macOS: Add autorelease-pool when recreating NSWindow
Significantly reduces the number of objects left to rot in the root pool,
which is only drained on application shutdown.

Change-Id: Iad7520ab083715416d95413a63474b9153f22fb5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-05-02 19:02:07 +00:00
Tor Arne Vestbø
705c716543 macOS: Add auto-release pools for Q*ApplicationPrivate::init()
So that any objects autoreleased during application initialization are
released. Otherwise they will end up in the root level pool and only
be released when the application exits and the application goes out
of scope.

Change-Id: If02d24fd70098f9b4b1b0ea3218e0a15e438b9db
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-05-02 19:01:59 +00:00
Allan Sandfeld Jensen
62fc49fb91 Handle implicit close in QDashedStrokeProcessor
Otherwise dashed polygons will not be closed when stroked like they
are documented to be.

Task-number: QTBUG-60397
Change-Id: I58e9e3a06af157f9a2789ccab640c9da75867962
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-05-02 14:49:20 +00:00
Friedemann Kleint
d9e55e40a9 QFileDialogPrivate: Move inline to declaration
Fixes MSVC warning:

src/widgets/dialogs/qfiledialog_p.h(412): warning C4273: 'QFileDialogPrivate::selectedMimeTypeFilter_sys': inconsistent dll linkage

while building tst_qfiledialog2.

Amends change 34f82b8abc.

Change-Id: I7306535000af73ee3a027b14a2d5cfce4f889e85
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-05-02 14:47:15 +00:00
Kai Koehne
b5883a16cb QWindowsInputContext: Fix indentation
Fix indentation of code (introduced in 14efcaa3)

Change-Id: Iee9bc7c66dbde4088168497e9428940554612e84
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-02 13:58:40 +00:00
Olivier JG
2f94b7a991 Windows QPA: Find window before invoking native filters
When handling WM_NCCALCSIZE in a global filter, the associated platform
window needs to be assigned to platformWindowPtr so that its frame
margins can be updated on return.
See also 3035400f36, which introduced the
platformWindowPtr out parameter for this purpose.

[ChangeLog][Platform Specific Changes][Windows] Fixed frameMargins for
WM_NCCALCSIZE when handled inside with QAbstractNativeEventFilter.

Change-Id: I7827b81d30a5c80dad591206a88712169dea0108
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-02 12:54:38 +00:00
Allan Sandfeld Jensen
d160809015 Cleanup rgb32 text-blending code path
Cleans up the rgb32 text-blending functions, so they now follow the
new pattern used in the new generic text-blending functions. This
also means they can now handle gamma-corrected blending on top of
transparent destination pixels instead of falling back to naive
blending.

Task-number: QTBUG-60469
Change-Id: I154ba513ff99c0cefab8fa12f4ed43fcd6563a6a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-05-02 12:52:35 +00:00
Pier Luigi Fiorini
3792ab804d eglfs_kms: Decode EDID blob
Retrieve and parse EDID blob.
Return screen product information from EDID.

[ChangeLog][QPA][eglfs][kms] Add screen product information from EDID.

Change-Id: I766999afd9298e82f6147fdeba5d14757bfb4b03
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-05-02 12:07:05 +00:00
Andy Shaw
7eae7e8103 macOS: Fix return value of PM_TabBarBaseHeight to original value
When the tabbar styling was improved in change
175f33ed85 it changed
PM_TabBarBaseHeight to 21 which is incorrect as this value represents
the spacing between the tab pages and the tabbar. In macOS style
there is no space so this should be set to 0.

Task-number: QTBUG-60307
Change-Id: I2ce39ff2fc924d2d83843fab78b311153b4ee08f
Reviewed-by: Oleg Yadrov <oleg.yadrov@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-05-02 10:23:01 +00:00
Pier Luigi Fiorini
5f7ab88055 EDID parser library
Add a support library to parse EDID that will be used by platform
plugins.

In order to tell the screen manufacturer from the identifier, the
parsers reads /usr/share/hwdata/pnp.ids or, if it's missing, uses
a lookup table previously generated from that file with a Python script.

Change-Id: Ie021eb68be91f06dc0da54445f88e3533f78d23e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-05-02 09:11:56 +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
Gabriel de Dietrich
68df0576dd QMacStyle: Increase accuracy of PM_TitleBarHeight
In some cases, we'd want such value to come from the
platform theme, but we'd need new API for this.

Change-Id: Ic7053fa17ac8b2f207db031095c4e4aefae000c2
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-02 02:59:25 +00:00
Gabriel de Dietrich
06713ded60 Introducing AA_CompressTabletEvents
Tablet events compression has been missing since commit
60cd1c6775 in 5.6.1, and there's
no way to bring the old behavior back. Since tablet events are
not taken into account by AA_CompressHighFrequencyEvents on
purpose, we introduce this new flag.

This new flag is conditional to AA_CompressHighFrequencyEvents
being set in order for it to be effective.

[ChangeLog][QtCore][Tablet support] If the application attribute
AA_CompressTabletEvents is set in addition to AA_CompressHighFrequencyEvents,
even the QTabletEvents will be compressed (only on the X11 platform so far).
AA_CompressHighFrequencyEvents does not enable compression of tablet events
by itself, because paint applications typically need to process 
all possible tablet events in order to draw the smoothest curves.

Change-Id: Ie7434ab4f9a4c64f2626c75e661cfd0d6cd22896
Task-number: QTBUG-44964
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Reviewed-by: Wayne Arnold <wayne.arnold@autodesk.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-05-01 04:41:27 +00:00
Robin Burchell
5398aaabfc tuiotouch: Finish categorizing all logging
Better than going half way and not quite finishing, and nicer results.

Change-Id: If6bf005182534f6fbfc13544d4190d3e54a272e9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-04-30 23:18:11 +00:00
Marc Mutz
0208cac94f QItemSelectionRange: don't compare pointers with op<
... use std::less<> to avoid undefined behavior.

Change-Id: Ib6736f86359c4a16fd90ca63b57a8517c6137ead
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-04-30 17:23:15 +00:00
Edward Welbourne
a4192166c8 Add two missing hyphens
Change-Id: Ic320c96208fe7f8340c7eb9e9d068813d769056a
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-30 09:51:16 +00:00
Tasuku Suzuki
ea15b170ef Fix warning for -no-feature-lineedit
Change-Id: Ia56d5d7266a379f911e4db61e60b8b39af5b6342
Reviewed-by: Stephan Binner <stephan.binner@basyskom.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-30 07:49:38 +00:00
Tasuku Suzuki
de76ccb967 Fix warnings with -no-feature-menu
Change-Id: I1e62e3772dbd5f17d9ad69025b23e3726386c2bd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Stephan Binner <stephan.binner@basyskom.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-30 07:49:32 +00:00
Tasuku Suzuki
da1079e51c Fix build without features.cupsjobwidget
Change-Id: I1b49a9f63a6a071457a3b9305dc87abe5f3b5b19
Reviewed-by: Stephan Binner <stephan.binner@basyskom.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-30 07:49:06 +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
Thiago Macieira
3c4c02b3f1 Include moc of qnamespace.h in qobject.cpp
Change-Id: I84e363d735b443cb9beefffd14b8bd4b39b00840
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-04-29 02:44:37 +00:00
Jesus Fernandez
dc8933e0aa Initialize vao variable
If vaoHelper is not valid the vao variable was being initializated with
a random value.

Change-Id: I44962841baeb1a1cff3124d6126e19c791feaea3
Coverity-Id: 171484
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-04-28 20:03:06 +00:00
Aaron Linville
5995238f29 Doc: Fix references to QIconEngineV2 and QIconEnginePluginV2
Fix a few lingering doc references to the old classes.

Task-number: QTBUG-59815
Change-Id: Ia6b406485260c943b018422aaeb8e22ca4406e81
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2017-04-28 20:02:48 +00:00
Gatis Paeglis
fad814088c do not wrap QAbstractEventDispatcher::flush with QT_DEPRECATED_SINCE
... as this would require us to remove usage of QAbstractEventDispatcher::flush
from Qt source code as well. We can not do this already in Qt 5.9 as there are
few event dispatchers in Qt that actually do override the ::flush (with non empty
bodies). Removing this code could result in behavior changes (not very likely) for
some user code. This method will be removed in Qt6.

Instead mark it with a well known "### Qt{Version}" comment.

This patch amends 41eefd7. The warning was:

qcoreapplication.cpp: In static member function ‘static void QCoreApplication::flush()’:
qcoreapplication.cpp:733:48: warning: ‘virtual void QAbstractEventDispatcher::flush()’ is deprecated [-Wdeprecated-declarations]
         self->d_func()->eventDispatcher->flush();

Change-Id: I48a1c68b84ff93268956205e1205e6d4b5d48664
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-28 17:23:18 +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
Marc Mutz
cac2fc81b7 Long live qStartsWith()/qEndsWith()!
Following the established pattern of implementing non-mutating string
algorithms as free functions over views with a public qFoo() and a
static qt_foo() split, add qStartsWith() and qEndsWith(), calling the
existing qt_{starts,ends}_with_impl() templates.

[ChangeLog][QtCore][QStringAlgorithms] Added qStartsWith(),
qEndsWith().

Change-Id: Ic95c2a9c13883a99f1a96319083fb249f20de5f1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-28 16:41:08 +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
63b94c5772 Export QPlatformThemeFactory, for use in qtdiag
Change-Id: I0e1a09998253489388abfffd14b5ee5392b0ce52
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-04-28 12:37:14 +00:00
Tasuku Suzuki
179fe5981f Fix build without features.networkproxy
Change-Id: Ie0868b2d2ec30513e870861514b252a79dff4998
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-04-28 12:33:17 +00:00
Gatis Paeglis
5106d496f3 wrap QCoreApplication::flush with QT_DEPRECATED_SINCE
... in cpp file as well.

This patch amends 41eefd7.

Change-Id: Id6a4dfd3a93a600fe3bb84bb74379451ad167aa8
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-28 08:40:48 +00:00
Tasuku Suzuki
9b8a7de794 Fix build without features.style-stylesheet
Change-Id: Ib7cf5db6c9a49e7f359410bc0ec3d1ceadcde5cf
Reviewed-by: Stephan Binner <stephan.binner@basyskom.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-04-28 08:10:49 +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
Thiago Macieira
851b39a6d6 Update detection of $DESKTOP_SESSION
I don't know how widespread this use is, but apparently sddm seems to
set DESKTOP_SESSION to be the .desktop file that it used to launch the
session (minus the .desktop extension). In that case, we should read the
DesktopName entry from the file to get the actual desktop type.

And since the desktop detection from QGenericUnixServices should
suffice, we don't need to repeat the same code in QGenericUnixThemes.

Change-Id: I0e1a09998253489388abfffd14b5eeefbd7fe740
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
2017-04-27 22:35:06 +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
Jesus Fernandez
0803285fe7 Fix resource leak
CID 178811 (#1 of 1): Resource leak (RESOURCE_LEAK)
25. leaked_storage: Variable dptr going out of scope leaks the storage it points to.

Change-Id: I3354fe46cfb08701f387f65aaaa5c4f235079501
Coverity-Id: 178811
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-27 16:40:17 +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
Tasuku Suzuki
a9e0879ee1 Fix build without features.shortcut
Change-Id: I87a7ba1a77b0671559616a3ea4722bcc233af32d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-04-27 15:38:31 +00:00
Thiago Macieira
c1e19a2ecb QSysInfo: Make use of the QT_WARNING_DISABLE_DEPRECATED macro
We have it for a reason.

Change-Id: I84e363d735b443cb9beefffd14b8f355aeb8a31c
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-04-27 15:27:25 +00:00
Laszlo Agocs
9a640e7bc6 eglfs_kms_egldevice: Fix type mess in nativeDisplay() virtual
EGLNativeDisplayType is void* on NVIDIA systems but the backend may get compiled
on others where it is something else. The function definition does not match
the proto on these so it is time to correct this.

Change-Id: I569d9f8f3fcba7b2a4672d83606dfdc7bb18a1f0
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
2017-04-27 13:19:32 +00:00
Palo Kisa
bf21f71b43 qhttpthreaddelegate: Fix build with -no-ssl after @70d8460fc20
Just fixing the typo -> misplaced #ifndef guard.

Change-Id: Ib3b0ceb615f45291cb64a0ed6c7f3a370dc506bf
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-04-27 09:31:27 +00:00
Friedemann Kleint
affb6700a4 Windows QPA: Move system tray icon implementation into the plugin
The system tray icon implementation relied on QMenu. After
the introduction of QPlatformSystemTrayIcon::contextMenuRequested(),
the code can be moved into the plugin, making use of native menus
when enabled or falling back to QMenu.
This enables the SystemTrayIcon QML Type to work.

[ChangeLog][QtGui][Windows] A native system tray icon is now
available for SystemTrayIcon.

Change-Id: I0fdbfb5cbb815c1ea6fb19305a9bceb9c5bcc034
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-04-27 09:30:41 +00:00
Friedemann Kleint
7849aa6e96 Windows QPA: Add native menus
Add simple Win32-API based menus (not owner-drawn).

Native menus are implemented using Win32 API and are simpler than
QMenu-based menus in for example that they do allow for placing widgets on
them or changing properties like fonts and do not provide hover signals.
They are mainly intended for Qt Quick. By default, they will be used if the
application is not an instance of QApplication or for Qt Quick Controls
2 applications.

In addition, the command line option -platform windows:menus=native
will unconditionally activate them and -platform windows:menus=no
turns them off.

[ChangeLog][QtGui][Windows] Native menus have been implemented.

Task-number: QTBUG-55967
Change-Id: I439a7d949745debea3eb0e5789cf42288a0d526f
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-04-27 09:30:34 +00:00
Friedemann Kleint
121a30ccef QPlatformSystemTrayIcon: Add signal contextMenuRequested()
Add a signal passing the global position of the context menu.
For platforms that do not provide native menus, QSystemTrayIcon
will show a QMenu based menu.

Change-Id: I799e4a84ca38e00ea33f3c842ea4ca43ecb8c83f
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-04-27 09:30:27 +00:00
Oliver Wolff
11e37a0e8c winrt: Use list initialization for KeyInfo's members
Change-Id: Idd05d1e1332efd9afc9816a48437fee377730735
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-04-27 07:00:17 +00:00
Oliver Wolff
eb77a24faa winrt: Fix text value for key release events
The text member was never filled and thus was not set in onKeyUp.

Change-Id: I0d0094745c385e0942635da643d863868b010c2a
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-04-27 07:00:16 +00:00
Oliver Wolff
4bfb464570 winrt: Remove wrong parameter from handleExtendedKeyEvent call
The event's count parameter is used to determine the number of keys
involved in the key event, not the repeat count of the key press.

The desktop windows implementation does not pass the "count" parameter,
so we omit it as well.

The tryShortcutOverride parameter is only used on macOS and thus can be
omitted as well.

Change-Id: Id7554e43cc73ec616f68444e82a38418e622e20a
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-04-27 07:00:15 +00:00
Marc Mutz
940b36850d QLocaleData: remove unused bool *overflow arguments
... from bytearrayToDouble() and bytearrayToLongLong()
(bytearrayToUnsLongLong() didn't have one).

The only user, QIntValidator, always checked them in conjunction with
'ok'. Since 'overflow' was true only if 'ok' was false, too, there's
no point in carrying both.

We can bring this code back with QParsedNumber, when it will not cost
anything anymore. I actually was hoping that the overflow argument
would inform the design of QParsedNumber, but it turned out to be
unused, leading to this commit instead.

Change-Id: I841d0d1cc36c13c5425ac0338323721d90b3b24c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-27 04:35:30 +00:00
Marc Mutz
629422607f QCompletionEngine: avoid a node allocation on lookup
In matchHint() and lookupCache(), instead of checking for the
existence of 'parent' in 'cache', a new entry was created, if
needed.

However, the remainders of the functions could only fail in
that case, so don't allocate an empty map node here at all.
Wherever something sensible is added to the cache, there will
have to be an insertion of the same node anyway, so there's
no point doing that work here.

Allows to mark these functions const.

Also passed the QString argument by const-reference instead
of by value.

Done-with: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Change-Id: Ia873f246869a68eecaef83ce4a6b6369187456be
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-04-27 04:35:25 +00:00
Dyami Caliri
32f8cbae90 QOpenGLWidget: Fix UB (invalid cast) in ~QOpenGLWidgetPrivate
The QOpenGLWidgetPrivate destructor calls reset(), which accesses
the Q-pointer. Calling Q_Q(Class) while still inside the private
class's destructor is wrong due to the cast in q_func() which is
undefined behavior at that stage.

Here is the UB report:
qopenglwidget.cpp:548:5: runtime error: downcast of address 0x000016d0e200 which does not point to an object of type 'QOpenGLWidget'
0x000016d0e200: note: object is of type 'QObject'
 00 00 00 00  10 30 32 0f 00 00 00 00  40 e2 d0 16 00 00 00 00  80 7b 42 0f 00 00 00 00  00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'QObject'

0     QOpenGLWidgetPrivate::reset    qopenglwidget.cpp    656    0x607e667
1     QOpenGLWidgetPrivate::~QOpenGLWidgetPrivate    qopenglwidget.cpp    570    0x60982ab
2     QOpenGLWidgetPrivate::~QOpenGLWidgetPrivate    qopenglwidget.cpp    569    0x6098516
3     QScopedPointerDeleter<QObjectData>::cleanup    qscopedpointer.h    54    0xcbf7058
4     QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>>::~QScopedPointer    qscopedpointer.h    101    0xcbde858
5     QObject::~QObject    qobject.cpp    1042    0xcb94792
6     QWidget::~QWidget    qwidget.cpp    1701    0x5e173f7
7     QOpenGLWidget::~QOpenGLWidget    qopenglwidget.cpp    946    0x608d72b
8     ImagePreviewComponent::~ImagePreviewComponent    imagepreviewcomponent.h    16    0x58237b6
9     ImagePreviewComponent::~ImagePreviewComponent    imagepreviewcomponent.h    16    0x58238c6

Change-Id: If13932ac657afb9d1358ac82ab911a05e96cfbcd
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-04-27 01:38:48 +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
Timur Pocheptsov
70d8460fc2 QNAM: delay SSL initialization
It's really unfortunate that even a plain 'http' request results in
(Open)SSL initialization; this is apparently done by QSslConfiguration's
default constructor and we have several classes including QSslConfiguration
as a data-member.

There are different problems reported because of this, from crashes
(a broken OpenSSL on Windows) to long initialization times, which is
not acceptable if no 'https' request was actually executed.

This patch-set is replacing data-members of type QSslConfiguration
with smart-pointers and delays (Open)SSL initialization.

Task-number: QTBUG-59750
Change-Id: Id1d375e689dbd2d134abbb0572a9e804d595110e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-04-26 19:00:47 +00:00
Shawn Rutledge
6107f63f93 QXcbConnection::xi2ReportTabletEvent: use fixed1616ToReal
This should not change the result since fixed1616ToReal also divides
by 65536.  It's just to make it consistent with the other places that
we use fixed1616ToReal.

Change-Id: I96b3a07d1cbc98d7bdbe7a3b6035b196e34a5abc
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2017-04-26 18:57:57 +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
Thiago Macieira
8e6a17f687 Fix unused private fields in dbusmenu and dbustray
qdbusplatformmenu_p.h:131:9: error: private field 'm_reserved' is not used [-Werror,-Wunused-private-field]
qdbusplatformmenu_p.h:192:10: error: private field 'm_isSeparator' is not used [-Werror,-Wunused-private-field]
etc.

Change-Id: I84e363d735b443cb9beefffd14b8bc4253081145
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-04-26 13:11:39 +00:00
Thiago Macieira
6ac33c4841 Fix warnings about unused private fields we can't remove
These are in public classes, so we can't remove them until we get to
Qt 6.

qtimer.h:231:20: warning: private field 'del' is not used [-Wunused-private-field]

Change-Id: I84e363d735b443cb9beefffd14b8b5fb720c9e41
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-04-26 13:07:01 +00:00
Thiago Macieira
bd52bff35d Fix Clang build: it does not have __attribute__((optimize(x)))
Change-Id: I84e363d735b443cb9beefffd14b8b5f3885b84d6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-04-26 13:06:46 +00:00
Thiago Macieira
ac9103fd85 Fix ICC build with Q_FALLTHROUGH
ICC 17 does not yet implement C++17 [[fallthrough]] nor does it support
GCC's __attribute__((fallthrough))

Change-Id: I84e363d735b443cb9beefffd14b8aba60a7e3f81
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-04-26 12:53:36 +00:00
Timur Pocheptsov
2d2dd85766 QSslSocket (SecureTransport) - use anchors only from QSslConfiguration
Calling SecTrustSetAnchorCertificatesOnly(trust, false) we actually extend
what our user provided in QSslConfiguration as CA certificates (caCertificates,
setCaCertificates) - Secure Transport will also use a default set provided
by the system and SSL handshake can surprisingly (for a user) succeed.
And the default content of these caCertificates, if not altered by setCaCertificates
call - are those system CA certificates.

Task-number: QTBUG-60233
Change-Id: I8c1094bb7eec260f5202a47085f9f75e720eda7b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-04-26 12:42:40 +00:00
Marc Mutz
9763b324fd Port internal qt_starts/ends_with to QStringView
... and add a version taking a QChar needle.

Back the implementation with a template function.

Mark the slightly surprising behavior that

   null.startsWith(empty) == false

but

   null.startsWith(null)  == true

even though empty == null, for review come Qt 6.

Saves 0.5KiB in text size on optimized GCC 7.0 Linux AMD64 builds.

Change-Id: I2576472d22ccf22ec89911eaed25188f9f7b654f
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-26 09:13:07 +00:00
Marc Mutz
e8085de216 QString: add internal qt_compare_strings(QL1S, QSV)
... and adapt qCompareString(QLatin1String, QStringView) to call it
instead of performing the negation itself.

This function will be needed for QLatin1String::startsWith(QStringView).

Change-Id: I8f19dfe0c5274a80c88b43d05f9efda8a91eac46
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-26 09:12:05 +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
Tasuku Suzuki
36553f8efe Fix warning for -no-feature-evdev
Change-Id: I95af276a6d21e67a980cce1d8c6e41900ece7f31
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-04-26 09:09:22 +00:00
Vyacheslav Koscheev
5d61c0882c Android: add logging to QtCore JNI_OnLoad
Change-Id: I15609d14ac39f89bcba72df33d33a25ac23ad516
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2017-04-26 07:28:46 +00:00
Giuseppe D'Angelo
5677b70eee QThread: terminate on exceptions leaving run()
Align ourselves to the Standard Library and call std::terminate if an
exception leaves the thread entry point (that is, run()).

On platforms using pthreads, thread cancellation needs to be taken in
special consideration, since it looks like it was supported before.

On Glibc, and when using C++, pthread_cancel and pthread_exit are
implemented by throwing a special kind of exception that can be caught,
but must always be rethrown. That exception is then used to activate the
cancellation clean-up handlers. (This is non-Standard C++ behavior.)

So: mimic what libstdc++'s std::thread does to support Glibc's pthread
cancellation.

At this time, it looks like libc++ has no support for this, and when
used in combination with Glibc a thread cancellation results in a crash
(also because it does not seem to terminate() when exceptions leave the
thread).

[ChangeLog][QtCore][QThread] An exception escaping from QThread::run()
will now result in immediate and abnormal program termination. The same
applies if an exception leaves a slot connected directly to the
QThread::started() or QThread::finished() signals.

Change-Id: I73cc93cf06c57018e149a578cc9d4cd0d6fc00ef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-26 06:25:44 +00:00
Ulf Hermann
40fdc4f44c Check for qApp before using it in ibus plugin
We might call updatePreeditText from the QCoreApplication dtor by
running an event loop from inside a "post routine" added with
qAddPostRoutine().

Task-number: QTBUG-60000
Change-Id: I04c08fe36bfa63ac345a06e50952d2ec83a78ac0
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2017-04-25 16:51:32 +00:00
Marc Mutz
164392548e Disentangle string-related headers
It's starting to hinder QStringView development
(QString::append(QStringView), e.g.).

- qbytearray.h includes qstring.h, but is included by qstring.h
  -> remove qstring.h include from qbytearray.h

- the QStringLiteral definition is used from both qstring.h and
  qstringview.h
  -> extract into its own header, move QStringViewLiteral definition
     there, too

- the qCompareStrings(), qConvertTo*() functions are used by QString
  and QStringView
  -> also extract into own header, included from qstring.h and
     qstringview.h

- QStringView::toString() depends on QString, which depends on
  QStringView
  -> move QStringView::toString() definition to qstring.h, after the
     definition of QString
  -> move qstringview.h up to all the other includes in qstring.h

This is starting to look like a DAG again, and allows to remove the
unholy

  #ifndef QSTRING_H
  #  include <qstring.h>
  #endif

hack from qstringview.h.

[ChangeLog][Potentially Source-Incompatible Changes][QByteArray]
qbytearray.h no longer includes qstring.h. In particular, this means
that in order to use QStringBuilder with QByteArray, you need to
include both qbytearray.h and qstring.h now (or <QByteArray> and
<QString>, resp.).

Change-Id: I7f8acf9c11bc1731266cd25c6eda9fb36723f364
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-25 13:47:15 +00:00
Tasuku Suzuki
b6ae2695af Fix warning for -no-feature-multiprocess
Change-Id: Ifa3382098c8f7c2cb1750b7ac5e583ddd71895e2
Reviewed-by: Stephan Binner <stephan.binner@basyskom.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-04-25 09:51:08 +00:00
Tasuku Suzuki
3828022508 Fix warning for -no-feature-cursor
Change-Id: I58a2bd715ff1767571d076a881872bd5eab2caec
Reviewed-by: Stephan Binner <stephan.binner@basyskom.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-04-25 09:50:30 +00:00
Stephan Binner
21db5ebea9 Fix warnings for -no-feature-animation
Change-Id: I624e68e96d2a673b36d9519d1189fe4a25e1fbd0
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-04-25 09:50:07 +00:00
Shawn Rutledge
fccc831af6 xcb: include keyboard modifiers with every touch event
Task-number: QTBUG-60389
Change-Id: I9bf77dffc39b82993bc66c7c7c26e3fa9778534e
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2017-04-25 08:37:40 +00:00
Paul Olav Tvete
5170ed8efb Don't use eglGetProcAddress() on Android
Android 4.1 has a limitation on how many slots are available
for eglGetProcAddress().

This reverts commit 7e393280e4
("OpenGLES20 direct function call removed") for the Android platform only.

Task-number: QTBUG-60318
Change-Id: I4a7224583e775143021735c037af07a95abbd6bf
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-04-25 08:29:48 +00:00
Marc Mutz
0cfcebb955 QThread: fix headersclean with C++17
GCC's -Wshadow complained about the re-use of 'args' as the parameter
for the lambda.

Fix by renaming it to largs (lambda-args) instead.

Change-Id: Ia9e65b82b98ee56181d754868354988399496eef
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-04-25 08:11:05 +00:00
BogDan Vatra
c76918b2b2 Use gdbserver command from a safe place
Removed support for old QtCreator versions (pre 3.5)

Change-Id: I5ec0e965c09c8a76810144b133af3395e32fddfa
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-04-25 08:07:49 +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
Tor Arne Vestbø
e7222c0a71 Make QT_ASCII_CAST_WARN more informative
Change-Id: I4b9aad9cc2f2605a01635c2760e76fde7023f92f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-24 22:31:36 +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
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
Marc Mutz
bfcc2902a4 QtBase: use new QStaticByteArrayMatcher where applicable
Even for compilers that don't yet support C++14 constexpr,
this should improve performance of searches a lot, if,
indeed, Boyer-Moore still is an optimization over linear
searching at all in these days of hardware prefetchers
and deep CPU pipelines, because the setup cost is only
incurred once. As function-statics, we also don't care
about startup ordering and cost.

It's a pity that the platform that would benefit the most
- Windows - doesn't have constexpr support, yet.

Change-Id: I827df135854fd6fbd6546e248dc37ef0fbaf1792
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2017-04-24 18:51:52 +00:00
Laszlo Agocs
93570810d8 eglfs_kms: Use eglGetPlatformDisplay when available
Task-number: QTBUG-60330
Change-Id: Ibbd74ae00d17fdc6ee9c86e758788dcca15ea4ff
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
2017-04-24 18:13:27 +00:00
Gatis Paeglis
fbb485d4f6 Prevent busy loop in glib event dispatcher
.. when running event loop with QEventLoop::ExcludeUserInputEvents.

In a properly functioning code, g_main_context_iteration is expected
to block until any event source becomes ready to dispatch an event
(or interrupt occurs). Qt provides several custom event sources to
the Glib event loop. The bug (busy loop) was caused by faulty event
source implementation when QEventLoop::ExcludeUserInputEvents is set.
As long as the window system's event queue was not empty, we signaled
to the event dispatcher that there is an event ready to be dispatched.
This results in the dispatcher calling the relevant dispatch function
(which does handle the ExcludeUserInputEvents flag correctly). As we
do not dispatch user events, the window system's event queue never
becomes empty and we enter a busy loop (CPU running at 100%) where we
signal that we have events to dispatch, but we actually do not dispatch
them and g_main_context_iteration never gets to block.

This busy loop can cause blocking GTK functions such as gtk_dialog_run()
never return.

Task-number: QTBUG-59760
Task-number: QTBUG-57101
Change-Id: I545b7951108eeaba019614ae8f5a1168c8b26c27
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
2017-04-24 18:11:13 +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
Kai Koehne
c2cac34e94 gradle: Complete qt_attribution.json file
Add it to the qtcore documentation, but mark it as a tool (code does
not get shipped with customer application).

Change-Id: I75cc199a2bbd86f9e40a75396144645ea69a7bd1
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-04-24 12:51:47 +00:00
Jesus Fernandez
87f9a44ef0 Fix QSqlRelationDelegate when using quotation marks
Strip the quotes from the field name in QSqlRelationalDelegate
implementation to able to find the field in the dictionary.

Task-number: QTBUG-59137
Change-Id: I2f1dc9ce3b9c91ca6cc3d3b82e61e1456c3b22c7
Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-24 12:23:50 +00:00
Morten Johan Sørvig
8bc36c773f Cocoa: Send correct mouse buttons for tablets
Tablet vendors allow user configurable pen buttons
where the user may assign a logical mouse button to
a given physical button.

In the case of Wacom tablets this mapping is not reflected
in the buttonMask API, which returns the state of
the physical buttons.

Use NSEvent buttonNummber instead, which returns the
logical button number, after applying user mappings.
Unifiy button state stacking with the mouse handlers.

Handle a special case where buttonNumber returns 0
for tablet right mouse presses. We get these events
via rightMouse* event handlers and can hardcode the
button number.

Change-Id: I06b9b1aa98c49b84f7e3871e694c22c7ad0169d6
Task-number: QTBUG-57487
Task-number: QTBUG-54160
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-04-24 09:19:31 +00:00
Giuseppe D'Angelo
711e94916a QOffscreenSurface: fix blunder
7be9653f12 added a new constructor
taking the parent QObject. However, it broke code building an object
and passing 1 parameter to the constructor (the call is now ambiguous).
Disambiguate.

Task-number: QTBUG-60342
Change-Id: I3a36f01ebb52c7aaa4c4cdf5e2c5f37c1255bc8a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-23 20:21:20 +00:00
Joerg Bornemann
bdaa1aaf9e Fix casts and null pointer style in QProcessPrivate::startProcess
Using C++ casts fixes clang warnings, and using nullptr indicates
what's a pointer and what's a flag.

Change-Id: I17c44689f42b9af2c5ff1d9a7e3781a2243f257f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-04-23 18:10:57 +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
Olivier Goffart
2eee24702b Fix UB in QSplitter::childEvent
The widget might be in the QObject destructor when the event is received,
so we can't static cast.
There is no need to check for isWindow for ChildRemoved because it would
not otherwise be on our list.

Change-Id: Ifc0a2979f1f6720f1963399276a28ac4a3224fff
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-04-23 10:11:14 +00:00
Olivier Goffart
88b6abcebf Fix UB in QStandardItemModel
The destructor of QStandardItem needs to access the model. So we need to
destroy them before the QStrandardItemModel gets destroyed.
In the destructor of the private, it is already too late because we are
already in the ~QObject

Since the destructor of QStandardItemPrivate is now empty, remove it
completely. There is no need for QStandardItemPrivate to have a virtual
table as there are no class that inherit from it.

Change-Id: Id6639e21f277f1c4e85c3f9bc720b4f29eb16c2c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-23 10:11:01 +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
Laszlo Agocs
23287dfb15 Update qopenglext.h
Change-Id: Ifb1d20855f0c0b9459d7ff2e01fbda1f713bff35
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-22 11:05:49 +00:00
Laszlo Agocs
01902c2343 Update qopengles2ext.h
Change-Id: I03b867133a00ef6e662a05d5eac7a733747fb8be
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-22 11:05:43 +00:00
Marc Mutz
3cb4bbfc26 QPixmap/X11: fix compilation with C++17
C++11 deprecated 'register' as a storage specifier, and C++17 removes
it.

Fixes GCC 7.0 warning-turned-error:

  nativepainting/qpixmap_x11.cpp:2013:25: error: ISO C++1z does not allow ‘register’ storage class specifier [-Werror=register]

Amends 07942adb77.

Change-Id: Ideb674d903e5e6eb5ae92cfc3979ff59b243520c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-04-22 06:04:08 +00:00
Marc Mutz
a611a9f537 QCOMPARE: allow mixed-type comparisons
There's no reason to restrict the LHS and the RHS to the same type
like it was done before. That just leads to lots of casting. or use
of QVERIFY(. == .) instead of QCOMPARE, with all the disadvantages
like no printing of the LHS and RHS values.

The rationale given in the documentation for this behavior is
incorrect. Ensuring that RHS and LHS have the same type by no means
ensures that no implicit conversions take place when calling
operator==. Proof:

   QCOMPARE(QLatin1Char('a'), QLatin1Char('a'));
   // instantiates
   qCompare<QLatin1Char, QLatin1Char>
   // but calls
   operator==(QChar, QChar)

If the intent is to disable implicit conversions of the argument
types, then some serious metaprogramming magic would be needed, along
the following lines:

1. find out which op== overload is actually chosen
2. find that overload's RHS parameter type, assert it's the same as
   (possibly cv-qualified) T1.
3. ditto for the LHS parameter type and T2

This is not attempted here.

Fix the inconvenience this restriction caused by simply allowing
two types.

This cannot break existing code, since we didn't actually change
anything in the qCompare() overload set. All we do is implement the
existing qCompare<T1, T2>() overload.

[ChangeLog][QtTest] QCOMPARE can now be used for mixed-type
comparisons.

Change-Id: I0413dbd3689809852413eaca22827257f1527720
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-21 19:58:51 +00:00
Morten Johan Sørvig
b113107419 QMacStyle: Fix scroller memory leak
Calling initWithFrame repeatedly on the same object
leaks memory since internal structures allocated on
the previous init call will not be released.

However, initWithFrame is the only API that can set
scroller direction, which is does based on the geometry.

Use two scroller objets, one for each of the horizontal
and vertical cases.

Task-number: QTBUG-60004
Change-Id: I5d07b62e6969a1824ab705941ac4d0340139b99c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-04-21 16:52:36 +00:00
Gabriel de Dietrich
5cde07350c QMacStyle: Properly flip vertical sliders
Cocoa is better than us at vertically flipping views,
so we use that API instead of fiddling with the graphics
context transforms. But only so from 10.12 onwards. Go
figure.

This also fixes a one pixel offset with horizontal sliders
handle on non-retina displays.

Change-Id: Ia3da8431ad0499a4b6fb7bf6973ed353d91c2905
Task-number: QTBUG-59666
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-04-21 16:52:22 +00:00
Tor Arne Vestbø
031e0f4364 macOS: Fix crash when closing windows with raster backingstore
After 5b78fcd03b the raster backingstore tries to use the platform window
to resolve the native DPR, but we might not always have a platform window.

Instead we go though the window, like before, which has fallback paths for
the case of no platform window, and then remove the Qt scaling factor
manually.

Change-Id: I19c8383b0a33f3d97aaf0d0e886ed03e14cb1592
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-04-21 15:12:52 +00:00
Nico Vertriest
4a46a7cf50 Doc: correct \sa statement
qnetworkreply.cpp:307: warning: Can't link to 'QNetworkRequest::UserVerifiedRedirectsPolicy'

Change-Id: Ic96f834f3ca9984f626833e45e69f6322b83d12d
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-04-21 15:10:02 +00:00
Friedemann Kleint
3f135dbcb9 Docs: Fix some warnings
qtbase/src/corelib/tools/qbytearray.cpp:3043: warning: Can't link to '.'
qtbase/src/corelib/tools/qstring.cpp:4522: warning: Can't link to '.'
qtbase/src/corelib/tools/qstring.cpp:10331: warning: Can't link to '.'
qtbase/src/network/access/qhstspolicy.cpp:105: warning: Undocumented parameter 'flags' in QHstsPolicy::QHstsPolicy()
qtbase/src/network/access/qhstspolicy.cpp:105: warning: No such parameter 'includeSubDomains' in QHstsPolicy::QHstsPolicy()
qtbase/src/network/access/qnetworkaccessmanager.cpp:732: warning: Undocumented parameter 'knownHosts' in QNetworkAccessManager::addStrictTransportSecurityHosts()
qtbase/src/network/access/qnetworkreply.cpp:307: warning: Can't link to 'QNetworkRequest::UserVerifiedRedirectsPolicy'
qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: No such enum item 'PdfFormat_1_4' in QPagedPaintDevice::PdfVersion
qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: Undocumented enum item 'PdfVersion_1_4' in QPagedPaintDevice::PdfVersion
qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: Undocumented enum item 'PdfVersion_A1b' in QPagedPaintDevice::PdfVersion
qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: No such enum item 'PdfFormat_A1b' in QPagedPaintDevice::PdfVersion
qtbase/src/widgets/kernel/qopenglwidget.cpp:1076: warning: Undocumented parameter 'texFormat' in QOpenGLWidget::setTextureFormat()
qtbase/src/corelib/tools/qversionnumber.cpp:460: warning: Command '\snippet (//! [3-latin1-1])' failed at end of file 'qversionnumber/main.cpp'

Change-Id: Icc163dd8d94cee7e0858040bf8241a3c1f1d221d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-04-21 12:47:06 +00:00
Giuseppe D'Angelo
759af3e5ad Centralize the check that the floating point implementation follows IEEE754
C++ does not specify which kind of floating point implementation is
being used. The C Standard doesn't either, but it includes a normative
reference for implementations adoping it (ISO/IEC 9899:2011 Annex F).

There are a few existing checks in qfloat16.cpp; move them to qglobal.cpp
(next to the other, similar checks), and improve them by actually
checking that the radix used for floating point numbers is 2.

Change-Id: I704a3a8efeb51014b3be23fb236654d647a6f44f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-21 11:01:58 +00:00
Louai Al-Khanji
07942adb77 xcb: Add experimental legacy support for native X11 painting
This commit revives the old native QPixmap and QPaintEngine
implementations that were present in Qt4. The backing store supports
regular raster windows in this commit. Support for render-to-texture
widgets and OpenGL compositing will be added in a follow-up commit.

Change-Id: I80a9c4f0c42a6f68f571dfee930d95000d5dd950
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-21 10:56:02 +00:00
Tor Arne Vestbø
84b3f12310 macOS: Defer population of localized font family aliases until needed
Getting the localized family name of a font involves quite a bit of work
internally in CoreText, e.g. creating and sorting font descriptors.

By deferring population of family aliases until a font match misses
we shave off ~1 second of startup time for applications that use non-
localized font families (most applications).

Change-Id: I021952c311c0d70d7769ccf764dbf997ebf30a4b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-04-21 10:36:00 +00:00
Tor Arne Vestbø
414c751c7d Fall back to QWindow's screen when resolving DPR instead of using qApp
QGuiApplication::devicePixelRatio() should only be used when we don't
know which window we're targeting. For QWindow::devicePixelRatio(),
we can go though the associated screen to get a more accurate DPR.

Change-Id: Idf511fa5c09562a6daf391cd4d0b8b99471045e7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-04-21 10:32:47 +00:00
Giuseppe D'Angelo
7be9653f12 QOffscreenSurface: add a constructor taking a parent object
Just like all QObject subclasses. Use a delegating constructor
call to share the code from the existing constructor.

Change-Id: Ia3c893ccc4c94883e61337f8952d80b665c17fbf
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-21 10:23:30 +00:00
Nico Vertriest
b4c8455eeb Doc: correct incorrect syntax \li command
qstringbuilder.cpp:75: warning: Command '\li' outside of '\list' and '\table'

Change-Id: I2353462cfd14a4f7cf60d5064ecb069155d1cd34
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-04-21 10:17:22 +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
Stephan Binner
45104dff04 Remove wrong features.rubberband condition of features.itemviews
Change-Id: I0eff127baba2f8677ae08bb18ef0b4bb742d7b6e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-21 06:53:46 +00:00
Stephan Binner
72b3fa702a Remove features.rubberband dependency of features.splitter
Change-Id: Ia55850f37f9384c8e00cef699fa308a02af64fd5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-21 05:47:02 +00:00
Stephan Binner
38bedf34c9 Remove wrong features.rubberband condition of features.dockwidget
Change-Id: I8259274e7eba7943eb3a944a18fa8b598eb697d7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-21 05:46:59 +00:00
Marc Mutz
6ac4f2ccef QStringView: mark as primitive type
Every bit pattern of a QStringView is a Partially-Formed Object, and
QStringViews are trivially copyable. That's what Q_PRIMITIVE_TYPE
means, even if the docs are still talking about valid instead of
partially-formed objects.

Change-Id: I79d4f79fbab0ec2608620e88b6593e26686af304
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-21 05:00:54 +00:00
Joni Poikelin
903a59042e Fix QComboBox popup from opening on wrong screen
Nothing seems to be telling the popup on which screen it should be shown
on. To fix this, simply set same screen the QComboBox uses to the popup.

Task-number: QTBUG-58392
Change-Id: If62a26fe4e51bcf3d770ee72c9baa998541618f4
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-04-21 04:40:11 +00:00
Tasuku Suzuki
2a41e05fde Fix build without features.xlib
Change-Id: I5c95540ba0deb8a1688d8994522324552f2432e2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2017-04-21 02:59:52 +00:00
Friedemann Kleint
81ad753861 QStyleHints: Make showShortcutsInContextMenus a Q_PROPERTY
Fixing qdoc warnings:
qtbase/src/gui/kernel/qstylehints.cpp:367: warning: Cannot find 'QStyleHints::showShortcutsInContextMenus' specified with '\property' in any header file
qtbase/src/gui/kernel/qstylehints.cpp:378: warning: No documentation for 'QStyleHints::showShortcutsInContextMenus()'

Amends change c2c3452ba5.

Task-number: QTBUG-49435
Change-Id: I2db52f013c0fc46c80a1200667c19d63a2c9c0c4
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-04-20 19:23:54 +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
7291a24416 QErrorMessage: use QStringBuilder
Extract Method msgType2i18nString() and use it to build 'rich' in a
single QStringBuilder expression.

Replace the switch over QtMsgType with an array of QT_TRANSLATE_NOOP'ed
strings. That introduces a dependency on the order and amount of enum
values, so add static and dynamic asserts to catch any change.

Saves memory allocations, as well as nearly 300B in text size on GCC 7
optimized Linux AMD64 builds.

Change-Id: I48cc916cba283e482a90ca4ae28aa17b26a4e5ab
Reviewed-by: David Faure <david.faure@kdab.com>
2017-04-20 18:09:10 +00:00
Marc Mutz
dc8bfab82e Use list-initialization more
Fixes a few ugly code pieces I added over the years.

Change-Id: I5c06b73e858add04ea184120c6df71720baf9be3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-04-20 17:02:59 +00:00
Marc Mutz
c38a1b4bb9 QDateTime: replace home-grown version of qToStringViewIgnoringNull with the real thing
Change-Id: Ie71ed4f5c9a2bd0b14818f0f3cff4f88c2100546
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-20 17:02:55 +00:00
Marc Mutz
f73dbbaa3b QStringView: fix position of Q_REQUIRED_RESULT macros
... to be compatible with the C++17 [[nodiscard]].

Change-Id: I60fb9b9077e8c59a03a212c73d4e6c814cc0357d
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-20 17:02:48 +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
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
Laszlo Agocs
c3bd694c18 Fix typo in QRasterPlatformPixmap::metric()
Task-number: QTBUG-60132
Change-Id: I1f0ad7babf16800d3acdf579db6abd6854e1ed76
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-04-20 08:53:24 +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
Thiago Macieira
3dcc075f4a Move Q_REQUIRED_RESULT to its correct position
That's before the return type or static, inline, constexpr or such
keywords (if any).

Perl Script:
s/^(\s+)(.*) Q_REQUIRED_RESULT(;)?(\s*\/\/.*)?$/\1Q_REQUIRED_RESULT \2\3\4/

Change-Id: I7814054a102a407d876ffffd14b6a16182f159e2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-04-20 05:40:59 +00:00
Thiago Macieira
870964895b Don't disable Q_REQUIRED_RESULT with Clang and ICC
They're not affected by the GCC bug noted in the comment.

Change-Id: I7814054a102a407d876ffffd14b69e8a8e2527f1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-04-20 05:40:27 +00:00
Thiago Macieira
47c9b66a8b Disable precompiled headers for small modules
Creating a precompiled header exclusively for a one- or two-file module
is wasteful. The time that it takes to build the precompiled source is
on the same order as a regular compilation, so enabling precompiled
headers for those modules just makes the build slower.

Also make it possible to override the precompiled header by just setting
PRECOMPILED_HEADER to empty.

Change-Id: I0e1a09998253489388abfffd14b5f221288c4826
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-04-20 05:39:47 +00:00
Giuseppe D'Angelo
e70e8dd6a9 qgrayraster: use a cast to void to mark a variable as unused
Do not use a self-assignment, as that may trigger compiler warnings.

Casting to void is also what Q_UNUSED is doing these days, but we can't
use it here because qgrayraster.c does not include qglobal.h.

Remove a 15-years old comment related to the self assignment.

Found by clazy.

Change-Id: I8cc92b7a1b0b5fb13824959740243e17606ec753
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-20 04:44:24 +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
Olivier Goffart
97850b952c Fix UB in QWidgetEffectSourcePrivate::detach
Delete the QGraphicsEffect from the QWidget destructor instead of from
the QWidgetPrivate destructor. The destructor of QGraphicsEffect still
access methods of the QWidget, but the QObjectPrivate being destroyed
from ~QObject, the pointer is no longer a QWidget.

Fix warning with UB sanitizer in tst_QWidget::setGraphicsEffect

qwidget_p.h:900:23: runtime error: member call on address 0x000001d822c0 which does not point to an object of type 'QWidget'
0x000001d822c0: note: object is of type 'QObject'
 00 00 00 00  b0 46 5f 40 e5 7f 00 00  00 23 d8 01 00 00 00 00  f0 e6 00 44 e5 7f 00 00  00 00 74 47
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'QObject'
    #0 0x7fe54767db76 in QWidgetEffectSourcePrivate::detach()
    #1 0x7fe548f29815 in QGraphicsEffect::~QGraphicsEffect()
    #2 0x7fe548f2a1b7 in QGraphicsBlurEffect::~QGraphicsBlurEffect()
    #3 0x7fe548f2a208 in QGraphicsBlurEffect::~QGraphicsBlurEffect()
    #4 0x7fe5475cd463 in QWidgetPrivate::~QWidgetPrivate()
    #5 0x7fe5475ce62c in QWidgetPrivate::~QWidgetPrivate()
    #6 0x7fe5400d0dda in QObject::~QObject()
    #7 0x7fe54763d411 in QWidget::~QWidget()
    #8 0x7fe54763d7f4 in QWidget::~QWidget()
    #9 0x4cc309 in QScopedPointerDeleter<QWidget>::cleanup(QWidget*)
    #10 0x4cc309 in QScopedPointer<QWidget, QScopedPointerDeleter<QWidget> >::reset(QWidget*)
    #11 0x4cc309 in tst_QWidget::setGraphicsEffect()

Change-Id: I19c049e979cfce2adda908af8336cb4adac8f6c4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-19 13:25:19 +00:00
Olivier Goffart
cdb7e81572 Fix UB in QLayout::childEvent
We can't just static_cast a child to QLayout, because the child might
not be a QLayout, and even if it was, we might be called from the
QObject destructor so we would not be a layout anymore.
Instead we can just qobject_cast the deleted object to a QLayout and
remove it from the layout with removeItem.
This would not take in account the case where we would be called because
the QLayout gets destroyed, so we handle this case from ~QLayout by
removing ourself from the parent.

Note that the comment in ~QLayout was wrong, as the layout gets destroyed
explicitly from ~QWidget, not from ~QObject.

Change-Id: I49c6f17a76f207b9d750b6e5d987469498b96b31
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-19 13:25:14 +00:00
Tor Arne Vestbø
f368cd8868 macOS: Initialize window geometry early on, instead of when creating NSWindow
We don't need to defer to NSWindow creation before determining the initial
window geometry, and we don't need to redetermine each time we re-create
an NSWindow for a QCocoaWindow.

Change-Id: Ie13380830b44e96670ff16513f29deef5f5ae313
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-04-19 12:50:46 +00:00
Marc Mutz
58d2927861 QXmlStream: optimize PrivateTagStack::addToStringStorage()
De-duplicate the QString/Ref code paths by using QStringView instead.
Keep the old overloads so we can centrally apply the qToStringView-
IgnoringNull() optimization.

Replace insert(p, ..) where p = size() with append(..). The code
ensures in the lines before that the insertion position is the end of
the string.

Port the few QLatin1String arguments to addToStringStorage() to
QStringViewLiteral. I also considered adding a QLatin1String()
overload, but the test size increased, so the function wasn't pulling
its own weight.

This version saves 360B in text size on optimized GCC 6.1 Linux AMD64
builds.

Change-Id: I4b759fddc38b1f97a7218954e756cc19400922e9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-19 12:31:50 +00:00
Marc Mutz
e9fd074cec Use qToStringViewIgnoringNull() where applicable
Saves just over ¼KiB in QtCore text size on optimized GCC 6.1 Linux
AMD64 builds, iow: qToStringViewIgnoringNull() saves ~40B per use.

Change-Id: I3278306d5ce594e8ccd0f58b8f8d0319637d1b2b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-19 12:31:40 +00:00
Marc Mutz
ba5db13c8d QStringView: add internal qToStringViewIgnoringNull()
As long as a null QString still returns non-null data(), QStringView's
QString constructor needs to call isNull(). That's a branch we often
can do without, so add an internal function that bypasses this
correctness check.

It's internal, since we might have a Q6String that returns nullptr
data() when null, which will remove the need for this function.

What the QStringView(QString) ctor does will also have to be
re-evaluated come Qt 6, but for now, keep the public QString-
QStringView conversion correct.

Change-Id: I35dc7383bc3bd018f46aeec429185135a38ddcef
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-19 12:31:33 +00:00
Nico Vertriest
30d825f5f2 Doc: Fix link errors
qimage.cpp:2127: warning: Can't link to 'isDetached()'
qmatrix4x4.cpp:1933: warning: Can't link to 'operator()()'

Change-Id: I93a2ead9650faf139040173f8d3b24cfa1e730ae
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-04-19 12:27:01 +00:00
Marc Mutz
b3e66c76aa QUuid: de-duplicate uuid → string formatting
The code was duplicated for QChar and char characters. Keep only the
char version, and use QString::fromLatin1() to convert to QString.

This does not perform more allocations. It just copies 38 bytes more
than before.

Saves 788B in text size on optimized GCC 6.1 Linux AMD64 builds.

Change-Id: I1a65c8128eb2097e11527961618d54ea362e1b80
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-19 11:07:11 +00:00
Oliver Wolff
32b92b9e21 winrt: Fix keyboard modifier states
CoreWindow::GetAsyncKeyState returns flags and not enums so checking
equality does not give the needed result.

As seen in qwindowskeymapper.cpp key events that only contain a modifier
key should not have the key itself as a modifier when calling
handleExtendedKeyEvent.

With the current approach the modifier states are the same as
on desktop Windows.

Task-number: QTBUG-58750
Change-Id: Ie0f3e1d3e8294e1a6b41c9223a7a5153306579f6
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-04-19 10:27:35 +00:00
Oliver Wolff
ad0249cc79 winrt: Fix QKeyEvent::isAutoRepeat
CorePhysicalKeyStatus::KeyStatus does not give the information we are
after so we have to keep track of "auto repeat" state of the keys
ourself.

Task-number: QTBUG-59232
Change-Id: I22aa185780e5fa1f7f3c23c2deb2a0dde0c4a582
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-04-19 10:27:32 +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
Samuel Gaist
d5cecfe8fd Migrate Windows QPA backend to use QRegularExpression
This patch updates the Windows QPA backend code to use QRegularExpression
in place of the deprecated QRegExp.

Change-Id: Ib45c374578bed5b9f2771df1ca04cc09cab6e7c9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-04-19 09:25:12 +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
Timur Pocheptsov
254f35ce98 QNetworkReplyHttpImpl - check 'isOpen' twice
A signal emitted after the first 'isOpen' check on QNetworkReply can
trigger a slot that aborts/closes our reply. So before we can append
any data to reply's buffer, we have to re-check that we're still open.

Task-number: QTBUG-59909
Change-Id: I781d5a4fd5fc30d485af63f45cf36c254378af64
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-04-19 08:13:32 +00:00
Stephan Binner
59d9ee0aa4 Fix build for -no-feature-cssparser
Change-Id: I78b66e8a98458736c69c4955390a98f8889968ea
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-04-19 08:00:39 +00:00
Stephan Binner
b3066656e5 Fix warning for -no-feature-graphicseffect
Change-Id: I0be9e4293dfcef3c144f4e998ea071336c4d56d3
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-04-19 08:00:26 +00:00
Stephan Binner
45f7d35f7b Fix warning for -no-feature-gestures
Change-Id: Iaadc4e27ee2a75a8c053de4438ef74daaa48ee64
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-04-19 08:00:16 +00:00
Stephan Binner
dde83fdeeb Fix warnings for -no-feature-texthtmlparser
Change-Id: Ie757e4ecb9ced14bd809f56d2d3d09274fc3bc39
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-04-19 08:00:06 +00:00
Rainer Keller
b549a3550c eglfs: Adopt changed function signature in QtGlesStream library
Change-Id: I80fb7e403073fd264e0878d7c638812027282ad8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-04-19 07:28:05 +00:00
Rainer Keller
f9aaf0e6d5 eglfs: Use description property as screen name
Change-Id: I2322ffcb28c646b289ee718b9c3946bc0a44bd3c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-04-19 07:27:33 +00:00
Friedemann Kleint
2381332b0d Doc: Hide QPA classes
Mark QPlatformGraphicsBuffer and QSystemTrayIcon as internal.

Change-Id: I39e5b4f635fca21ab0544cd840a113514b6b1e99
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-04-19 07:25:05 +00:00
Friedemann Kleint
c5dafb177f Add debug output for QScrollPrepareEvent and QScrollEvent
Change-Id: If283cecbefdf20c80ce00f689003f6a0ed9fe42b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-04-19 06:29:50 +00:00
Giuseppe D'Angelo
2d504c6709 QJsonValue: implement copy-assignment via copy-and-swap
Now we have a swap() member, remove the comment.
Amends bbb440bab2.

Change-Id: I3640d544bbd0927109460d843252c8e5f0aefaf5
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-19 06:19:27 +00:00
Giuseppe D'Angelo
8a375341cf QJson*: value semantics cleanup
Re-add the move operations, add a swap(), mark as shared
(we're already using them in containers).

QJsonValue is slightly tricky, because it has an anonymous union,
which can't be easily moved in C++. Use the implementation of
the copy constructor as inspiration for the move.

[ChangeLog][QtCore][JSON] QJsonArray, QJsonDocument, QJsonObject
and QJsonValue now have move operations and a swap() member function.

Change-Id: Idfb94a93370ace96100efbd6559ef05b4c5adc39
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-19 04:50:26 +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
Albert Astals Cid
6462f299ed Make platform menu tag/setTag not be pure virtual
Reasons:
 * Tag means nothing to the platform, tag is something
   the Qt side code will store and then restore, but it's meaningless
   for the platform, since it can be either the pointer to an
   action (qmenu.cpp) or an item count (qcombobox.cpp)
 * Since it's meaningless to the platform you don't know what
   to do when trying to implement a platform, this shows in how
   the field was being initialized, some initialized to this,
   some initialized to 0

On a followup commit we will remove the virtual tag but first
need to fix up other QPAs that don't live in the main repo

Change-Id: I15ac83f3bf7e4c741153d31ac761dbbe6f4b1b52
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-04-18 14:31:52 +00:00
Nico Vertriest
fc2f0fb390 Doc: add missing doc for parameters
qhstspolicy.cpp:105: warning: Undocumented parameter 'flags' in QHstsPolicy::QHstsPolicy()
qhstspolicy.cpp:105: warning: No such parameter 'includeSubDomains' in QHstsPolicy::QHstsPolicy()
qnetworkaccessmanager.cpp:732: warning: Undocumented parameter 'knownHosts' in QNetworkAccessManager::addStrictTransportSecurityHosts()

Change-Id: I24217d328df12febab30e19e2abd351e87007959
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-04-18 14:18:36 +00:00
Friedemann Kleint
8b62673d9f QGraphicsDropShadowEffect: Fix for high DPI scaling
Preserve the device pixel ratio.

Task-number: QTBUG-60026
Change-Id: Ie818c582fe2c7b11ceb347b39cfbf7ea49361021
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-04-18 13:08:43 +00:00
Leena Miettinen
84fb8c5ec9 Doc: Remove broken link to QWindowSystemInterface::registerTouchDevice()
Mention that it is a private function. Also mention using
QTest::createTouchDevice() for adding simulated touch screens
to autotests.

Task-number: QTBUG-26647
Change-Id: I08c12225768e76b1b9e3fc0fda00af86d44ca766
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Bo Thorsen <bo@vikingsoft.eu>
Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>
2017-04-18 12:57:45 +00:00
Edward Welbourne
df252fc205 Tidy up QDateTimeParser in assorted petty ways
A bit-field was necessarily equal to either zero or its (single-bit)
mask; so comparing to the mask was superfluous.

A local value set and then conditionally over-ridden could easily be
made const by using the condition in a ?: assignment.

A use of qMin() lent itself to turning into a simple conditional
assignment.

Change-Id: I541d98044b23b8c51e6169f617a5841ba8fffc55
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-18 12:56:33 +00:00
Edward Welbourne
e764f34583 QDateTimeParser: simpler return, clearer comment
skipToNextSection() returned via a local temp that served no purpose.
The accompanying comment didn't quite explain what it set out to.

Change-Id: I31581323df374653db9c2558a3bd63409aafb178
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-18 12:56:09 +00:00
Edward Welbourne
5bc814ac69 QDateTimeParser: simplify switch by exploiting fall-through
Several cases all fell together; their code tested away one of them;
so putting it last and falling through to it avoids the need to test.

Change-Id: I0bf555710604a56faa61b60bfe5484d5c5a1ee6b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-18 12:56:01 +00:00
Friedemann Kleint
db2de20c59 QGraphicsColorizeEffect: Fix for high DPI scaling
Preserve the device pixel ratio.

Task-number: QTBUG-60026
Change-Id: I91a1bda6ce4defd064ec7edfcea40ff192a9068f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-04-18 12:27:57 +00:00
Nico Vertriest
f26be29ea8 Doc: add missing specs about parameters
qopengltexture.cpp:3476: warning: Undocumented parameter 'layerCount' in
QOpenGLTexture::setCompressedData() and QOpenGLTexture::setData()
qimage.cpp:2127: warning: Undocumented parameter 'format' in QImage::reinterpretAsFormat()

Change-Id: I17feb2256a29f3bb722d2de3a83b390abff85a35
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-04-18 11:33:21 +00:00
Nico Vertriest
28ea26e574 Doc: rephrase parameter description to avoid qdoc error message
Change-Id: I79d446289b4450d2fcce097cf46d2cf7b6d969da
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-04-18 10:37:50 +00:00
Richard Moe Gustavsen
7243b7cbf2 qmacmime: modernize QMacPasteboardMimeTiff
Since QMacPasteboardMimeTiff was moved out of the cocoa
plugin and into platformsupport, we take the opportunity to
give the code some overhaul as well.

Change-Id: I7d5425d336ba41474698915008b2086e98ea49dc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-04-18 10:19:04 +00:00
Richard Moe Gustavsen
fb8ec15110 darwin: add tiff support to clipboard for all darwin platforms
This will add copy/paste/dnd support for QPixmap and QImage
to all darwin platforms (and not just macOS, as it is today).

Task-number: QTBUG-57428
Change-Id: Iefc876c0a347077322f195b55c49f2c1c4b4a34b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-04-18 10:18:54 +00:00
Marc Mutz
0a807c2ab6 QStringView: plaster API with Q_REQUIRED_RESULT
There's no reason to use it only on some functions with return values
and not others.

Change-Id: If50a669f49e9e2f71173dea94465a5de58a7783e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-18 09:43:39 +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
Tor Arne Vestbø
46976eea18 Add debug operators for font database structs for easier debugging
Change-Id: Ice1b27ff93de2d369dc6b66c72a64eb05da5639c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-18 09:40:41 +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
Richard Moe Gustavsen
6d3c4833c2 iOS: add support for adding mimetypes other than text on the clipboard
A QVariant can only be converted to a QByteArray if it has user type
QMetaType::QByteArray or QMetaType::QString. The way it stood, we
always tried to convert the mime data to a QByteArray, and
then put the result into a QVariant. This would fail if the mime
data contained e.g a QPixmap.

This patch will inspect what kind of data the QMimeData contains, and
convert it to a QVariant using the expected API.

Task-number: QTBUG-57428
Change-Id: I67054424fe8c45873bab8305e7b44de939aae0fb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-04-18 08:22:38 +00: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
Paul Olav Tvete
bc5454d2c4 Fix build error with -no-feature-slider
Change-Id: Ia74aeefdba3ac6b831aeeaff40600e30d90183d8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-18 06:59:54 +00:00
Thiago Macieira
285789781c icc: thread_local in macOS is working since 10.7
Change-Id: I0e1a09998253489388abfffd14b611b1403a0c9f
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-04-17 16:24:47 +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
Thiago Macieira
34d2fd1497 Fix build with libdrm >= 2.4.78
drmEventContext has grown by one pointer, so the build fails with an
error about a member without initialization.

 qeglfskmsgbmdevice.cpp:147:5: error: missing initializer for member ‘_drmEventContext::page_flip_handler2’ [-Werror=missing-field-initializers]

Change-Id: I0e1a09998253489388abfffd14b6014b1ddc90e1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-17 09:44:11 +00:00
Thiago Macieira
3bea9450e9 Update the Clang support for SIMD code generation
Clang 3.8 has support for __attribute__((target(xxx))) and its SIMD
headers can be included unconditionally.

Change-Id: Ic15b7ff417c8412893e5fffd14b5b42b950b48d7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-04-17 00:04:21 +00:00
Thiago Macieira
2814744a73 Update the Clang usual versions for Apple's build
Change-Id: Id69a70a52573241e1b6a05bd62a3fd01a8e78550
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-04-16 07:39:30 +00:00
Marc Mutz
3064067154 QXmlStream: update qxmlstream.g to match qxmlstream_p.h again
Many changes over the last years didn't update qxmlstream.g:
  ecceaec858
  6f41600422
  9f888d2fde
  59c3670b63
  a7885c9756
  817800ad39
  342c99ff45

These changes are all included now.

Change-Id: I9dd56ec12ae6505edaf8238d48c5a5f78b5e8779
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-15 18:34:49 +00:00
Marc Mutz
19b94f970b QXmlStream: remove more unneeded toString() calls
Some are enabled by the recent addition of QStringView, but some were
wrong already before.

Change-Id: I3f900a80c47011af4c0370e32acb7478404b4867
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-15 18:34:30 +00:00
Thiago Macieira
89c8dd30a1 qfloat16: Fix GCC warning about use of old-style cast
_mm_cvtps_ph is usually defined as a macro:
qfloat16.h:122:37: error: use of old-style cast [-Werror=old-style-cast]

Change-Id: Icd0e0d4b27cb4e5eb892fffd14b516ec47826c0c
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-15 03:33:33 +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
Gabriel de Dietrich
d5d31c64a4 QSplitter::replaceWidget(): Add geometry related remark
The late geometry update on the widget has been confusing
some of our users.

Change-Id: I7f2600322be0a0c54fac3beb42065413a0693f74
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-14 17:06:27 +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
Robin Burchell
571eb37ac9 QAndroidPlatformScreen: Add missing override
Missed in b018a5ecef.

Reported-by: Anton Kudryavtsev <antkudr@mail.ru>
Change-Id: Id833fbd77c571923571e59b0c609b56c69308d90
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2017-04-14 11:30:07 +00:00
Robin Burchell
6bf9972621 QMovie: Add lastError and lastErrorString getters
QMovie has an error signal, but it is not possible for users to
"catch" all errors, for instance, if they occur at construction time, and
furthermore, it may not be convenient to add interception of the signal
just to find out what the error was.

[ChangeLog][QtGui][QMovie] Added lastError and lastErrorString accessors,
as a convenience over connecting to the error() signal.

Change-Id: I9c6ef70694c67986ecd30b5dc1b321c4dfa5c315
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
2017-04-14 09:10:34 +00:00
Robin Burchell
01a4d09ef6 QMovie: Make sure to pass on QImageReader errors when they occur
If a file cannot be opened for some reason (like running out of FDs),
emit the error signal.

Change-Id: I9586dda34b2f2cef73593c6dcb855b29d63c2dbc
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
2017-04-14 09:10:27 +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
Olivier Goffart
4b0d6704d9 DockWidgets: Allow to have floating dockwidgets side by side
Based on what MS VisualStudio can do, allow to have. We can now
drop the QDockWidgets on floating ones so that they are next to eachother

This is activated when QMainWindow::GroupedDragging and
QMainWindow::AllowNestedDocks are both set.

[ChangeLog][QtWidgets][QDockWidget] When QMainWindow::GrouppedDragging
and QMainWindow::AllowNestedDocks are both enabled, floating dock widgets
acquired the ability to be dropped together side by side.

Change-Id: I48765c72ef80ef15aa31b91ae582cbb01dea41d6
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
2017-04-13 17:44:58 +00:00
Olivier Goffart
60be2fb6a1 QMainWindow: move the separator handling in another class
So it will be re-used by QDockWidgetGroupWindow

The Layout template argument can be the QMainWindowLayout,
or the QDockWidgetGroupLayout. They have a function
dockAreaLayoutInfo which return a QDockAreaLayout* or a
QDockAreaLayoutInfo*, respectively. These two class
have the same interface as far as QMainWindowLayoutSeparatorHelper
is concerned. (QDockAreaLayout forward most of its call to
the relevant QDockAreaLayoutInfo)

The code is mostly moved without modification, but there is a change in
startSeparatorMove, because we don't have access to the layoutState to
set the fallbackToSizeHints variable, so instead, we do that from
QMainWindowLayout::hover.

Change-Id: Ic5fa3ee2def3d0155195f751d4770b207732139f
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
2017-04-13 17:44:33 +00:00
Friedemann Kleint
46458ce3ef uic: Port Ui classes to QVector
Regenerate the ui4* files after a change in qttools replacing
QList by QVector in the Dom* classes with the exception of
QList<DomProperty *> since that affects the public interfaces
of QAbstractFormBuilder.

Change-Id: I0922127fb911a5abc125d93ef97a0b22ff94788a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2017-04-13 12:43:00 +00:00
Friedemann Kleint
eca6f5492c Windows QPA: Move initialization of resources out of the Qt namespace
Q_INIT_RESOURCE() should not be within the Qt namespace; the
namespace is appended to the resource function.

Task-number: QTBUG-60118
Change-Id: I05203c3196ccdcffaf27658bcd7f3ec1c25f22d9
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-04-13 12:40:03 +00:00
Jake Petroules
fbcdf6d753 Be more explicit about the supported platforms for OpenGL ES 2
The OpenGLES framework is only supported on iOS and tvOS, and does not
exist on macOS and watchOS.

Change-Id: I643d3bdac522b67a8d945648dfcc8f1780ab0d7f
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-04-13 02:11:12 +00:00
Gabriel de Dietrich
e7443b88fc bootstrap: Remove redundant occurrence of qcore_foundation.mm
Already added in the "mac" clause.

Change-Id: I272882347cb65ef32e5aae7b1eee9f15cede6fcb
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-04-12 23:24:31 +00:00
Samuel Gaist
98e0cb0a28 Doc: updated QSyntaxHighlighter documentation and use QRegularExpression
The documentation of QSyntaxHighlighter still uses the deprecated
QRegExp class. This patch updates the code samples as well as cleanup
some typos.

Change-Id: I87b525fddb560b7c5bb38f96d9aaceadb594f76c
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
2017-04-12 22:09:43 +00:00
Giuseppe D'Angelo
feaaca456b QLocale: do not test for Q_OS_MAC before including qglobal.h
Found by clazy.

Change-Id: I66b6698c309720891db83626e18c5e1baca19091
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-12 18:31:33 +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
Friedemann Kleint
11361f903a qsystemtrayicon_win.cpp: Clean obsolete code
No longer dynamically load API that is present on Windows 7.
Increase the WINVER and related defines locally to keep MinGW 5.3
building. Remove all if clauses checking fore Windows Vista and below.

Task-number: QTBUG-51673
Change-Id: I0feedb95537aea2453d48ef784f7852c4e33347f
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-04-12 11:53:08 +00:00
Giuseppe D'Angelo
9dff809b45 Array-backed containers: add shrink_to_fit for STL compatibility
Side note: QHash has squeeze(), but there's no shrink_to_fit on
std::unordered_map.

[ChangeLog][QtCore][QByteArray] Added shrink_to_fit().

[ChangeLog][QtCore][QString] Added shrink_to_fit().

[ChangeLog][QtCore][QVarLengthArray] Added shrink_to_fit().

[ChangeLog][QtCore][QVector] Added shrink_to_fit().

Change-Id: Ifd7d28c9bed70727be6308f0191a188201784f61
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-12 11:32:18 +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
Marco Trevisan (Treviño)
b727f11c2e QFontconfigDatabase: properly parse desktop environment variable
$XDG_CURRENT_DESKTOP is defined as a colon-separated list of
desktop strings, thus we can't check for equality, but split it
and check if it contains the desktop environments we care about.

Change-Id: Ia9ab0f28654a3e1a68b918794a079f3974f85642
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
2017-04-12 11:11:32 +00:00
Tor Arne Vestbø
7f29367c09 Prevent QWindow transient parent loop
Clients may wrongly set the transient parent to the window itself,
causing endless loop when e.g. looking for the top level parent.

Change-Id: Ib23cae3a5576320435ae9b76dd618d1e5ae08b5d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-04-12 10:00:52 +00:00
Friedemann Kleint
59d4cbca0b QWindowsFontEngineDirectWrite: Fix build with MinGW
In member function 'void tn::QWindowsFontEngineDirectWrite::collectMetrics()':
windows\qwindowsfontenginedirectwrite.cpp:361:22: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if (table.size() >= advanceWidthMaxLocation + sizeof(quint16)) {
                      ^
Amends 17fc188aec.

Task-number: QTBUG-58954
Change-Id: Ice2ff135d411b55d32290069b3c85ca0b5ea09af
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-12 08:32:00 +00:00
Błażej Szczygieł
bdd5a67e65 QtWidgets: Don't open submenus when mouse is moving between actions
Don't set the current action during closing submenu when mouse moved
more than one action in the menu to the top or to the bottom.

Task-number: QTBUG-53215
Change-Id: I2383363bc48f644df046198662dfa4d080fe3f1d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-04-12 07:29:18 +00:00
Marc Mutz
11ed95ac9c Improve QStringBuilder docs
- Mention you can build QByteArrays, too
- Nicer list of types that can be used, separate for QByteArray and
  QString

Change-Id: Ia91445f0cb4872bab12a55f4812c283e9c38dba4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-04-12 06:46:12 +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
e45516ea0d QSysInfo: Bring back suppression of ICC warning #1478
Turns out that different versions of ICC use different warning numbers.
The Linux and Windows compilers emit 1786, but the macOS one emits 1478.
Don't ask me why.

Change-Id: I523b0abacd5148b2bf08fffd14b475a4c4d89ba1
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-04-12 03:37:11 +00:00
Jake Petroules
cd5c8e78c7 QProcess: fix Unix build
This fixes a regression introduced in ff19ebcc

Task-number: QTBUG-60046
Change-Id: I47c357433b25f07011a7a3a64d3150591785b206
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2017-04-11 17:07:19 +00:00
Andy Shaw
1cd8c6f48e Make networkAccessibility() return the actual state of the network
If networkAccessibility() was queried when the networkAccessibleChanged
signal was emitted then it would report the wrong state and in some
instances it would incorrectly report NotAccessible. This ensures that
it is reflecting what the signal would have been emitted with.

Change-Id: Ib0a7ef9e9ec42c9007340020fd535c8ad36caa49
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-04-11 16:31:32 +00:00
Marc Mutz
9c243d2637 QByteArray: add missing inline keywords
Inline member functions that are not defined in the class body must be
marked with the inline keyword. Otherwise, MinGW complains about any
use of such functions before they are defined with its infamous error
message:

  'char QByteArray::at(int) const' redeclared without dllimport attribute after being referenced with dll linkage

Fix it for all such functions.

Change-Id: Iae76a7ed18e7b2d5cb5e217e154f647be4a2d9c1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-04-11 14:59:49 +00:00
Giuseppe D'Angelo
7af5a3a39e QRegularExpression: streamline some wording in the documentation
Change-Id: Ic1adbf9358ef6fbdaaee52471cd8ed9ca895a9d0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2017-04-11 14:50:03 +00:00
Nikita Krupenko
34f46588aa Add button layout for dialogs on Android
It used macOS layout before, but it differs from the actual layout in
Android/Material Design: affirmative actions are on the right side,
dismissive actions are directly to the left of the affirmative actions
and neutral actions are on the left side.

[ChangeLog][Platform-specific Changes][Android] Android dialogs now have
more appropriate button layout, with affirmative actions on the right.

Task-number: QTBUG-58060
Change-Id: I0755f80261410c64cf4f854b7f2a72e2d959db28
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
2017-04-11 14:39:16 +00:00
Tor Arne Vestbø
f9226217d1 macOS: Prevent leaking font data when creating QRawFont from QByteArrays
CTFontCreateWithGraphicsFont has a bug causing it to never release the
graphics font, which cascades down to the data provider never being
released and releaseFontData never being called.

Instead of relying on a callback to release the byte array font data,
we attach the font data to the engine's lifetime. Note that we are
still leaking the CoreFoundation types.

Change-Id: I6eda4212638ccc9439b90e004222272d204c707a
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-04-11 14:30:26 +00:00
Tor Arne Vestbø
31273f079e macOS: Don't marshal app font data via URL when using FreeType font engine
Font descriptors can have attached attributes of any kind, not just pre-
defined constants like kCTFontURLAttribute. We take advantage of this and
attach the font data that was passed into addApplicationFont() to the
font descriptor, so we can read it out directly when later creating an
engine for it. This removes the need to build up a URL to represent the
font data, which also didn't work for the memory-font use-case. The
FreeType font engine now passes the same tst_QFontDatabase tests on
macOS as the native CoreText font engine.

This also fixes the leak caused by CTFontCreateWithGraphicsFont never
releasing the graphics font, resulting in releaseFontData never being
called:

  http://stackoverflow.com/questions/40805382/

We're now cleaning up the font data in releaseHandle, based on the
attribute set on the font descriptor.

Change-Id: Iba15222ec919f989e29fd98b263d9fb182c4d710
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-04-11 14:30:18 +00:00
Robin Burchell
b018a5ecef QAndroidPlatformScreen: Use an event rather than a QTimer
It looks like the origins of this timer may come from QFbScreen. QFbScreen,
however, changed away from a timer in d7068cbe1b.

There are other reasons to avoid a timer in this case, though: a timer may be
pre-empted by application events (like other timers), which may mean a
significant amount of time could pass between starting the timer and pushing the
contents out to the actual screen (in doRedraw).

This has the effect that flush becomes synchronous, which matches the
behavior of the other platforms as far as I can tell.

Change-Id: Ic67ae6c82945a247dceac44ee1bf7d2940f79d07
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2017-04-11 14:26:16 +00:00
Rolf Eike Beer
6ef07e0902 Qt5DBusMacros: remove intermediate variable
This has been there probably forever, likely from the time when the code
was derived from upstream CMake. Since this is just copying one variable
to another and the latter has a wrong name (_qt4_*) just drop it.

Change-Id: Ica74f3bc9a6b0a6669d80cfc0ebafc003f5b908e
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-04-11 14:07:29 +00:00
Gatis Paeglis
e893e657e5 configure: fix detection of xcb extensions
- Properly detect xcb-render and xkb features.
  a) when -qt-xcb, use bundled versions
  b) when -system-xcb, detect from system

- Be consistent with other features (jpeg, png)
  in "enable"/"disable" field handling.

- And move the "xkb" feature higer up in configure.json.
  It is an X11 extension, so keep them all together (instead
  of grouping it with libxkbcommon).

Task-number: QTBUG-59064
Change-Id: I60f95fb37060b8abde4c611cdef178ba3795982c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-04-11 13:23:15 +00:00
Christian Strømme
9091a058bc Android: Fix application state tracking
- Make sure we don't process state changes before the platform plugin
is completely created and registered.
- Protect shared data with mutexes.
- Don't update the application state from different threads.

This was causing issues when testing run-time permission checks, when
the application quickly switches state due to permission dialog being
shown. In this case the states would be incorrectly delivered when the
application was made active again.

Change-Id: I3446eab9414ee5437cd788c27d65f808d1314aa5
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2017-04-11 11:58:02 +00:00
Tor Arne Vestbø
5ad2e1cea1 Populate application fonts via font descriptors on Apple platforms
Instead of registering the font via CTFontManagerRegister we just create
a font descriptor for the data/URL and populate that like normal system
fonts. This makes the code more similar to how we deal with other fonts,
shaves off a ms during font registration due to not registering the font,
and fixes an issue on iOS where CTFontManagerRegister would invalidate
earlier populated system font descriptors.

Task-number: QTBUG-56765
Change-Id: I002a65075b15837c9a2d22573020d4c834111837
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-04-11 09:23:44 +00:00