Commit Graph

25642 Commits

Author SHA1 Message Date
Tor Arne Vestbø
a73de7ce2d iOS: Harden logic for when it's safe to use the graphics hardware
To fix QTBUG-52493 we tied the exposed state of a window to the
application being in the foreground. This has the result of a
visible flash of black between hiding the launch screen and showing
the first frame of the application, as the application is still
waiting for UIApplicationStateActive to begin rendering, which
happens after iOS hides the launch screen.

According to the iOS OpenGL ES Programming Guide, it should be safe
to render GL in UIApplicationStateInactive as well, and even in
UIApplicationStateBackground, as long as the rendering finishes
before the UIApplicationDidEnterBackgroundNotification returns.

To ensure that we catch any bugs in this area, checks have been
added that verify that no rendering happens while in the background
state.

Task-number: QTBUG-63229
Task-number: QTBUG-52493
Task-number: QTBUG-55205
Change-Id: Ib42bedbeddd7479ab0fb5e5b7de9f5805658e111
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-12-07 00:12:42 +00:00
Tor Arne Vestbø
933497bace iOS: Ignore view layouts while in the background
Despite the OpenGL ES Programming Guide telling us to avoid all
use of OpenGL while in the background, iOS will perform its view
snapshotting for the app switcher after the application has been
backgrounded; once for each orientation. Presumably the expectation
is that no rendering needs to be done to provide an alternate
orientation snapshot, just relayouting of views. But in our case,
or any non-stretchable content case such as a OpenGL based game,
this is not true.

Instead of continuing layout, which will send potentially expensive
geometry changes (with isExposed false, since we're in the background),
we short-circuit the snapshotting.

iOS will still use the latest rendered frame to create the application
switcher thumbnail, but it will be based on the last active orientation
of the application.

To ensure that we pick up the right geometry when rotating the device
while the app is in the background, we treat applicationWillEnterForeground
as Qt::ApplicationInactive, which matches the recommendations of the
OpenGL ES Programming Guide to "re-create any objects and restart your
animation timers".

Change-Id: Ia9c27f85f996ecf30284c825b43447aa7099224e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-12-06 20:47:05 +00:00
Tor Arne Vestbø
e37c9d5d5f iOS: Harden application state change logic
Make sure we catch application state changes as early as possible,
and deal properly with any changes delivered before we have an app
to send them to.

Change-Id: I6d0ea0398f9fab88fc182342769b075cb144227f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-12-06 20:46:51 +00:00
Tor Arne Vestbø
77942a1bdf iOS: Try to detect and deal with delayed touch delivery due to gestures
A UIGestureRecognizer may have its delaysTouchesBegan or delaysTouchesEnded
properties set, which causes iOS to not deliver touch events to the view
until the recognizer has failed recognition of its gesture.

In that case, the touch event is not delivered via [UIWindow sendEvent:]
as usual, but via _UIGestureEnvironmentSortAndSendDelayedTouches. The
latter function is apparently not reentrant, as opening a native alert
dialog in response to the touch delivery will result in the dialogs's
buttons to stop working, probably because they themselves use gestures.

Unfortunately iOS maintains two internal gesture recognizers on iPad,
of type _UISystemGestureGateGestureRecognizer, probably related to the
swipe-from-bottom gesture used for multitasking. Without any workaround,
these two recognizers will result in any tap on the bottom part of the
screen to be delivered delayed, which may introduce stuck alert dialogs
as described above.

UITouch has a gestureRecognizers property, but unfortunately this property
does not give us any information in the cases where we need it, so we
have to use an heuristic involving a UIWindow subclass to detect the
case where event delivery is delayed. As there is no way to prevent
the user from recursing into an event loop when delivering the event,
our only hope is to deliver the event asynchronously.

Task-number: QTBUG-64577
Change-Id: I11d9caa8c4542dc80426a9e58ea555914bed433e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-12-06 16:17:18 +00:00
Tor Arne Vestbø
58a409c6dc iOS: Implement QPlatformScreen::name for easier debugging
Change-Id: I077bec93fe2086c38ebe986b322977a50a1ab27d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-12-06 16:17:15 +00:00
Alex Trotsenko
d02a6b938e QAbstractSocket: clear error code to match the error description
Since 5.10, QIODevice resets the error string on opening. So, we should
set the error code to UnknownSocketError accordingly.

Change-Id: I0dd314788ffc182d6837f9d06b51e41d6de59d7e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-12-06 11:09:01 +00:00
Eric Lemanissier
b08c195264 fixup oversight in QStringView::lengthHelperPointer
amends 3b61cd6ad7

Change-Id: I3afa008299b8fcccae8943e545b536a68b17bd1a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-12-06 07:04:31 +00:00
Liang Qi
3d175cd541 Merge "Merge remote-tracking branch 'origin/5.9' into 5.10" into refs/staging/5.10 2017-12-05 21:59:30 +00:00
Andy Shaw
87efdd8c7f Android: Reserve space for the QVarLengthArray, so we can use append
When the QVarLengthArray was initialized with a size then append would
add to the end of that. Therefore we need to use reserve to get the
desired effect.

Task-number: QTBUG-64905
Change-Id: Ia1ebeb26cd31bc5e92bd7f81079506a266b845bf
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2017-12-05 17:07:39 +00:00
Thiago Macieira
138d34b9c8 QFileSystemEngine: Work around Android bug in rejecting hardlinks
Android Marshmellow intentionally forbids use of hard links. See
 https://code.google.com/archive/p/android-developer-preview/issues/3150

However, instead of using EPERM or another error code that indicates the
hard linking operation itself has a problem but there are no other
problems, Android developers stupidly chose to use EACCES, an errno code
that only indicates permission problems.

In any case, since the call will never succeed, we shouldn't even try.

Task-number: QTBUG-64103
Change-Id: I9e2892cb6c374e93bcb7fffd14fc5d1082bd60a3
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-12-05 15:36:23 +00:00
Dongmei Wang
ff7dbda3b0 xcb_qpa_lib: Fix "undefined reference to `dlsym'" error
Change-Id: I37515542571ef37f4361e72b8db4547ff1e1b86a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-12-05 15:17:49 +00:00
Liang Qi
53b141dceb Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/plugins/platforms/ios/quiview.mm

Change-Id: I88384c70047391c75d9ff166c8d9881ff6751dbf
2017-12-05 13:37:21 +01:00
Friedemann Kleint
77687bc64e QFileSystemModel::index(): Add a list size check
This prevents an out of range assert when monitoring directory
with activity (for example, temp).

Task-number: QTBUG-62841
Change-Id: Id3aa4098e9bbd665c7b17a667516885fa7c7f473
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Martin Rotter <rotter.martinos@gmail.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-12-05 09:05:38 +00:00
Dongmei Wang
b8a6e2b6e8 QColor: write signed 64-bit integer in a platform-independent way
When building Qt 5.6.2 with gcc 4.1.2 on Fedora 8, a compilation error
happened when compiling the code below
QColor::name()
{
...
   case HexArgb:
       return QLatin1Char('#') + QString::number(rgba() | 0x100000000, 16).rightRef(8);
...
}

qtbase/src/gui/painting/qcolor.cpp:527: error: integer constant is too large for ‘long’ type

gcc 4.1.2 was unable to handle 0x100000000. The patch is to use Q_INT64_C to
append "LL" to 0x100000000 to avoid the compilation error.

Change-Id: I000e65a5c897ef2d78fcfe4e212d832eb488a762
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-12-05 07:29:25 +00:00
Friedemann Kleint
2c6c044500 Fix qdoc warnings for 5.10
src/corelib/global/qrandom.cpp:915: warning: Cannot find 'bounded(...)' in '\fn' qreal QRandomGenerator::bounded(qreal highest)
src/corelib/tools/qstring.cpp:774: warning: Command '\snippet (//! [qCompareStrings-QSV-QSV])' failed at end of file 'qstring/main.cpp'
src/corelib/tools/qstring.cpp:5281: warning: Cannot find 'qTrimmed(...)' in '\fn' QStringView qTrimmed(QStringView s)
src/corelib/tools/qstring.cpp:5281: warning: Cannot find 'qTrimmed(...)' in '\fn' QLatin1String qTrimmed(QLatin1String s)
src/corelib/global/qrandom.h:171: warning: No documentation for 'QRandomGenerator::System'
src/corelib/global/qrandom.h:105: warning: No documentation for 'QRandomGenerator::bounded(double highest)'
src/corelib/global/qrandom.h:84: warning: No documentation for 'QRandomGenerator::generate64()'
src/corelib/global/qrandom.h:77: warning: No documentation for 'QRandomGenerator::generate()'
src/corelib/global/qrandom.cpp:799: warning: No such parameter 'sseq' in QRandomGenerator::seed()
src/corelib/global/qrandom.cpp:1096: warning: Can't link to 'operator()()'
src/corelib/tools/qstring.cpp:8982: warning: Can't link to 'qStartsWith()'
src/corelib/tools/qstring.cpp:9203: warning: Can't link to 'qTrimmed()'
src/corelib/tools/qstring.cpp:4798: warning: Can't link to 'qConvertToLatin1()'
src/corelib/tools/qstring.cpp:4825: warning: Can't link to 'qConvertToLocal8Bit()'
src/corelib/tools/qstring.cpp:4928: warning: Can't link to 'qConvertToUcs4()'
src/corelib/tools/qstring.cpp:4884: warning: Can't link to 'qConvertToUtf8()'

Change-Id: I5c7c89b230d3d1de8a679c10833319a470a44e80
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-12-04 18:04:04 +00:00
Gatis Paeglis
bcd0e43eb9 xcb: fix regression with missing XI_PropertyEvent
Wacom stylus proximity detection had stopped working: it was not
detecting which type of tool is in use, so all stylus types
acted as a generic drawing stylus.

Selecting XI_PropertyEvent on a root window fixes the problem.
There is nothing in the XI2 specification that says that this
property would not be supported on non-root windows. Possibly
it is bug in the X server. Anyways, selecting XI_PropertyEvent
on a root window in this case actually is better. Property event
contains a global state information, there is nothing window
specific in it, so there is no need to select it for every native
sub-window.

It is worth noting that XI_HierarchyChanged also seems to work
only when selected on the root window (according to my testing
results). And on XI2 author's blog post about XI_HierarchyChanged
it says [1]:

"These events are sent to all windows, so it doesn't really
matter where you register. The traditional approach is to
register on the root window."

This kind of further confirms that it might be bug in X Server's
implementation.

[1] http://who-t.blogspot.no/2009/06/xi2-recipies-part-2.html

Task-number: QTBUG-64911
Change-Id: I8582675bf835239932e23f4596966dc167495e30
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-12-04 16:20:33 +00:00
Morten Johan Sørvig
29104c85db Cocoa: Disable “Hide” menu item on open popups
Follow native behavior and disable ⌘H and the “Hide”
menu item if there are any open popup windows.

Task-number: QTBUG-58727
Change-Id: Iad38cc5cce29e0081613417c53b154ae0f05857e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-12-04 13:46:46 +00:00
Yulong Bai
c9f68a5858 QFusionStyle: fix the checkbox rendering in HiDPI situation
1. Make the checkbox's box size hidpi scale-able. Making the size
not only anchored to icon size, but also the menuItem's rect height
in empty or too small icon cases.

2. Make the checkmark's pen width in propotion to the box's size
to keep consistent visual effects among different dpi settings

3. Also make the radio button hidpi scale-able.

Task-number: QTBUG-63576
Change-Id: I4369aaa18ee68908a26a118cf04292ee4c3e9847
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-12-04 13:08:35 +00:00
Jan Arve Sæther
0c9e379dd8 Use a custom QAnimationDriver to take control over time
This should reduce flakyness of tests.

Change-Id: I26e0a97f7cd3e7cee2ffb44188300c37578cddd7
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-12-02 19:58:30 +00:00
Friedemann Kleint
22ec92a201 QSettings/QConfFile: Fix reading on NTFS symbolic links
The code checked on QFileInfo::size() whether the file had any content.
The check failed for NTFS symbolic links since QFileInfo::size() returns 0
for them. Workaround by using QFile::size() instead.

Task-number: QTBUG-64121
Change-Id: I303414b5a560d1ed8fbc53d969e53f9e2899ae5c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-12-02 11:01:34 +00:00
Timur Pocheptsov
306c32f50e Fix out of bounds reads in qdnslookup_unix
When the response from res_nquery is too big for the buffer used to receive it
(of size PACKETSZ, a mere 512 bytes), the returned responseLength is the
size of the data that would have been delivered, had there been enough space.
Trying to process all of the data, including what wasn't delivered, leads to
reading past the end of the buffer, which either causes a crash or leads to
rubbish (from the stack) in the resulting QDnsRecords.  Easy to reproduce
using many long TXT records.

Replace the array with a QVarLengthArray; when the response is big, resize()
and retry, so as to actually get all of the data, so that we can process
it all. A follow-up patch will fix the case when even the second call/resize
buffer is not enough and we have to use TCP.

Task-number: QTBUG-64742
Change-Id: I173beb531e11a3828fd9c97f437afc192766035e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-12-01 15:05:41 +00:00
Alexander Volkov
fbda8acc92 QFutureWatcher: Use nullptr as a default value in constructor
... to make user code buildable with gcc [-Werror=zero-as-null-pointer-constant].

Change-Id: I309953acd7154511660302aa9826410276cfe41b
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-12-01 10:15:40 +00:00
Andy Shaw
11a2e0aa2d Cocoa: Ensure menus for a dialog's menubar are validated correctly
Although the items were enabled for a dialog's menubar they were not
appearing as such because Cocoa will query the menu item's target to see
if it has a worksWhenModal selector. Therefore to ensure that the menu
item will be enabled, we need to add this selector to our delegate and
return YES from it when the window for the menubar is the dialog.

Task-number: QTBUG-44584
Change-Id: Ic62dc027d563069d2f5c2b7bf9810184bd76de39
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-12-01 10:11:18 +00:00
Kimmo Ollila
de250dd22c Add EGLFS integration plugin for Qualcomm msm8996au board
Change-Id: I5bed1fd690daa72492e7ec5f24e80198a2592986
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-12-01 10:07:20 +00:00
Kimmo Ollila
f4498db196 Add configure test for INTEGRITY EGLFS openWFD integration plugin
Change-Id: I846f9e555df4f64097b5634707515d45c13a521c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-12-01 10:07:04 +00:00
Eskil Abrahamsen Blomfeldt
153311706c macOS/iOS: Fix garbled text under some conditions
There seems to be an issue in CoreText which may cause an existing
font descriptor to give unreliable results if it refers to one of
the system theme fonts. Since we do not know all function calls
or events that may trigger this bug, the safe route is to always
create fresh font descriptors when creating fonts for these
descriptors. The impact on performance should be small, as Qt has
its own internal caches.

[ChangeLog][macOS/iOS][Text] Fixed an issue where text using
one of the system theme fonts would under certain circumstances
display random glyphs.

Task-number: QTBUG-63476
Change-Id: I9e9b253018c63976345eec1439a6b78de2cab869
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-12-01 07:55:47 +00:00
Friedemann Kleint
673762b02e qwindowsmime.cpp: Fix clazy -Wclazy-container-anti-pattern
qwindowsmime.cpp(1267,10):  warning: allocating an unneeded temporary container [-Wclazy-container-anti-pattern]
qwindowsmime.cpp(1274,14):  warning: allocating an unneeded temporary container [-Wclazy-container-anti-pattern]
qwindowsmime.cpp(1383,10):  warning: allocating an unneeded temporary container [-Wclazy-container-anti-pattern]
qwindowsmime.cpp(1429,16):  warning: allocating an unneeded temporary container [-Wclazy-container-anti-pattern]
qwindowsmime.cpp(1450,20):  warning: allocating an unneeded temporary container [-Wclazy-container-anti-pattern]

Change-Id: I9188a0478b4be0c5c8f064578bbe027e33b67b89
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Reviewed-by: Miguel Costa <miguel.costa@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-12-01 07:27:15 +00:00
Friedemann Kleint
1f1f3a2b88 Fix -Wclazy-qstring-arg in Windows code
plugin\qlibrary_win.cpp(119,55):  warning: Use multi-arg instead [-Wclazy-qstring-arg]
plugin\qlibrary_win.cpp(155,55):  warning: Use multi-arg instead [-Wclazy-qstring-arg]
plugin\qlibrary_win.cpp(168,55):  warning: Use multi-arg instead [-Wclazy-qstring-arg]
socket\qlocalserver_win.cpp(228,61):  warning: Use multi-arg instead [-Wclazy-qstring-arg]

Change-Id: I0feadd3a5cce5ac2ba09630a38b867981d48a391
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-12-01 07:27:13 +00:00
Friedemann Kleint
155f954d99 Fix -Wclazy-connect-not-normalized in Windows code
qwindowsxpstyle.cpp(289,35):  warning: Signature is not normalized. Use void* instead of void * [-Wclazy-connect-not-normalized]
qwindowsxpstyle.cpp(292,35):  warning: Signature is not normalized. Use void* instead of void * [-Wclazy-connect-not-normalized]

Change-Id: I773530452c0837c5066f9174c25ae37e57086e76
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
2017-11-30 20:50:46 +00:00
Laurent Montel
0fe3ff5c51 PrintSupport: modernize connection signal/slot
Change-Id: I6e482cd9503e96cc43ead21122d3690cdb18151c
Reviewed-by: David Faure <david.faure@kdab.com>
2017-11-30 20:40:21 +00:00
Laurent Montel
6a3f41aa46 Printsupport: not necessary to check pointer before to delete it
Change-Id: Ib2a7823224c45b6e9110016b2f5756e1b2fd8f3c
Reviewed-by: David Faure <david.faure@kdab.com>
2017-11-30 20:40:18 +00:00
Laurent Montel
40192995a5 PrintSupport: convert 0 with nullptr (c++11)
Change-Id: I35a8022c78427c9b4d4a9d9941770d22c36c3be8
Reviewed-by: David Faure <david.faure@kdab.com>
2017-11-30 20:40:13 +00:00
Oswald Buddenhagen
26e9a6a514 configure: make *_LIBS_{DEBUG|RELEASE} always work
... and not only when the source explicitly specifies build variants.

Change-Id: Iac6c8fda8f431d5fb50fada8338d1b660ab040d7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-30 20:25:08 +00:00
Oswald Buddenhagen
0f1b8fd2dc work around flex bug
flex emits code using isatty(), but fails to include the required
unistd.h. we can work around it by including the header ourselves.

Task-number: QTBUG-64771
Change-Id: I05313eeb79f7a0e25365dee5f05a0142f87209ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 20:24:39 +00:00
Filipe Azevedo
d80fde62ed Fix broken QNAM::networkAccessible()
When switching on/off multiple time the wifi (mainly, but not only) on
ios/macos the QNAM may wrongly stay on a NotAccessible state while the
configuration is Active.
This change make sure the QNAM::networkAccessible() is correctly
reporting the accessibility.

Task-number: QTBUG-49751
Task-number: QTBUG-58275
Task-number: QTBUG-60366
Change-Id: I238ab32030fbaa8072cce341db8da6bcfc346035
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-11-30 16:03:48 +00:00
Tor Arne Vestbø
1a55c92933 iOS: Compute screen available geometry based on safe area insets
In addition to the (deprecated) applicationFrame property, we
base the available geometry on the root view's safe area, which
also takes into account system-reserved areas on iPhone X, and
the screen's bezel in the case of tvOS.

Change-Id: I252d960a0e486dd0c7e30843f88c0bf5684feb24
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-11-30 15:59:20 +00:00
Friedemann Kleint
dae308d892 qprintengine_win.cpp: Fix -Wclazy-range-loop
qprintengine_win.cpp:1502: warning: Missing reference in range-for with non trivial type (QPrint::InputSlot) [-Wclazy-range-loop]

Change-Id: If6e55c1748e05e32aaa32a16063ba491fe242952
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-11-30 15:22:51 +00:00
J-P Nurmi
50117d738a Android: use a canonical data dir for Qt environment variables
ApplicationInfo.dataDir holds "/data/user/0" (Blackberry PRIV running
Android 6.0.1), which is in fact a soft link to "/data/data". This
directory is used as a prefix for various Qt environment variables,
including QML2_IMPORT_PATH, which in turn is used for resolving QML
type URIs, looking up Qt Quick Controls 2 styles, and so on. The QML
engine is not happy with "/data/data" and "/data/user/0" being wildly
mixed for QML types in the same module. Use the canonical path instead
to avoid such conflicts.

Change-Id: I1fd45736728ee662942d7ef48c3fbc553981c59b
Task-number: QTBUG-64868
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-30 13:49:46 +00:00
Timo Aarnipuro
dc4b4e9949 Build integrityhid support only if it is available
Change-Id: I6e0aa2f74516d4c0a1905b188f195834d395584b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-11-30 12:45:00 +00:00
Edward Welbourne
37c9d6deca Condition QDateTimeParser's time-zone parsing on QT_CONFIG(timezone)
It was missing some #if-ery it needed.

Change-Id: Ibc12f4a9ee35acb64a39a1c7a15d2934b5710dc0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 10:22:30 +00:00
Oliver Wolff
6508fdca1d ANGLE: D3D11: Fix shared handle support detection for WARP when MinGW is used
The MinGW version we support supports IsWindows8OrGreater so that we can
check the windows version properly. As the OpenGL detection falls back
to WARP in case of RDP it was possible, that shared handles were wrongly
stated as supported, which caused crashes in users' code.

Task-number: QTBUG-64657
Change-Id: Iaca2bd169f2764cf6ec68a1d36112a735246b29a
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-11-30 05:23:36 +00:00
Błażej Szczygieł
da50a0b38c xcb: Set executed drop action when drop is outside the application
Task-number: QTBUG-62815
Change-Id: I13ee1a3a7e9515d827d29ada38bc0d396f4800d7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-11-29 23:05:06 +00:00
Tor Arne Vestbø
85eef0e5e0 iOS: Improve logging during application startup
Change-Id: I15c1980d7c532c94b34e612bb781c8ed5bf096a0
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-11-29 23:04:22 +00:00
Robert Szefner
e195620d71 QPSQL: Remove semicolon after Q_DECLARE_SQLDRIVER_PRIVATE
The semicolon is unnecessary and QtCreator warns of it.

Change-Id: I20f803d1ea0136080ff4dc4f7d9863fd8028992e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-11-29 14:13:07 +00:00
James McDonnell
49597a7b58 Correct the vertex used to calculate v1/v2Frac
The NoClip version of the drawTriangle code had the vertices swapped.

Task-number: QTBUG-50845
Change-Id: I731dafee6cc140ea017b3b7d1051a27ad3081aa7
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-11-29 14:04:29 +00:00
Marc Mutz
8f3ad56191 [doc] Document QString{,Ref}::split() behavior with empty 'sep'
We actually test for this already in tst_QString::split().

Change-Id: I35fe8f90900ea9c8e6251facdb3326b9226348d0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-29 13:52:50 +00:00
Tor Arne Vestbø
038e473cfa iOS: Don't treat AppleTV as an iDevice when resolving physical DPI
Change-Id: I07ac92a7b2d8c65b7d70a4f2ed5f96f8f4d99ef0
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-29 12:18:40 +00:00
Tor Arne Vestbø
81908abd5e iOS: Update screen metrics (physical DPI) for the latest set of devices
We were missing some recent iPads, and the iPhone 8 Plus and X.

Change-Id: Ib65644a277a1cbd75ccb360b79b9ac8af935c741
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-29 12:18:28 +00:00
Andy Shaw
a17f892bc5 Correct \since value for QIODevice::skip
Change-Id: I9a2f18263a8bc0a0de8978792dbb1f285acc0ccd
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-11-29 08:44:13 +00:00
Thorbjørn Lund Martsum
fb880bbdff QMenu: Corner case size fix (high DPI + multi screen)
We always need to set the QMenu screen explicit also when
it is about to be shown on the primary screen.
The reason is QWidget::metric (called from style/sizeHint)
may use qApp->devicePixelRatioF() when it does not
know about the topLevelWindow. That may not be the same
value as DPR on primary screen. It can be argued that
it likely is a bug in QWidget::metric, but fixing that
looks to be a somewhat dangerous behavior change.

Task-number: QTBUG-59794
Change-Id: I6ed0e808aa31bee5b77c0e19ce61a77548fdbb38
Reviewed-by: Morten Kristensen <msk@nullpointer.dk>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-11-29 07:31:45 +00:00
Robert Szefner
203fb83803 QSqlQuery: Remove temporary variable in navigation functions
Change-Id: I33836a75e1d2e5663f81a33a195d0cb21760e1f8
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-11-29 06:54:15 +00:00
Joni Poikelin
3acf5d61a1 Fix DB2 plugin building on Linux 64bit
Task-number: QTBUG-59358
Change-Id: I2e7d52b31f354868c8c4435d8cabe3525d22ede2
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-11-29 06:40:37 +00:00
Joni Poikelin
b764c4d0aa Fix unix QPrintDialog initially selected printer
Unix QPrintDialog always set default printer as selected printer even
though something was explicitly requested.

[ChangeLog][QtPrintSupport][QPrintDialog] Properly pre-select explicitly
requested printer on Unix.

Task-number: QTBUG-63933
Change-Id: I6289f759d480b4891f4ddd7ff5aad3ae9ab4bc75
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-11-29 06:40:35 +00:00
Tor Arne Vestbø
e434add2de iOS: Don't set background color when debugging window management
It will fill the view in some cases, obscuring what Qt draws.

Change-Id: I9ca00dddd829a28fb2cb3b009bfd3223f85ef7cb
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-11-29 00:27:12 +00:00
Gabriel de Dietrich
60dfd59a60 gui/configure.json: Make -{system,qt}-xcb force enabling xcb
... just like -xcb does implicitly. Otherwise, failure to detect
system-xcb would silently fall back to -no-xcb despite obviously
contradicting the user's request (-qt-xcb always worked anyway,
as there is no test that can fail).

Change-Id: I6f3145fac0881e7847c4a70547fce206e797a9bb
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-11-28 23:32:43 +00:00
Tor Arne Vestbø
10b5954e22 iOS: Use environment variables for debug flags instead of QObject properties
The former is more idiomatic in Qt, and doesn't require
as much boilerplate to set up.

Change-Id: Idf03af4018611c8eb3b31af90da72f9d85617b2c
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-11-28 23:10:57 +00:00
J-P Nurmi
41667f7f14 Android: fix scrolling using a touch keyboard on Blackberry
This is a follow-up commit to 97eec16e.

Blackberry tries sending touchpad events first, and if not consumed,
it sends synthetic mouse wheel events as a fallback. This makes touch
keyboard scrolling work in native Android ListViews and other views
that do not handle SOURCE_TOUCHPAD motion events. Qt apps, however,
blindly accepted all generic motion events, so synthesized mouse wheel
events were never sent. => Make QtSurface & QtNative accept only those
motions events that are actually handled.

Task-number: QTBUG-51165
Change-Id: Iefbbf1e3e1cc3da86afc4c87c19671cc6c5fa145
Reviewed-by: Kai Uwe Broulik <kde@privat.broulik.de>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2017-11-28 22:21:42 +00:00
Marc Mutz
67391f0a57 Fix aliasing problem in QVector::removeAll()
Since removeAll() takes its argument by cref, if passing a reference
to an element of the container to removeAll(), the element may be
deleted (overwritten) by anyother value, leading to UB.

Add a test that actually happens to fail for me without the patch,
even though that might not be guaranteed (we may invoke UB).

Change-Id: If8c795113aeb515f4a9bdf1e072395b932295667
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-28 21:58:50 +00:00
Tor Arne Vestbø
a0871ad225 iOS: Deliver all QWindowSystemInterface events synchronously
On iOS we want all delivery of events from the system to be handled
synchronously, as that's what the system expects.

We don't need to add a delivery template argument to each function
in QWindowSystemInterface that we want to delivery synchronously;
that's only needed for functions that a platform normally sends
asynch, but in some cases want to delivery synchronously.

For always delivering events synchronously we just need to change
the default delivery method.

The only events affected by this are the screen changes, and
window state change, which were not synchronous before, but
should be. All other events were already synchronous, though
either explicit delivery, of a flush.

Change-Id: Ib20ca342d1c076be0fbcf018c83735a416769cfe
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-28 21:25:23 +00:00
Simon Hausmann
984ad61249 Improve readability of code that uses the Qt signed size type
During the container BoF session at the Qt Contributor Summit 2017 the
name of the signed size type became a subject of discussion in the
context of readability of code using this type and the intention of
using it for all length, size and count properties throughout the entire
framework in future versions of Qt.

This change proposes qsizetype as new name for qssize_t to emphasize the
readability of code over POSIX compatibility, the former being
potentially more relevant than the latter to the majority of users of
Qt.

Change-Id: Idb99cb4a8782703c054fa463a9e5af23a918e7f3
Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch>
Reviewed-by: David Faure <david.faure@kdab.com>
2017-11-28 18:41:40 +00:00
Allan Sandfeld Jensen
8298956eb0 Fix namespaced linux builds
Using "struct statx" as argument type is forward declaration which
then will expect the namespace where it was first encountered.

Change-Id: I2d4ba930bd5b4e264228f2549bd6ef75e5cf3a67
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-28 18:41:28 +00:00
David Faure
275c748ada Fix naming of new property QSortFilterProxyModel::recursiveFiltering
Add "Enabled" to match Qt API naming rules.
+ fix \since tag.

Change-Id: Iaf312648f7385cd7e8d3d101b561fbd4e955df25
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-28 18:41:09 +00:00
Liang Qi
1139be7b30 Merge remote-tracking branch 'origin/5.9' into 5.10
Change-Id: Iede384644c3df5ee01b701806dfdb586dd6bb138
2017-11-28 11:23:35 +01:00
Thiago Macieira
6a9d076e87 QUdpSocket: Work around WSARecvMsg quirk relating to no control block
WSARecvMsg does not return the sender in WSAMSG::name if WSAMSG::Control
isn't set. This makes no sense, so I'm assuming it's an API quirk we
need to work around.

[ChangeLog][QtNetwork][QUdpSocket] Fixed a regression from Qt 5.9.3
caused by an apparent Win32 API quirk we triggered when using
readDatagram(), resulting in an invalid QHostAddress sender address.
receiveDatagram() was not affected.

Task-number: QTBUG-64718
Change-Id: I71488efd29b645f7b228fffd14f9d84cc205c4b3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-11-25 20:50:55 +00:00
Allan Sandfeld Jensen
07fcfb793d Fix regression in painted emoji offset
Factor out translation from the matrix applied on bitmap glyphs,
as that gets applied as position when painted.

Task-number: QTBUG-64313
Change-Id: Iab8d995c00ee02eda0896242903312d837b6d790
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-11-25 13:26:55 +00:00
Tor Arne Vestbø
fa2a653b3b Initialize QLoggingRegistry rules on first use
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: I1861e5366ea980dff2ffa753b137276c77278eee
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-25 10:01:35 +00:00
Thiago Macieira
ea18eec931 Merge "Merge remote-tracking branch 'origin/5.9.3' into 5.9" into refs/staging/5.9 2017-11-25 08:52:40 +00:00
Giuseppe D'Angelo
3587a25238 QFlags: support enum classes in setFlag()
Unary ~ is not defined for enum classes, so we need a cast.

Change-Id: I79d495ebcc24ab960da8dae3be08eb307a9de448
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-24 18:23:34 +00:00
Timur Pocheptsov
655cbb00a0 Handle HostNotFoundError correctly for HTTP/2
When processing host lookup error if-statement only checks the connection
type SPDY, which is not right - it could also be HTTP/2. As a bonus:
QT_NO_SSL conditional inclusion is not needed - HTTP2 can be 'clear text'
and SPDY enumerator is defined even in no-tls build (and is just a
noop here). Also, improve our somewhat cryptic message in 'Should not happen'
else branch - 'cannot dequeu' says nothing about HostNotFoundError.

Task-number: QTBUG-64721
Change-Id: Ib0346b8717c2dbddaffab690298f3cae01e338ea
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-11-24 18:09:47 +00:00
BogDan Vatra
6615f1d16b [android] Fix compile with -warnings-are-errors
Remove unused variable

Change-Id: I64da66da0c17131de6280660576f2789696e86b3
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2017-11-24 12:05:16 +00:00
Shawn Rutledge
b19036ad56 improve QLocale::formattedDataSize docs slightly
Change-Id: I42aaec6d54299d906bf8e2ef1fd696f121b7c2d0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-11-24 11:49:47 +00:00
Thiago Macieira
2aaf575319 Fix the build if st_atimensec is defined
It's a trick used by some C libraries to keep compatibility with BSD
extensions while supporting POSIX.1-2008 API. st_atimensec is defined as
st_atim.tv_nsec, so the code would expand to invalid C++

 In substitution of 'template<class T> typename std::enable_if<((&T::st_atim.tv_nsec), true), long long int>::type{anonymous}::GetFileTimes::atime(const T&, int) [with T = stat]':
 error: invalid use of non-static data member 'stat::st_atim'

Change-Id: I38341f8155354cc4a776fffd14e20f4fc0f6d5bb
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-23 12:51:31 +00:00
Liang Qi
7c4b0aa970 Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/corelib/io/qstandardpaths_win.cpp
	src/plugins/platforms/ios/qioswindow.mm
	src/plugins/platforms/ios/quiview.mm
	tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp

Change-Id: I5deb0a0176a454a9c566e924d074ba60ce04f0bc
2017-11-23 12:52:18 +01:00
Liang Qi
19378fa008 Merge remote-tracking branch 'origin/5.9.3' into 5.9
Change-Id: I9add7e07ff1b6a1cf52f59dbb8319f30e114e5fc
2017-11-23 09:47:49 +01:00
Thiago Macieira
4be50ecafd QTemporaryFile: fix issues with removing a file twice
The assertion in isUnnamedFile() we had was incorrect after the file was
removed, since we cleared the name and possibly reset back to the
template. Since ~QTemporaryFile() calls remove(), this was easy to
trigger if you attempted to remove the temp file and leave
QTemporaryFile like that.

Take this opportunity to add to the docs of setAutoRemove() explaining
the possibility of unnamed files.

#7  0x00007f69bcc2b50e in qt_assert (
    assertion=assertion@entry=0x7f69bcf194a0 "unnamedFile == d_func()->fileEntry.isEmpty()",
    file=file@entry=0x7f69bcf19458 "io/qtemporaryfile.cpp",
    line=line@entry=514) at global/qglobal.cpp:3123
#8  0x00007f69bcd672cf in QTemporaryFileEngine::isUnnamedFile (this=this@entry=0x55cd60644df0)
    at io/qtemporaryfile.cpp:514
#9  0x00007f69bcd683f7 in QTemporaryFileEngine::remove (this=0x55cd60644df0)
    at io/qtemporaryfile.cpp:396
#10 0x00007f69bcd48654 in QFile::remove (this=this@entry=0x7fffb393f7e0)
    at io/qfile.cpp:513
#11 0x00007f69bcd6653b in QTemporaryFile::~QTemporaryFile (this=0x7fffb393f7e0, __in_chrg=<optimized out>)
    at io/qtemporaryfile.cpp:719

Change-Id: I57a1bd6e0c194530b732fffd14f4ed28ca8185b2
Reviewed-by: Andreas Hartmetz <ahartmetz@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-23 05:27:23 +00:00
Peter Wu
110e49c9ce QTimeZonePrivate: prefer /etc/localtime over /etc/timezone
On modern distros (e.g. those using systemd), /etc/localtime is always a
symlink. As that file is actually used by libraries (see tzset(3)),
prefer it over /etc/timezone (which is no longer needed since
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=803144).

This fixes a wrongly reported local timezone when a stale /etc/timezone
file exists. While at it, improve sanity check for localtime symlink.

Change-Id: I8557a58acf21afaeca0d585066304c79a92b5ddb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-11-22 23:34:58 +00:00
Tor Arne Vestbø
eade2255ea Windows: Resolve QStandardPaths config location without qApp instance
Calling QCoreApplication::applicationDirPath() requires an app instance,
but on Windows the implementation just relies on qAppFileName(), which
does not require any instance. As resolving the standard paths could
be needed before QCoreApplication instantiation, e.g. for categorized
logging, we use qAppFileName() directly.

Change-Id: Id882cebd528bcb8e945e73a83f1dc3d599b74d1d
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2017-11-22 21:27:45 +00:00
Tor Arne Vestbø
fb2e795c6e iOS: Take UIWindow bounds into account when making window fullscreen
When an app is in split-view mode, the app can't use the full bounds of
the screen, but should limit its area to that of its UIWindow.

Task-number: QTBUG-48225
Change-Id: Ia66ad6bba24d9d73a8263ad3f65b9dee9b8a1b37
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-22 21:27:43 +00:00
Stephen Kelly
a6d7f38791 QHeaderView: Simplify and fix layoutChange handling
A layoutChange indicates that anything can have moved to anywhere else,
including as a result purely of new items being added. It can also
indicate that items are removed.

The old code here incorrectly assumed that the section count remained
constant over this operation by setting the size of the oldSectionHidden
QBitArray - whose size is the size before the layoutChange operation -
and then calling setBit with model rows numbered after the layoutChange
operation.  As the two are not necessarily the same dimensions, this can
result in asserts from the setBit call.

Simplify the handling of layoutChanged entirely by clearing section
information, and using the QPersistentIndexes which indicate hidden
state to restore that state after re-population.

Task-number: QTBUG-53221
Change-Id: I3cda13e86b51b3029b37b647a48748fb604db252
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2017-11-22 21:24:56 +00:00
Christian Ehrlicher
45a5f28aa4 QTreeView/Fusion style : Draw child indicator correct in RTL-mode
Fusion style did not honor direction option when drawing the child
indicator. This lead to a wrong rendering of QTreeView in right-to-left
mode.

Task-number: QTBUG-63396
Change-Id: I2d5de03d7c831e3caabcc9269617eecb9338f163
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-22 21:24:49 +00:00
Thiago Macieira
d813c66bfc Fix the build when AVX2 is enabled but __F16C__ isn't defined
If -mavx2 is used, __AVX2__ is defined, which enables the F16C code
after commit 280e321e52, but that was
wrong since we aren't allowed to use the F16C intrinsics with either
Clang or GCC (we can only do that with GCC 4.9 and Clang 4.8, and only
with an __attribute__ decoration).

With ICC and MSVC, we are allowed to use the intrinsics, but the
#include was missing.

[ChangeLog][QtCore] Fixed a compilation issue with qfloat16 if AVX2
support is enabled in the compiler. Since all processors that support
AVX2 also support F16C, for GCC and Clang it is recommended to either
add -mf16c to your build or to use the corresponding -march= switch.

Task-number: QTBUG-64529
Change-Id: I84e363d735b443cb9beefffd14b8ac1fd4baa978
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-11-22 17:58:21 +00:00
Kevin Funk
b71b7461b0 CMake: Set SKIP_AUTOMOC/AUTOUIC where needed
Make sure we don't run into warnings for CMake 3.10

Task-number: QTBUG-63442
Change-Id: Ida004705646f0c32fb4bf6006036d80b1f279fd7
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Sebastian Holtermann <sebholt@xwmw.org>
Reviewed-by: Rolf Eike Beer <eb@emlix.com>
2017-11-22 13:51:30 +00:00
Andy Shaw
53f48fceee Start from the first visible item when doing a search
Since the first item in a treeview might be hidden, start from the
first visible item in the view when starting or wrapping round
during a keyboard search.

Task-number: QTBUG-63869
Change-Id: I202bea567c6d4484c3ffaf8a5f9af8ea2e13708d
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2017-11-22 13:49:52 +00:00
Filipe Azevedo
048c380629 Code cleanup in QNAM
The private class already store a QNetworkConfigurationManager
 and networkSessionRequired so it's not need to compute them again
nor to instantiate temporary classes.

Change-Id: I1bbd9439afa70c950ed6ec3e4fc63ddae4a5b259
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-11-22 13:48:43 +00:00
Morten Johan Sørvig
bdf1045b71 Cocoa: Update layer contentsScale on screen change
Failure to do so will result in displaying the layer
contents on a quarter of the window when moving the
window from a 2x screen to a 1x screen.

Task-number: QTBUG-64494
Change-Id: I57ce98025e841549f62d132d4985e727898e6207
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-11-22 08:45:55 +00:00
Topi Reinio
0817e2a81e Doc: Update the list of highlighted examples
Update the list of highlighted examples for modules in qtbase, based on
which examples have been updated to use C++11 features, the new
signal/slot connection syntax, and documentation improvements.

Not all the modules have highlighted examples yet as some of the
work is still ongoing.

Task-number: QTBUG-60641
Change-Id: If28d59c10ca1a30e5db408970f20159434ac94f8
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-11-22 07:39:53 +00:00
Thiago Macieira
1ea0b47c2e QImage: Add the replacement function to byteCount's deprecation msg
Change-Id: I938b024e38bf4aac9154fffd14f903e22b364c0d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-11-22 06:18:19 +00:00
Tor Arne Vestbø
f92aa8e931 iOS: Add logging of window geometry/exposure
Change-Id: I6ffc7cd1dde4fadd3e952deabe9c3a1dbce7884d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-21 23:16:46 +00:00
Tor Arne Vestbø
d8288d2b65 iOS: Make sure FBOs are cleaned up in the right QIOSContext
655687d84d shuffled things around, moving the logic to connect
to the window's destroyed signal from backingFramebufferObjectFor into
makeCurrent. Unfortunately backingFramebufferObjectFor was the one taking
care of recursing into the root context (when shared contexts were in
play), so the end result was that the root context were keeping track
of the FBO, but the leaf context was trying to clean up the FBO.

Task-number: QTBUG-56653
Change-Id: I80ed71a3dedeb7611b2aa7548d94b9fbe0e20763
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-21 23:16:44 +00:00
Tor Arne Vestbø
d3e9b8c728 iOS: Remove forced Qt::AA_ShareOpenGLContexts
Commit 8e70241dcc removed the need for having a global sharecontext
to be able to composit GL and raster content in the backingstore, but
forgot to remove this part of the iOS platform.

Change-Id: I46ffd766729369aff2f8c54799bd033905c9f3dc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-11-21 17:13:46 +00:00
Liang Qi
7e360ccd4e Merge remote-tracking branch 'origin/5.9.3' into 5.10.0
Change-Id: I3224e0b877ec24b587e299083feb793518b0568c
2017-11-21 10:58:21 +01:00
Tor Arne Vestbø
68733e307f qpa: Teach handleApplicationStateChanged about sync/async delivery
Using QWindowSystemInterface::SynchronousDelivery reduces the chance
that we are flushing other events before delivering the application
state change. Those other events may conclude that the application
is still active, while in reality it is not, and do bad things.

Change-Id: I738c162fac22d2cd18de1e080bcd2cda78ec3f77
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-11-20 23:31:46 +00:00
Gabriel de Dietrich
53f7c20cb5 Generic Unix Theme: Don't crash if D-Bus is not running
Change-Id: I215ef25fe943730ba8b1976695a04a4aa86638f1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
2017-11-20 22:22:18 +00:00
Thiago Macieira
4ee85ff7c5 QFileSystemEngine/Linux: fix when qt_lstatx() succeeds
When qt_lstatx() succeeds and the target is not a link, we'd erroneously
mark the file as non-existent during the pass to check qt_statx(). All
flags besides the file's modes were cleared.

This is unit-tested, but only happens on Linux kernels 4.12 or later. It
didn't happen to me because I already had this fix applied as part of a
later change relating to QSystemResult.

Task-number: QTBUG-64514
Change-Id: I938b024e38bf4aac9154fffd14f893506a1ef55b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-20 15:49:53 +00:00
Thiago Macieira
3c7a6a7a58 QRandomGenerator: Enforce the use of 32-bit integers in the engine
std::mt19937 is defined as operating on uint_fast32_t, which is usually
just a 32-bit integer. That's not the case on 64-bit Linux, where it is
actually 64-bit wide, meaning sizeof(std::mt19937) jumps from 2504 to
5000 bytes, with exactly 50% of it filled with zeroes. The seed()
function also needs a large zero-extending loop.

Change-Id: Icaa86fc7b54d4b368c0efffd14efa911e2a40b44
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-20 15:49:36 +00:00
Oswald Buddenhagen
bb3872d609 Merge 5.10 into 5.10.0
Change-Id: Ibfbaa8ef89cf45b87a2c65f1da4a708e5464f259
2017-11-20 13:48:33 +01:00
Nico Vertriest
a78cae73b1 Doc: review Star Delegate Example
- update screenshot
- minor corrections description example

Task-number: QTBUG-60635
Change-Id: I2351160ee9ec0a926fddb122e720c887f851dba5
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-11-20 09:30:58 +00:00
Thiago Macieira
8e387e7fa7 qsimd.cpp: Remove workaround for GCC 4.2
That's long fallen out of support in Qt.

Change-Id: I938b024e38bf4aac9154fffd14f7a603baa24e04
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-11-19 23:27:38 +00:00
Shawn Rutledge
a4113d0c64 qfloat16(float) constructor: explicit cast on aarch64 to avoid warning
The warning was

global/qfloat16.h: In constructor ‘qfloat16::qfloat16(float)’:
global/qfloat16.h:124:18: error: conversion to ‘__fp16’ from ‘float’ may alter its value [-Werror=float-conversion]
     __fp16 f16 = f;
                  ^
cc1plus: all warnings being treated as errors

The warning was added by fb59760381.

Change-Id: I489348c4d5d672bfa5d4db99c837696a2a69a27e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-18 06:58:33 +00:00
Christian Ehrlicher
ba2f3a156e QTreeView: recalculate row heights in hide/showColumn()
When calling QTreeView::hideColumn() the row heights are not
recalculated. This can lead to rows which are unnecessarily high due to
hidden columns may contain large (e.g. multiline) content. The same
applies to showColumn() - there the row might be to small.
Hiding columns directly via QTreeView::header()->hideSection() is not
covered by this patch since QHeaderView has no way to inform about
newly shown/hidden sections.

Task-number: QTBUG-8376
Change-Id: I20b1198e56e403ab8cf649af76e5e2280821dd68
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-17 20:28:34 +00:00
Christian Ehrlicher
5c0a9fc532 QTableView: do not draw grid behind last section
QTableView::paintEvent() drawed the grid lines behind the last section
when the region to repaint contained rects which were completely
behind the last section.
This also lead to unnecessary repaints for cells inside rect.top() to
rect.bottom()

Task-number: QTBUG-60219
Change-Id: I42bb42bea504dfd3c92352ac5c65a43c246a05af
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-17 20:28:25 +00:00
Victor-Andrei Variu
b72b5cd760 Adjust screen scale factor for certain screen configurations
Pixel density reported by the screen is sometimes not precise enough,
so recalculate it: divide px (physical pixels) by dp (device-independent pixels)
for both width and height, and then use the average if it is different
from the one initially reported by the screen

Task-number: QTBUG-62191
Change-Id: Ia2f485c7ce8849db6e7c1d2ac08f5e008aea2ff8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-17 13:53:39 +00:00
Gabriel de Dietrich
4532a9590b QToolBar: Don't crash on macOS with 'minimal' QPA plugin
'minimal' doesn't provide any native interface.

Change-Id: I116c9905977ccc6ededf0c6c41b92b6f785f2875
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-11-17 13:30:26 +00:00
Liang Qi
c4885b21d6 Merge remote-tracking branch 'origin/5.9' into 5.10
Also blacklist tst_QNetworkReply::ioHttpRedirectErrors(too-many-redirects)
on RHEL 6.6 in CI.

 Conflicts:
	tests/auto/network/access/qnetworkreply/BLACKLIST
	tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp

Task-number: QTBUG-64569
Change-Id: I7514fc0660c18fd3a3e1d0d0af3f15d879e3c6f4
2017-11-17 08:59:14 +01:00
Eirik Aavitsland
77ee9bd1d3 QPixmap without QGuiApplication: do not crash, terminate gracefully
Any attempt to create a non-null QPixmap in a QCoreApplication-based
app would give a hard crash without a warning. This commit adds a
check and instead calls qFatal with an explanatory message.

This was originally fixed in Qt 4 (ref. QTBUG-17873) but that was lost
in the migration to Qt 5.

Note that this fix still allows null QPixmaps to be created under
QCoreApplication, since that has worked in all Qt 5 versions.

Task-number: QTBUG-53572
Task-number: QTBUG-64125
Change-Id: I60ae29b90f1bd3663aeed2ce88dc1690fe66552c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-16 20:59:14 +00:00
Alex Trotsenko
2caebf42a7 QIODevice: do not clear error string on close
Keeping a description of the last device error is a more informative to
the user than forcing the string to 'Unknown error'.

Change-Id: Ie98fe1c94f24279fb633ce950bbe16450b0efdbd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-11-16 19:52:18 +00:00
Morten Johan Sørvig
12aa501752 macOS: Fix OpenGL context sharing
See code comments for problem and fix description.

Task-number: QTBUG-63180
Change-Id: I6c6381f2c77c246bd975f66f9baa0165e32de777
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-11-16 08:21:13 +00:00
BogDan Vatra
4d8ae444c2 No debugging and extra env & params processing on sealed packages
A "sealed" package is a *release build and signed* Qt for Android package
with no debugging capabilities.
By default sealed packages have no debugging capabilities, but the user
can force debugging capabilities also on a sealed package. This is useful
in corner cases when the user really needs to debug a sealed package.

Change-Id: I840526092556067f2659facf1525861bbabe0edd
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-11-16 05:15:28 +00:00
Mikkel Krautz
55f8d7dfe5 qsslsocket_mac: handle 'OrLater' SslProtocols in verifySessionProtocol()
The verifySessionProtocol() method in the SecureTransport backend did not
properly handle TlsV1_0OrLater, TlsV1_1OrLater and TlsV1_2OrLater.

This commit teaches verifySessionProtocol() about them.
It also adds TlsV1_0OrLater, TlsV1_1OrLater and TlsV1_2OrLater to the
protocolServerSide() test in tst_qsslsocket.

Backport from 5.10 to 5.9 (LTS).

Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 9c765522d1)
Change-Id: I58c53bdf43e0f19b4506f3696d793f657eb4dc6f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-11-15 21:06:49 +00:00
Timur Pocheptsov
7c334301bd HTTP/2 - fix header processing
httpReply->setHeaderField does not simply append (name|value) pairs,
it first erases all entries with the same name. This is quite
wrong when we have _several_ 'Set-Cookie' headers, for example.
Found while trying to login into a facebook account :)

Task-number: QTBUG-64359
Change-Id: I51416ca3ba3d92b9414e4649e493d9cd88f6d9a0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-11-15 21:06:29 +00:00
Gabriel de Dietrich
c1780b9322 QMacStyle: De-HITheme item views headers and a couple arrows
This one is all manual. The arrows were manual before and the
header sections are now plain rectangles. Removes one usage
of HIThemeDrawButton and related logic together with a cached
pixmap and its rendering.

Still broken in some places, but not worse than before. In
particular, sunken or selected header sections will not render
the left hand side section separator properly. Look can be
improved in the header label with different shades for the
selected or current rows/columns.

Change-Id: I6b1c1f529909341bbf72e82e5a3fc61905c75fa8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-15 19:05:30 +00:00
Gabriel de Dietrich
67e3d19239 QMacStyle: Render tool button even when a11y is missing
Tool buttons were being skipped a couple cases (CE_ToolButtonLabel
and CC_ToolButton) when accessibility was disabled. Although unlikely
anyone would disable accessibility on macOS, we fall back to the non-
toolbar rendering if that were to be the case.

Change-Id: Ie8ee11475efbe4b418c34842317bafeba80c3c57
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-15 19:05:21 +00:00
Gabriel de Dietrich
1939cb0210 QMacStyle: Make backingStoreNSView mutable
Even thought the resolve function is effectively not const,
it's more straightforward to call.

Change-Id: I7c881183862c3c0b326daf001b2f9e569153ee76
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-15 19:05:15 +00:00
Gabriel de Dietrich
9af0601fd9 QMacStyle: Replace HITheme info structs with QMSP::CocoaControl
This is not yet a full replacement, but a scaffolding stage until
we can remove all traces of HITheme info structs.

Change-Id: I10eb6a60662c6b102bc687e335d0d1bedd6a4a12
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-15 19:05:06 +00:00
Gabriel de Dietrich
dbc1c79043 QMacStyle: Remove unused code
Change-Id: I6e71871b19ce12daddd4cfbbe7c1d9beede13a9b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-15 19:04:52 +00:00
Gabriel de Dietrich
d7dce54ba0 QMacStyle: Rename Cocoa controls enum names
For easier sorting and grouping by actual Cocoa NSControl class.

We also shorten the names and move the types inside QMacStylePrivate.

Change-Id: Iac093fd359da66abd263aca841b870ea84337f50
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-15 19:04:46 +00:00
Gabriel de Dietrich
2698627653 QMenu: Refactor insertion of action in QPA menu
First, remove a bit of code duplication around the creation of
the platform menu item. Then, we move copyActionToPlatformItem()
inside QMenuPrivate to get rid of one parameter.

Change-Id: I5a33103566367f2313930479844365e79773d82f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-15 19:04:32 +00:00
Błażej Szczygieł
c8a5f331c8 QMenu: Update menu action sizes if popup is (not)caused from menu bar
Menu width differs if it contains key shortcuts or not.

Amends 6634c424f8

Task-number: QTBUG-49435
Task-number: QTBUG-61181
Task-number: QTBUG-64449
Change-Id: I8c479af550128069ca91dd089dfc7bd8c24c66ba
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-15 17:08:01 +00:00
Morten Johan Sørvig
7416fc5e80 Cocoa: Set NSImage (point) size
when converting from QPixmap. This will make the image
display correctly when used by native API.

Task-number: QTBUG-60769
Change-Id: Iec3160affbe2902d34a219b6816f503dc2f56f74
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-11-15 17:07:57 +00:00
Richard Moe Gustavsen
7465329fe1 QAbstractButton: don't clear 'pressed' flag unless left button is released
As it stood, we would set 'pressed' to false regardless of which button that
was released. This would end up wrong if pressing the left button, and
at the same time, did a click with the right button. This would clear the
flag prematurely, and cause a release signal not to be emitted when later
releasing the left button.

tst_QAbstractButton: adding autotest

Adding tests to simulate the bug report's cases:
1) left press button
2) click right/middle key
3) move mouse out of button's boundary
4) test if the released() signal triggered properly

Taks-number: QTBUG-53244
Change-Id: Ifc0d5f52a917ac9cd2df5e86c0475abcda47e425
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-15 10:06:16 +00:00
Liang Qi
ecc4754cab Merge remote-tracking branch 'origin/5.9' into 5.10
Change-Id: I2f8f6b1d196548087219739faa3ad1517626da1e
2017-11-15 09:08:46 +01:00
Andy Shaw
3dab19ffed OCI: Match the constraints on the index_name column
When looking for the primary index, it is possible that the
constraint_name in the all_ind_columns table does not match that of the
index_name. Whereas the index_name will match in this case, so the query
should set the where clause on the index_name in both tables.

Task-number: QTBUG-64427
Change-Id: I1bf1fb580e620b9f75f2fde1ecf408842e377365
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2017-11-15 06:40:45 +00:00
Liang Qi
2884c652b5 A brute-force solution to get QRandomGenerator build on Integrity
Task-number: QTBUG-64451
Change-Id: Ife11c3448f54609ba6e85a269a3b5376c43a075f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-15 05:12:10 +00:00
Thiago Macieira
a95936f376 QSemaphoreReleaser: Move private members to the usual position
Change-Id: Ic632b4163d784b83951cfffd14f67b902d096d8b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2017-11-14 17:00:12 +00:00
Thiago Macieira
a066ad32b6 QDateTime: Move the deprecation marker to Qt 5.10
Commit b6a6121128 went into dev at around
the time of the 5.10 branching. We apparently got the side of it wrong.

Change-Id: Ic632b4163d784b83951cfffd14f67bec63fbc795
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-11-14 16:51:26 +00:00
Edward Welbourne
285596ee19 Special-case parsing of Zulu time-zone in date-times
When parsing a date-time's zone, a stray Z denotes UTC (a.k.a. Zulu
time), despite not being a valid name for the zone.  Clients parsing
such date strings had to treat the Z as a literal, rather than a
zone-ID, but then they got back a LocalTime instead of the UTC the
string actually described.  So teach QTimeZoneParser to handle this
special case and adapt an existing test (that used a time ending in Z,
but had to treat it as a local time) to check this works.

[ChangeLog][QtCore][QDateTime] When parsing a time-zone, "Z" is now
recognized as an alias for UTC.

Change-Id: Ib6aa2d8ea2dc6b2da526b39aec74dbc007f90fd8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-14 16:44:27 +00:00
Thiago Macieira
4870282117 QSemaphore: fix regression when the timeout < 0
The issue was introduced by eaee1209f0, so
it affected only 5.9.2.

[ChangeLog][QtCore][QSemaphore] Fixed a regression that would make
tryAcquire() not to wait forever if the timeout was a negative
value. Note: new code is advised to only use -1 to indicate "forever",
as some other functions taking timeout periods do not accept other
values.

Task-number: QTBUG-64413
Change-Id: I57a1bd6e0c194530b732fffd14f58fce60d5dfc9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-14 11:07:30 +00:00
Friedemann Kleint
c84f755489 Offscreen QPA: Use fusion style always
Prevent it from crashing when naively using it for example
on Windows, which defaults to the Windows Vista style operating
on native window handles.

Change-Id: I7b1dfb00a6b6860d0f0a134653ce1142b45959ec
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-14 06:54:52 +00:00
Thiago Macieira
1a05a71493 Fix QBasicMutex default constructor not constexpr
Commit 02dc39fa8e added the constructor
for the bootstrapped mode. For the regular mode, we hadn't needed, since
the {} syntax guaranteed initialization for us.

Turns out there's at least one compiler that doesn't think it was enough
(GCC for QNX 7).

Task-number: QTBUG-64451
Change-Id: Ic632b4163d784b83951cfffd14f6766b4cb4eb64
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2017-11-14 04:55:24 +00:00
Andy Shaw
131c9a2462 Fix BC breakage by adding an overload for the QSqlField constructor
Change-Id: I253bb8cd97b982fa5ed5dd546c38deb1f7995986
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-13 06:59:25 +00:00
Tony Sarajärvi
212f92182a Merge "Merge remote-tracking branch 'origin/5.9' into 5.10" into refs/staging/5.10 2017-11-12 15:35:48 +00:00
Allan Sandfeld Jensen
25b18fb241 Document interaction of style name and other style properties
Setting style name to "Regular" and then setting bold to true, results
in platform depending behavior, and should be avoided.

Also removes comment about style name not working on Windows, it has
been working since 5.8.0.

Task-number: QTBUG-63792
Change-Id: Ie5be7215a673f5751dbeb6512df8ec7bfaef4d0a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-11-12 00:11:02 +00:00
Laszlo Agocs
48afcf97b4 Fix shader graph metatypes for static builds
Cannot rely on Q_COREAPP_STARTUP_FUNCTION inside Qt since static builds
have to be fully supported. Due to not registering those types, the shader
builder silently generated incompilable shader code in static builds. This
is critical especially on platforms where static builds are the only
choice (INTEGRITY).

Task-number: QTBUG-64365
Change-Id: I8820ded239ac160ab00c7fc34918fd3f273f0afb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-11 14:56:09 +00:00
Thiago Macieira
490b24b064 QTemporaryFile: hide the O_TMPFILE feature behind a check for linkat()
Some Linux libc (I'm looking at you, Bionic) use the system call but
don't expose it to userspace. We could use syscall() to make the system
call, but instead I decided to penalize users of those libc by not
having the feature.

It's probably a good thing, since there were likely to be more problems
with Android anyway and I don't have an environment to debug.

Task-number: QTBUG-64154
Change-Id: I57a1bd6e0c194530b732fffd14f3007a1062d935
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-11 08:12:11 +00:00
Thiago Macieira
86d91d2bf8 QRandomGenerator: optimize the global() and system() storage
We store both in a single memory structure, instead of two local
statics. By construction, we also ensure that the global PRNG mutex is
in a different cacheline from the global PRNG state itself.

Finally, we don't store the full system QRandomGenerator, since we only
need the type member from it.

Change-Id: Icaa86fc7b54d4b368c0efffd14eecc48ff05ec27
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-11-11 08:11:09 +00:00
Thiago Macieira
08bf28de03 QRandomGenerator: add more of the std Random Engine API
This brings us to almost parity with the C++11 Random Engine API
requirements (see chapter 26.5.1.4 [rand.req.eng]). We don't implement
the templated Sseq requirements because it would require moving the
implementation details to the public API. And we don't implement the
<iostreams> code because we don't want to.

Change-Id: Icaa86fc7b54d4b368c0efffd14f05ff813ebd759
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-11 08:11:07 +00:00
Thiago Macieira
cfad4e298f QRandomGenerator: add securelySeeded(), to ensure appropriate seeding
Since we don't document how many bytes one needs (it's 2496), it's
difficult for the caller to provide just enough data in the seed
sequence. Moreover, since std::mt19937 doesn't make it easy to provide
the ideal size either, we can't actually write code that operates
optimally given a quint32 range either -- we only provide it via
std::seed_seq, which is inefficient.

However, we can do it internally by passing QRandomGenerator to the
std::mersenne_twister_engine constructor, as it's designed to work.

Change-Id: Icaa86fc7b54d4b368c0efffd14f0613c10998321
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-11 08:11:03 +00:00
Thiago Macieira
af456842e1 Change QRandomGenerator to have a deterministic mode
Now only QRandomGenerator::system() will access the system-wide RNG,
which we document to be cryptographically-safe and possibly backed by a
true HWRNG. Everything else just wraps a Mersenne Twister.

Change-Id: I0a103569c81b4711a649fffd14ec8cd3469425df
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-11 08:11:00 +00:00
Thiago Macieira
4502999ff0 QRandomGenerator: remove the per-thread buffer
Since we're adding a deterministic generator that inherently does not
use syscalls, and people should really use that one by default, there is
no point in optimizing the secure generator wrt syscalls. Besides,
keeping the random data in memory for longer than needed is likely
inadviseable.

Change-Id: Ib17dde1a1dbb49a7bba8fffd14ed0871117fe930
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-11 08:10:58 +00:00
Morten Johan Sørvig
d0736e9d17 Cocoa: Make High DPI drag cursor work
Change-Id: Ide4bc50ab7173529a00fe60a04204bad0b3f275e
Task-id: QTBUG-60769
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-11-09 16:45:11 +00:00
Liang Qi
88cf044580 Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/gui/kernel/qwindow.cpp
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/plugins/platforms/windows/qwindowssystemtrayicon.cpp
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
	tests/auto/widgets/kernel/qaction/tst_qaction.cpp

Change-Id: Ifa515dc0ece7eb1471b00c1214149629a7e6a233
2017-11-09 11:47:57 +01:00
Błażej Szczygieł
7d10936443 Fix QHighDpi::fromNativeLocalExposedRegion rounding errors
Ceiling width/height fails to take into account rects that do no have
their top left position on an exact point boundary.

Example: QRect(0,0 20x20) and QRect(1,1 20x20) with scale 2.0 would give
the same result of QRect(0,0 10x10). The correct rects are QRect(0,0 10x10)
and QRect(0,0 11x11), so that we are sure to repaint all pixels within the
exposed region.

Before 5138fada0b, rects were also rounded incorrectly. The old method
would give the result of QRect(0,0 11x11) in both cases, causing the
exposed region to be larger than a window.

Amends 5138fada0b

Task-number: QTBUG-63943
Change-Id: I9f3dddf649bdc506c23bce1b6704860d61481459
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-11-08 15:45:40 +00:00
Kai Koehne
dfdd99fc12 Doc: Be more specific on full stop in QVersionNumber
So far we just write ... '.'. , which looks weird.

Change-Id: Iac6fc781c80976994ea0a182b55958baa39a7e52
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2017-11-08 14:26:32 +00:00
Thiago Macieira
19b0ce5daa Change almost all other uses of qrand() to QRandomGenerator
The vast majority is actually switched to QRandomGenerator::bounded(),
which gives a mostly uniform distribution over the [0, bound)
range. There are very few floating point cases left, as many of those
that did use floating point did not need to, after all. (I did leave
some that were too ugly for me to understand)

This commit also found a couple of calls to rand() instead of qrand().

This commit does not include changes to SSL code that continues to use
qrand() (job for someone else):
  src/network/ssl/qsslkey_qt.cpp
  src/network/ssl/qsslsocket_mac.cpp
  tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp

Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-08 09:14:03 +00:00
Helio Chissini de Castro
159b3306d6 Change fallthrough detection order to fix clang detection
Clang compiler defines fallthrough, but wrongly detects QT_HAS_CPP_ATTRIBUTE(fallthrough).
This makes compiler breaks compilation due clang be expecting
clang::fallthrough.
Change the order makes the exceptions. clang/gnu, been tested before
the generic, setting then proper defines at end.

LLVM-bug: https://bugs.llvm.org/show_bug.cgi?id=33518
Change-Id: Ic287e9028936af3bdade5c1ee319ca8914b36ea7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-07 19:37:06 +00:00
Gabriel de Dietrich
3f519ffa15 QCocoaMenuItem: Don't clear NSMenuItem.action when setting submenu
Contrarily to what the comment stated, we actually rely on automatic
menu validation, even for submenu items. This is visible in the menu
delegate's validateMenuItem: and itemFired: methods.

This solves the last visible issue in BigMenuCreator where, under
ASP/ASP, ASP/SAP, SAP/ASP and SAP/SAP, all A*S submenus would be
disabled. The cause was an incorrect target/action setup.

Menurama still behaves as expected.

Change-Id: I2599d6fb0d51f56f5d36f03b69647e35ff6c550a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-07 19:36:39 +00:00
Gabriel de Dietrich
5d6878f234 QMainWindow: Clear menubar parent when new one is set
In QMainWindow::setMenuBar(), we hide and schedule the current
menubar, if any, to be deleted later. However, it remains installed
as its whole ancestry's event filter, which could conflict with the
newly assigned menubar until the old menubar is destroyed. In our
case, we have noticed issues with the Cocoa QPA plugin.

We force uninstalling the old menubar as event filter by setting its
parent to null, pending its deletion shortly after.

This fixes BigMenuCreator's empty menubar when calling it with only
the "--new-menubar" option. It also fixes QTBUG-34160 example which
was not behaving as well as it should.

Task-number: QTBUG-34160
Change-Id: Ifefb72affad01e7b7371005442074afd6a39a5b8
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-11-07 19:36:29 +00:00
Gabriel de Dietrich
7986e1e2f0 QMenuBar: Update title on change
When one of the menubar actions changed, we would omit to
update several properties on the platform menu, most notably
its title.

Manual tested with BigMenuCreator, where the sequence

    menu->addAction(action);    // A-operation
    action->setMenu(submenu);   // S-operation

would result in an "Untitled" menubar item on macOS, and this
regardless of when the submenu is populated.

Change-Id: I43989f36f6bf3f0b7056310ac986c06f8e02f128
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-07 19:36:18 +00:00
Gabriel de Dietrich
237b1c1d68 QMenuPrivate: Use in-class initializers where possible
Change-Id: I5347cb41443baf96e28bd399c84983a801b10fcd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-11-07 19:36:01 +00:00
Gabriel de Dietrich
b02bd4bbad QMenuPrivate: Rearrange member variables
This saves 32 bytes per instance on 64-bit macOS, from 888
down to 856 bytes.

Change-Id: I2592631aa3566d2eab72bad338aacfe76bee8ef3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-11-07 19:35:54 +00:00
Tor Arne Vestbø
c3aa422df6 QWidget: Propagate window file path after create
Task-number: QTBUG-63340
Change-Id: Ic21964a33ee2910200627fe8a8c8ec2454e2e20c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-07 14:53:55 +00:00
Tor Arne Vestbø
59c5f7bd9d macOS: Fall back to QWindow::icon for application icon if not set
There are three ways to set the application (Dock/task switcher) icon:

 1. By setting an ICON in the project file
 2. By calling QGuiApplication::setWindowIcon
 3. By calling QWindow::setIcon

The third one was not working on macOS, despite being documented as
such: "The window icon might be used by the windowing system for example
to decorate the window, and/or in the task switcher."

We now update the application icon based on the active window,
unless a global application icon has been set using ICON, or
via QGuiApplication::setWindowIcon. The reason for not allowing
the window's icon to override a global application icon is that
the developer may have intended to set the document icon for a
window (to represent QWindow::filePath), and we don't want that
to affect the Dock icon of the application.

The role of QGuiApplication::setWindowIcon is a bit dubious in this,
as it's documented as "This property holds the default window icon",
which would indicate it should follow the same logic as above by not
letting it override the global ICON set in the project file, but this
would not allow runtime switching of the application icon, so the
QGuiApplication property is left as is. The property should probably
have been named QGuiApplication::applicationIcon initially.

Task-number: QTBUG-63340
Change-Id: I94d3710a8586bb729af42f59a915b8f49dded101
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-07 14:39:12 +00:00
Laszlo Agocs
421df7570b Enable glyph cache workaround for GC2000 as well
The glyph cache resize is clearly doing something that is not actually
legal with OpenGL ES. Until this gets investigated properly, add the
Vivante GC2000 (found in the commonly used i.MX6 quad) to the list since
reports show that the issue occurs there as well.

Task-number: QTBUG-49490
Change-Id: Ia890346d8dbb1691bc113e2ef522713ba6709393
Reviewed-by: Louis Kröger <louis.kroeger@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-11-07 14:13:50 +00:00
Eirik Aavitsland
b084837ffc Update bundled libpng to version 1.6.34
This fixes an upstream bug in the existing version 1.6.32 which would
cause certain valid png files to be rejected.

The remaining diff to clean 1.6.34 is archived in the qtpatches.diff file.

[ChangeLog][Third-Party Code] libpng was updated to version 1.6.34

Task-number: QTBUG-63950
Change-Id: Ie6f2a09c78a93b6e5623848776b75650bb5bca66
Reviewed-by: André Klitzing <aklitzing@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-11-07 09:16:59 +00:00
Friedemann Kleint
28c1e17aef QWinEventNotifier: Fix exit crash
Make sure the wait handle is unregistered even though
there is no event dispatcher in QWinEventNotifier::setEnabled().

Task-number: QTBUG-64152
Task-number: QTCREATORBUG-19175
Change-Id: I608b95adc7cb874bc52dc5bf0e9f51b443b54ebc
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-11-07 08:13:50 +00:00
Christian Ehrlicher
2937ab9e32 QHeaderView: Skip hidden sections on cascading resize
When a section is hidden, QHeaderViewPrivate::cascadingResize() does
resize a section even it is hidden. This leads to space between the
neighbor sections and also some unneeded calculations.

Task-number: QTBUG-54601
Change-Id: Ie139417ae2c77ef25e66cf628bfe400185f88ee8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-06 18:18:17 +00:00
Christian Ehrlicher
b4f4c384d9 QHeaderView: Honor maximumSectionSize property during resizeSections()
Resizing a QTreeeView section with double click or
resizeColumnToContents() does not respect the maximumSectionSize when
the resize mode is Interactive or Fixed. Since the documentation of
maximumSectionSize states that it should honor this property for those
cases either the documentation or implementation is incorrect.
This patch fixes the latter.

Task-number: QTBUG-64036
Change-Id: Ic14c8e444d50b9c50a117efed19d0bca7ec1cf82
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-06 18:18:09 +00:00
Morten Johan Sørvig
5194817941 Cocoa: optimize backingstore flush on 10-bit displays
Qt draws the backing store to the window using CoreGrahics,
which will trigger a slow RGB32 -> RGB64 conversion
when the output display is a deep color display.

Disable NSWindow dynamicDepthLimit and force the depthLimit
to WindowDepthTwentyforBitRGB for the common case of
8-bit-per-component raster surfaces.

This was benchmarked by resizing a simple QRasterWindow
test case which fills the window area using QPainter::fillRect().

Before:

67.1%  rgba64_image_mark_rgb32
10.8%  __vImageCopyBuffer_block_invoke
6.0%   madvise
5.0%   _kernelrpc_mach_vm_deallocate_trap
4.1%   qt_memfill32(unsigned int*, unsigned int, int)

After:

30.7%  __vImageCopyBuffer_block_invoke
20.3%  madvise
12.3%  __vOverwriteChannelsWithScalar_ARGB8888_block_invoke
12.2%  qt_memfill32(unsigned int*, unsigned int, int)
4.6%   _kernelrpc_mach_vm_deallocate_trap

The test program now spends significantly more of its
time allocating/deallocating the backing store (madvise),
and running the Qt paint event (qt_memfill32).

Task-number: QTBUG-47660
Change-Id: I878be7a0e6eee4ad798f7a53f7f9f79b7950af26
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-11-06 14:31:53 +00:00
Allan Sandfeld Jensen
7df4dcff2c Fix memory corruption on scaled emojis
Bitmap glyphs are returned prescaled, which means we should include
the transform in their bounding box.

Additionally painting them should stick the smallest rect to avoid
writing outside the allocated area, and assert in debug builds.

Task-number: QTBUG-64239
Change-Id: I5f877d36566891323f528018f910798344ba4ce2
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-11-06 14:03:44 +00:00
Robert Loehning
3e5dde4766 Testlib: Fix developer-build with clang 4
"implicit conversion increases floating-point precision: 'float' to
'double'"

Change-Id: Id6f4315316e63c849f1a5ddb6c77abc2bab0b2a9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-11-06 08:45:37 +00:00
Eirik Aavitsland
e45ffd7bf6 Xinput: Avoid misdetecting certain trackballs as tablets
The algorithm triggers on the word "cursor" in the device name, which
would also happen for devices from the manufacturer Cursor Controls.

Task-number: QTBUG-48034
Change-Id: I9645c0d0bc1fa951d0ea00480572fd0df0220eb5
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-11-05 16:02:47 +00:00
Jesus Fernandez
d2b8a01ab0 Fix indentation
Tabs and white spaces were mixed.

Change-Id: I498944334b68b5c23a61e6f4ba6a0e8df77799c6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-11-05 07:06:29 +00:00
Gabriel de Dietrich
385589ef45 QCocoaMenu: Attach menu items when updating the menubar
Instead of waiting for the menu delegate to update each item,
we can attach an NSMenu to its NSMenuItem as soon as we update
the current window's menubar. This is safe to do because we
know that this is going to be the main menubar right after, so
we're not orphaning any NSMenuItem from its NSMenu at the wrong
moment.

By doing this, we also ensure that all menus from the active
menubar are reachable by the key-equivalent dispatching logic,
even before we display the actual menu.

This was shown in BigMenuCreator where, under the menubar's ASP
and SAP menus, all A*S submenus would be disabled. Furthermore,
on the same menus, SAP would show the same issue.

Added test in Menurama as well.

Change-Id: If6e7311072e6b53ad1cbced73623d1832aa0df8e
Task-number: QTBUG-57076
Task-number: QTBUG-63712
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-05 01:39:30 +00:00
Robert Szefner
b35a27676b QPSQL: Fix check for minimum supported PostgreSQL version
According to Qt documentation http://doc.qt.io/qt-5/sql-driver.html#qpsql
minimum supported version of PostgreSQL is 7.3

Change-Id: I30cffaddc29fd56b534bfd259cc235ea1204a21f
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-11-04 20:58:18 +00:00
Robert Szefner
ff914ea59c QPSQL: Fix handling binary data for PostgreSQL 9.x and later
Set byte_output to 'escape' mode for server version 9 and later,
no matter what version of client library we use.
Since setting byte_output doesn't depend on client version anymore,
we can move it to separate function.

This fixes qtbase\tests\auto\sql\kernel\qsqldatabase
tst_QSqlDatabase::psql_escapeBytea() test
(before this change test did not pass on PostgreSQL 9.6)

Change-Id: I37aaa18267d7e6459c00010ed899536c01e8124e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-11-04 20:58:08 +00:00
Robert Szefner
435c4b2ccb QPSQL: Fix detection of PostreSQL version 9.x and later
Fixed parsing version string for PostgreSQL.
PostgreSQL versioning changed since version 10, see link:
https://www.postgresql.org/support/versioning

Extended QPSQLDriver::Protocol enum for PostreSQL 9.x and later,
added underscore to item names to separate major and minor version.
Changed long switch-case statements to if-else.

Change-Id: Ib19ae7ba426f262e80c52670e7ecb3532ff460a0
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-11-04 20:57:42 +00:00
Gatis Paeglis
ad36da8ff4 testlib: start sharing common helper functions
... by moving them in QTestPrivate namespace (qtesthelpers_p.h). This
header file is a convenient staging area for helper APIs, eventually
some could be moved to public QTest API.

This header file utilizes the same pattern as other qtestlib header
files - wrapping functions with QT_${LIBNAME}_LIB to automatically
enable certain APIs based on what is in the projects dependencies,
e.g. QT += widgets.

Change-Id: Ic0266429939c1f3788912ad8b84fc6e0d5edd68b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-11-04 20:11:22 +00:00
Tor Arne Vestbø
8ba1f91d4e macOS: Add logging of screen add/remove/changes
Change-Id: Ic9c9ac307441dde98bb43d656466a03805746917
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-11-04 16:46:09 +00:00
Thiago Macieira
484a186f50 QNativeSocketEngine/Win: fix getting the datagram destination
Looks like I never even tested this. There were two problems:
 1) when we asked for the recvmsg and sendmsg functions, we used the
    wrong variable (socketDescriptor was still -1)
 2) we extracted the destination addresses, but never set them in the
    QIpPacketHeader object

The added tests confirm that this works on Windows, Linux, Darwin,
FreeBSD. There also seems to be a problem, obtaining the destination
address on an IPv4 socket with a dual-stack sender (I can reproduce that
on FreeBSD, macOS and Windows, plus an old version of Linux).

Task-number: QTBUG-63605
Change-Id: I638cf58bfa7b4e5fb386fffd14ea732bddbc0c42
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-11-04 19:12:18 +00:00
Thiago Macieira
d674d227f7 qGlobalQHashSeed: initialize the seed before returning it
If you had never used QHash before, this function returned -1. That's
not useful if you're trying to implement your own QHash that uses Qt's
global seed.

Change-Id: Ib0e40a7a3ebc44329f23fffd14b2e875b970a55c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-04 19:11:41 +00:00
Friedemann Kleint
92c61b11c1 Windows: Use SM_CXSMICON instead of SM_CXICON for the tray icon size
Partially reverts b465fe7596.

Task-number: QTBUG-63447
Change-Id: Iaf8a54b59a054e33811f65f64322af3aa746885e
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-11-04 19:04:37 +00:00
Friedemann Kleint
b4ac552561 Windows QPA: Pass on Url of non-filesystem directory items
Do not attempt to copy directory items, which will fail and result
in empty result lists. Amends 5865e582fd.

Task-number: QTBUG-57070
Task-number: QTBUG-63645
Change-Id: I59efce196b28099ec8aff5a802ef0a4d9a098453
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-11-04 19:04:21 +00:00
Friedemann Kleint
d366d6dfd3 Windows QPA: Restrict file dialog to file system items in Directory mode
Qt cannot handle places like 'Network', etc.

Task-number: QTBUG-63645
Change-Id: I53d0eedc2996af6a1ec3230e3d65a3e272aa3710
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-11-04 19:02:32 +00:00
Friedemann Kleint
851c226247 QFilesystemWatcher/Windows: Use event dispatcher of thread
Previously, the native event filter listening on removable drivers
was installed on QCoreApplication::eventDispatcher() which led to
a mismatch when launched from a non-GUI thread since
~QAbstractNativeEventFilter() removes itself from
QAbstractEventDispatcher::instance().
Amends 45580aa925,
e612fe8d47.

Task-number: QTBUG-64171
Change-Id: Icbe289bd585f124d66989d0cd574040b986e680c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-04 19:01:03 +00:00
Christian Ehrlicher
937ded010b QListView: make sure to respect grid size during dataChanged() handling
When the dataChanged() signal is handled by QIconModeViewBase, the size
of the items are recalculated. During this operation the optional
grid size is not taken into account which leads to a screwed up layout.
This patch adds the missing check similar it is done in
doStaticLayout()/doDynamicLayout().

Task-number: QTBUG-45427
Change-Id: Iba7adb44b1510c511a69c289ccb4f168992a6871
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-04 18:23:46 +00:00
Elvis Angelaccio
a4f9cf2344 Disable window shortcuts if there is a window modal dialog
If a window is blocked by a WindowModal dialog, it should not be
possible to trigger window shortcuts on that window if it receives
a WindowActivate event.

This currently happens if the blocked window gets clicked, because the
window becomes the active_window and then QApplication sends it a
WindowActivate event (this doesn't happen with application modal dialogs).

The correctWidgetContext() function calls QApplicationPrivate::tryModalHelper()
only if the shortcut context is ApplicationShortcut. This patch makes it
call even if the shortcut context is WindowShortcut.

Change-Id: Iff87d85bcae603a6a24128e0cedfa9d33b6485fd
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-04 17:41:17 +00:00
Christian Ehrlicher
8f1277da8c QStorageInfo: Properly decode labels from /dev/disk/by-label
udev encodes the labels for /dev/disk/by-label/ with ID_LABEL_FS_ENC
which is done with blkid_encode_string(). This function encodes some
unsafe 1-byte utf-8 characters as hex (e.g. '\' or ' ')

Task-number: QTBUG-61420
Change-Id: If82f4381d348acf9008b79ec5ac7c55e6d3819de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-04 17:31:49 +00:00
Alexandru Croitor
2b7cf045bf Replace <QtCore/QtConfig> includes with qglobal.h
Nothing (except the *global*.h headers themselves) is supposed to include
the generated *config*.h files directly. The QtConfig forwarding header
should not exist in the first place.

Change-Id: I5e9edd25d905582381cdc6386804c1f3ef8716ae
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-11-03 15:57:32 +00:00
Mitch Curtis
c988a8a282 Make QCOMPARE print QColor alpha values on failure
Currently, when two colors are equal except for their alpha values,
QCOMPARE produces the following failure message:

FAIL!  : tst_Test::test() Compared values are not the same
   Actual   (colorA): #ff0000
   Expected (colorB): #ff0000

By using the HexArgb format instead of the default HexRgb, we can
see the full hex string, with alpha values included:

FAIL!  : tst_Test::test() Compared values are not the same
   Actual   (colorA): #88ff0000
   Expected (colorB): #ffff0000

Task-number: QTBUG-55574
Change-Id: Id82c60a1b473ac6025a6f6ac560fce95a910d782
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-11-03 14:29:49 +00:00
Friedemann Kleint
58f4607701 QWindowPrivate::globalPosition(): Take embedded windows into account
QPlatformWindow::mapToGlobal() should also be used in case
a window is embedded.

Task-number: QTBUG-64116
Change-Id: I1fbdf3d185659d0faea13a593db901e36ab27d8d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-11-03 14:24:17 +00:00
Laszlo Agocs
89951262bf Drop qvulkan headers from QtGui master header
...in order to allow applications built against Vulkan-enabled pre-built packages
to include <QtGui> on systems without Vulkan headers.

This has the downside of not being able to pull in qvulkan* headers via
the master header. This is an acceptable compromise for now.

Task-number: QTBUG-64073
Change-Id: I63c5834dcec60e66aba34c003d4bfe8e7d31607f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-11-03 05:57:38 +00:00
Laszlo Agocs
38bc995607 Fix redundant Vulkan logging category definition
Task-number: QTBUG-64124
Change-Id: Ic8f9a7f62e3c00dba5f345037c45fb45908be848
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-11-03 05:57:33 +00:00
Thiago Macieira
6ca6efb22a Fix unused variable warning when compiling in release mode with GCC 7
error: unused variable ‘ret’ [-Werror=unused-variable]

Change-Id: I6e9274c1e7444ad48c81fffd14dcff9278d4376b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-03 01:12:44 +00:00
Robert Loehning
e6fb36389e QDateTimeParser: Remove unused variable
Change-Id: Iaa6460d4eb96632f3cb03bc29b57934c53cbf88e
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-11-02 18:53:46 +00:00
Tor Arne Vestbø
f4090b23b9 macOS: Add categorized logging of event and notification forwarding
Useful for debugging issues in this area.

Change-Id: Ic343ef790e20b66371028265efe2ec1816c954bd
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-11-02 15:22:41 +00:00
Tor Arne Vestbø
3a92f7cf4f macOS: Retain NSWindow during event delivery
We have logic to deal with self.platformWindow and frame strut mouse
events which happens after delivering the event to the NSWindow, but
delivering it might dealloc the window, e.g. when closing it, so we
need to explicitly retain it for the duration of [QNSWindow sendEvent:]

Task-number: QTBUG-64023
Change-Id: I223fe3e3ac36a309da375522ba11f20f1ad6fc4f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-11-02 15:22:39 +00:00
Andy Shaw
acdb334032 Fix dragging inside a modal window when a QShapedPixmapWindow is used
A regression was introduced with a3d59c7c7f
which caused dragging to fail within a modal dialog on the XCB platform.
By adding an exception for the QShapedPixmapWindow, which is the window
used for the drag, we can allow that to continue to work whilst blocking
to the other newly created windows.

Task-number: QTBUG-63846
Change-Id: I7c7f365f30fcf5f04f50dc1a7fff7a09e6e5ed6c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-10-30 11:15:13 +00:00
Liang Qi
17d5141113 Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/plugins/platforms/windows/qwindowswindow.cpp
	tests/auto/widgets/kernel/qaction/tst_qaction.cpp

Change-Id: Ia017a825ed2ca2d53ac586f4ae48df6f65818d40
2017-10-30 08:54:05 +01:00
Thiago Macieira
ea0e868c48 QFileSystemEngine: Fix renameat2() failures on non-local filesystems
The RENAME_NOREPLACE flag is supported for all Linux local filesystems,
since that can be easily checked by the VFS layer (it knows which files
exist and which ones don't). For non-local filesystems, the backend
needs support and that might need server-side support too. So we may get
EINVAL errors for those, in which case we fall back to link/unlink,
which in turn can fall back to rename().

EINVAL can also happen if we attempt to make a directory a
subdirectory of itself. In that case, we will attempt to link() it,
which will result in EPERM as we can't hardlink directories. Then we try
rename() again, which should result in the expected EINVAL.

Task-number: QTBUG-64008
Change-Id: Icaa86fc7b54d4b368c0efffd14f09ca23602dd2e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-10-29 21:21:06 +00:00
Thiago Macieira
fb59760381 Fix GCC -Wfloat-conversion warnings (available since GCC 4.9)
This warning used to be part of -Wconversion, but that generates too
more noise than we're willing to fix now (like conversion from qint64 to
int). The float conversion does trigger for conversion from double to
float, as shown in all the QVectorND uses of float, but more
importantly, it triggers on passing floats to ints.

Change-Id: I69f37f9304f24709a823fffd14e69cfd33f75988
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-10-29 10:13:23 +00:00
Thiago Macieira
0e0f656f50 Mark the previously public qstringalgorithms.h functions private
Discussed during Qt Contributor Summit 2017. We concluded that we don't
want to make these functions public, as they do not follow Qt coding
style API. Specifically,

   qStartsWith(a, b)

is not easily understood which argument is the needle and which argument
is the haystack (same problem memcpy() has). Compare that to

   a.startsWith(b)

which can clearly be read in English as a subject-verb-object sentence.

This commit removes the unit tests that called compare().

Discussed-on: http://lists.qt-project.org/pipermail/development/2017-October/031060.html
Change-Id: Icaa86fc7b54d4b368c0efffd14ee6205eb9043fb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-10-29 10:13:13 +00:00
Thiago Macieira
81f2516600 QRandomGenerator: add system() and global()
Right now,this does really nothing. This commit is just to allow us to
transition the other modules (besides qtbase) to use the syntax that
will become the API.

I've marked three places to use the system CSPRNG:
 1) the QHash seed
 2) QUuid
 3) QAuthenticator

I didn't think the HTTP multipart boundary needed to be
cryptographically safe, so I changed that one to the global generator.

Change-Id: Ib17dde1a1dbb49a7bba8fffd14ecf1938bd8ff61
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-10-29 10:13:01 +00:00
Thiago Macieira
fd9dd8e95b Move the minimum Linux version declarations to a header
I'll need it in the AF_NETLINK implementation of QNetworkInterface.

Change-Id: Icaa86fc7b54d4b368c0efffd14ef5ce895d0ed5b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-10-28 06:08:59 +00:00
Timur Pocheptsov
464b50b58d Fix -no-opengl build
A follow-up patch for 8e70241dcc:
Make 'shareContext' conditionally included/compiled
(protected by QT_CONFIG(opengl)).

Change-Id: Ieaeea6b146b47fba7a77e2576ae0a33042280199
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-10-28 06:07:38 +00:00
Friedemann Kleint
9f0dda29d5 Windows QPA: Restrict warning about geometry failure
Print warning only for visible windows or in debug mode.

Task-number: QTBUG-63661
Change-Id: I742c86afcb40455074a6de753b0b1ce6a11d55af
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-10-27 20:03:10 +00:00
Friedemann Kleint
44401d26af uic: Fix clazy warnings clazy-qstring-left, clazy-unused-non-trivial-variable
Change-Id: Ibbb9a85dba7773bb70298906bc370b4e24d7d901
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2017-10-27 20:01:51 +00:00
Thiago Macieira
cf22203855 Add a comment about the weird refcount for adopted QThreadData
It's perfectly benign, but I spent a lot of time debugging this and
trying to figure out how to solve something that didn't need solving. So
document for posterity.

For an adopted thread, the TLS destructors or the adopted thread watcher
on Windows will call QThreadData::deref():

- QThreadData::deref(), count drops to zero
   -> delete this;
- ~QThreadData() deletes the QAdoptedThread
   -> delete t;
- ~QThreadPrivate() calls deref() again
   -> data->deref();
- QThreadData::deref(), count drops to -1, no action taken
- ~QObjectPrivate() calls deref() yet again
   -> threadData->deref()
- QThreadData::deref(), count drops to -2, no action taken

Change-Id: Icaa86fc7b54d4b368c0efffd14ee448e0796e8d7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-10-27 20:00:27 +00:00
Alex Trotsenko
e8d2e831a4 QSslSocket::waitForDisconnected(): flush write buffer before waiting
Otherwise, the plain socket might be blocked indefinitely on waiting for
socket activity.

This issue is tested by tst_QSslSocket::disconnectFromHostWhenConnected()
which was unstable in CI.

Task-number: QTBUG-64016
Change-Id: I6a1a111dea4d1d1adaf55e6a90c0c5f995a270af
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-10-27 19:22:23 +00:00
Joerg Bornemann
70b0c127f0 Fix private includes in qhttp2protocolhandler_p.h
This file could not be included by user code in an installed Qt.

Change-Id: Id222d56dda9ef47d010ab947efa01bf63ecac050
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-10-27 06:39:15 +00:00
Mårten Nordheim
0bd4b194d1 Replace unneeded nullptr-checks with ASSERTS
The manager and managerPrivate member variables are set in the
constructor and never changed after that.

Change-Id: I7cc2fd2eb3f50bdc529ed29485e74bf9c016b0c0
Coverity-Id: 185272
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-10-27 03:54:18 +00:00
André Klitzing
efb1a13282 Update bundled sqlite to 3.20.1
[ChangeLog][Third-Party Code] Sqlite was updated to version 3.20.1

Change-Id: I538a4de9b915fd1655479e44aa7ca8bae7b9a0b3
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-10-27 00:54:15 +00:00
Kai Koehne
870423f98b Freetype: Also list BDF, PCF, ZLIB licenses
These are third party licenses that are part of
freetype.

Change-Id: I8c54feb6b5537ccfb0d0a4ffc24bc830c3c530e4
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-10-26 12:16:11 +00:00
Kai Koehne
a1d62e61cb Synthesize LICENSE.txt for FreeType documentation
The LICENSE.txt we showed so far only mentioned the two mutual
licenses (FTL and GPLv2), whithout actually spelling them out.
This is required though.

[ChangeLog][Third-Party Code] Improve documentation about
Freetype 2 licenses.

Change-Id: I3af84b732aff58b12218cb7e8bb8e8de00c86307
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-10-26 12:16:07 +00:00
Thiago Macieira
9574436666 QUrl: make sure setPort(nonnegative) is taken as part of authority
There were a couple of corner cases where doing setPort() would result
in QUrl thinking that an authority was not present. Since the full URL
parsing implies that a host is always present if the authority is
present, then we also imply that setting the port number makes the host
be present too.

Change-Id: I69f37f9304f24709a823fffd14e67c12da18d69f
Reviewed-by: David Faure <david.faure@kdab.com>
2017-10-26 04:46:04 +00:00
Timur Pocheptsov
76a6b32942 HTTP/2 - make protocol settings configurable
1. Recently we have updated our receive window size to a larger value.
Unfortunately, this also results in auto-test pumping through
more data, which probably takes more time on CI.
At the moment we do not have any public API on QNAM's level to
customize HTTP/2 parameters (aka 5.10/FF and so on). So we use the fact
that QNAM is QObject and we can set a property on it. This property
is our Http2::ProtocolParameters object that allows us to configure:
- HPACK parameters (in 5.10 - noop)
- session receive window size
- different SETTINGS as described by RFC 7540, 6.5.2.

2. Undocumented environment variable to set ENABLE_PUSH is not needed
anymore.
3. In 5.11 Http2::ProtocolParameter will become a public API
and we'll introduce a new setter in QNAM.

Change-Id: If08fd5e09e7c0b61cf9700b426b60b5837b6b2e6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-10-26 04:13:40 +00:00
Eirik Aavitsland
4e339a5ac1 Doc: QImageReader assumes exclusive control over its device
Make an explicit mention of the fact that modifying a device while it
is being held by a QImageReader is undefined.

Task-number: QTBUG-61121
Change-Id: Ie0a016255c2614c5b8b415c8cd9602169153c8f8
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-10-25 09:19:29 +00:00
Frederik Gladhorn
7a26582807 Make sure that QAccessibleWindowContainer::childCount is valid
When embedding foreign windows, we won't be able to return a valid child
accessible interface, so do not report it at all.
Supporting foreign windows properly is platform specific and something
to consider, but at least we shouldn't crash.

Task-number: QTBUG-63451
Change-Id: I19350cf97dc8d0c3f3052411eba0eee5f750dbab
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2017-10-25 09:19:24 +00:00
Friedemann Kleint
5eb508a317 Fix clazy-strict-iterators
Change-Id: I9276a85f0a8061b2636687cf694b8ed1abaa18b8
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-10-25 09:19:19 +00:00
Jan Arve Sæther
ecd183455b Refactor childIdListForAccessibleObject
It has several problems:

1. It could potentially create an intArray with uninitialized elements.
   This could happen because the index for getting interfaces were the
   same as the storage index.  This was not correct, because they could
   diverge if iface->child() returned an invalid interface.

2. The count of accessible child elements could change while iterating.
   This could cause out-of-bounds condition when calling
   SetIntArrayRegion as described in QTBUG-45855. Instead now, we call
   SetIntArrayRegion only once, after we have gathered all the child
   interface ids.

Task-number: QTBUG-45855
Change-Id: I77e813158df5f563d04931ac4e296e3fc2a16e67
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-10-25 09:19:16 +00:00
Oliver Wolff
5ec02f7792 winrt: Fix compilation with -no-pch
Task-number: QTBUG-63210
Change-Id: Icdd4fcee67e3b386b86a131c302424b53b18e565
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-10-25 09:19:12 +00:00
Maciej Czarnecki
3b8f828174 QWizard: Do not remove the Next button's shortcut
Currently on Windows, the Next button's shortcut doesn't work, because
QWizard overrides it with an empty key sequence.
The key sequence should be changed only if isVistaThemeEnabled() returns
true.

Task-number: QTBUG-46894
Change-Id: I54f26388b167973cc8065a867d9e771c1e6a2a72
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-10-24 16:43:52 +00:00
Olivier Goffart
abcf558e49 moc: Restore compatibility with Qt 5.7's -b option
In Qt 5.7, it was possible to call moc "-bfoo.h" or "-b foo.h" and it had the
same effect. With the port to QCommandLineOption, we broke the -b option as it
was not annotated as a short option.
(Regression in a7e3c17e75)

Task-number: QTBUG-63706
Change-Id: I161d0f1a4e65d129063b5e8431802257677da19d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-10-24 16:43:47 +00:00
Gabriel de Dietrich
37a1478787 Cocoa QPA: Code clean up, make some bits more readable
Change-Id: I7f37c1b0f7f72a79bb2ac5828ba54111a90a0a00
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-10-24 16:43:43 +00:00
Liang Qi
4f9b2cb026 Remove duplicate qnx from the platform file selector names
Update the QFileSelector tests for QNX.

Co-authored-by: James McDonnell <jmcdonnell@blackberry.com>
Change-Id: I68a8fde86725596323b539433287ac1a18fac1eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-10-24 16:43:39 +00:00
Mårten Nordheim
18f0a45964 Fix redirecting all the other methods for HTTP 307 and 308
c4cf90b1f7 made POST requests be
redirected properly, but this wasn't enough and should have included
every method/verb.

Change-Id: I37b12dc9fdffcbf2aadbd2360d4fc2584c024939
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-10-24 16:43:35 +00:00
Yulong Bai
7e7683cabb QAction: fix ::setData() always emits changed()
QAction::setData() always emits changed() even without actual data change.
Original code lacks a guard to check if the data changes.
According to http://doc.qt.io/qt-4.8/signalsandslots.html,
adding guard also benefits to prevent infinite looping in case
of cyclic connections.

Task-number: QTBUG-62006
Change-Id: I776369b668082f9f02e4502a36b1ae234ee7e079
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-10-24 16:43:30 +00:00
Andy Shaw
7944423bfa Add clarifying documentation for QLayout::removeWidget()
Change-Id: I6c256c6c5cdfed6ceb45758d708fdc8f74d2939f
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2017-10-24 12:23:21 +00:00
Eirik Aavitsland
7c5475f1c0 Doc: add hint about QMimeDatabase to QImageReader::canRead()
Task-number: QTBUG-63568
Change-Id: I5b700138487dbebfc8cbe70eb3a076efceafb361
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-10-24 12:23:15 +00:00
Timur Pocheptsov
f174d31667 QHstsStore - use qAsConst in a range-loop
Found by clazy-range-loop.

Change-Id: If43e8d127697f768dc7b1871dc9fef9dcc57ad54
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-10-23 15:56:45 +00:00
Thiago Macieira
82c787ec3b Fix build on Integrity: the compiler doesn't understand this construct
"global/qrandom.cpp", line 155: error #2000-D: attribute "destructor" is not implemented and will be ignored

Task-number: QTBUG-63948
Change-Id: Icaa86fc7b54d4b368c0efffd14efa35381d4e797
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-10-23 14:21:11 +00:00
Liang Qi
32f50225c4 Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/plugins/platforms/direct2d/direct2d.pro
	src/plugins/platforms/ios/qiosclipboard.mm
	src/plugins/platforms/windows/windows.pro

Change-Id: Idffa03b3990bd642784f528821c5446b2e1008ef
2017-10-23 09:40:54 +02:00
Dmitry Shachnev
88e6f8cff2 Fix implementation of spell check underline styles
The QTextCharFormat documentation said that the used style is based on
QStyle::SH_SpellCheckUnderlineStyle style hint, however in fact the
implementation (drawTextItemDecoration in qpainter.cpp) uses
themeHint(QPlatformTheme::SpellCheckUnderlineStyle) instead since Qt 5
(see commit 1f9ae50457).

Make the documentation match that behavior, and update QPlatformTheme
to use the correct default value.

Also, switch Cocoa theme to use DotLine, as that is what native macOS
applications use.

Change-Id: I2a6bb3da6c7b0686dca87ed2c251b6abc006123c
Task-number: QTBUG-50499
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-10-21 08:45:20 +00:00
Thiago Macieira
c90d9f95d2 QRandomGenerator: improve floating-point random generation
The previous version was good, just not optimal. Because the input was
an unsigned 64-bit number, compilers needed to generate extra code to
deal with HW instructions that only convert 64-bit signed input. And
that was useless because a double uniformly distributed from 0 to 1 can
only have 53 bits of randomness.

The previous implementation did exactly what the Microsoft libstdc++ and
libc++ implementations do. In my opinion, those implementations have an
imperfect distribution, which is corrected in this commit. In those, all
random input bigger than 0x20000000000000 has a different frequency
compared to input below that mark. For example, both 0x20000000000000
and 0x20000000000001 produce the same result (4.8828125e-4).

What's more, for the libc++ and MSVC implementations, input between
0xfffffffffffff001 and 0xffffffffffffffff results in 1.0 (probability 1
in 2⁵³), even though the Standard is very clear that the result should
be strictly less than 1. GCC 7's libstdc++ doesn't have this issue,
whereas the versions before would enter an infinite loop.

Change-Id: Ib17dde1a1dbb49a7bba8fffd14eced3c375dd2ec
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-10-20 18:10:33 +00:00
Thiago Macieira
68092ba6c0 QRandomGenerator: fix the timing of the closing of the Unix random fd
Let's make it happen even later: at the time of QtCore's unloading from
memory. This prevents issues with something using QRandomGenerator after
the global static destructor would have run.

Change-Id: Icaa86fc7b54d4b368c0efffd14eed56bbbb51cb6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-10-20 18:10:31 +00:00
Błażej Szczygieł
8aadfbc657 xcb: Convert synthetic mouse enter event position to native pixels
Mouse position is converted from native pixels later, so we must
provide native pixels for "QWindowSystemInterface::handleEnterEvent".

Amends 7091be1b79

Task-number: QTBUG-63865
Change-Id: I813c171f2fc1d321af702ac30eb5f2e4232e97c4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-10-20 08:06:03 +00:00
Friedemann Kleint
571b11d41c Windows QPA: Fix build with -no-feature-tabletevent
Guard #include by QT_CONFIG.

Task-number: QTBUG-63874
Change-Id: I33f4a4c4fbdae3d25874ee9cdc3f1c7e1ab783e3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-10-20 08:05:57 +00:00
Friedemann Kleint
dcc8aa8f4e Windows/Direct2D QPA: Fix build with -no-accessibility
Task-number: QTBUG-63876
Change-Id: Ib9216977dd495e05d032e679c2f23ffe6a6953a6
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-10-20 08:00:56 +00:00
Oliver Wolff
c05268222c winrt: Fully initialize CREATEFILE2_EXTENDED_PARAMETERS struct
Not properly initializing all members of the extended parameter struct
will cause an "invalid handle specified" exception on use.

Task-number: QTBUG-63883
Change-Id: Ic3a58df864c9e29ccbadc04bd71c18c8ef34374c
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-10-20 07:46:52 +00:00
Friedemann Kleint
34c879f2e1 QNativeGestureEvent: Fix qdoc warning
Rename the parameter back to 'device', fixing:
src/gui/kernel/qevent.cpp:2776: warning: Undocumented parameter 'dev' in QNativeGestureEvent::QNativeGestureEvent()

Amends 36af37c99c.

Change-Id: I2a3f016dd6a5dda784dc851a052cb5aa1841a472
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-10-20 06:15:52 +00:00
Gabriel de Dietrich
c99d8532c8 QCocoaSystemTrayIcon: Remove unused classes
Both QNSMenu and QSystemTrayIconQMenu aren't referenced anywhere
else, including within qcocoasystemtrayicon.mm, since the QPA
backend was added.

Change-Id: I632c1b230226b2d08afce7f0f0019e9f7c030ba5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-10-20 03:22:16 +00:00
Thiago Macieira
02dc39fa8e QBasicMutex: mark the bootstrap constructor constexpr
QBasicMutex and QMutex are the same in bootstrap mode.

Change-Id: Icaa86fc7b54d4b368c0efffd14eed63343ddb51b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-10-19 15:43:26 +00:00
Richard Moe Gustavsen
6c1a2224f3 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.

Backport of 6d3c483

Task-number: QTBUG-57428
Task-number: QTBUG-63660
Change-Id: I09b4a94aef7b52773e1a79c468ead71b36dfbfc5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-10-19 13:30:09 +00:00
Mårten Nordheim
fc98878658 Fix cookie path matching for empty url path
The path wouldn't match if the cookie's path was root ('/') and the
URLs path was empty.

Change-Id: I6dcd10f1fdf4f48f14e50f1b169cbdfda7005849
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-10-19 12:51:38 +00:00
Orgad Shaneh
d57a7c4171 MinGW: Globally define WINVER and _WIN32_WINNT to enable Windows 7 API
Change-Id: I637b33ba6d05f40486d8da927ae5cc5148299348
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-10-19 10:58:59 +00:00
Gabriel de Dietrich
f13e75345d Cocoa QPA: Remove usage of OBJECTIVE_SOURCES
Change-Id: I5924ab0ddb442624f5aeeef023428be228348707
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-10-19 10:06:17 +00:00
Robert Loehning
37afba28b1 QTableGenerator: Fix handling of illegal characters in fromBase8 again
Change-Id: Iaee19f71e5b74b0d43b628739039ca3c2be60cd0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-10-19 09:15:15 +00:00
Friedemann Kleint
0521913676 QTabletEvent: Add doc note about Windows drivers
Recent drivers no longer contain wintab32.dll, point out a version
that still has it.

Change-Id: I4125a0af3c11ab739f8006b91f58899aeed54458
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-10-18 19:50:10 +00:00
Thorbjørn Lund Martsum
a1c985c10b QAbstractItemView: Make it easier to drop above and below items
Before this patch a very accurate drop position below
or above an index was needed. Therefore it was not that
easy to do.

This patch increases the above/below area to be about
18% of the item (still leaving the most space for the item).

An average user will likely be 2-3x faster with dropping
below or above (while not losing much when dropping on items).

[ChangeLog][QtWidgets][ItemViews] Made it easier to
drop above and below items.

Change-Id: I47f0f80c76878c17ebf3f93d0a0cc82755971c2a
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-10-18 10:45:21 +00:00
Nico Vertriest
19ae653f7f Doc: qtwidgets index page: wrong name for image file
windowsvista-treeview.png --> windows-treeview.png

Change-Id: I19ccec1ff5fadf2107ad47109d65f170df4b0505
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-10-18 10:43:40 +00:00
Nico Vertriest
a92cf24f9c Doc: correct filename png files
qpushbutton.h:55: warning: Missing image: windows-pushbutton.jpg
widgets.qdoc:28: warning: Missing image: windowsvista-treeview.png

Change-Id: I2ebf2aa809f8d532f597624f6ed2f9d636e860a6
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-10-18 10:43:26 +00:00
Nico Vertriest
6889626164 Doc: replace screenshot widgets tutorial with more updated version
Change-Id: I2b4fcd02c13fcd6569ebf035197da361aba40afd
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-10-18 10:43:13 +00:00
Liang Qi
3fd641c314 network: add a QT_CONFIG(bearermanagement) guard
for QNetworkReplyHttpImplPrivate::startWaitForSession().

This amends 8a39384e90.

Task-number: QTBUG-63847
Change-Id: Ic20a4ac3ab97ed25010e0679810ef64c3ff42c05
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-10-18 09:36:35 +00:00
Thiago Macieira
3fe74b76fd QHostInfo: Make getaddrinfo() mandatory
All systems must implement it by now. If there's any system still
without it, that means it has no IPv6 support, so they can disable
QtNetwork entirely.

[ChangeLog][Deprecation Notice] Starting with Qt 5.10, IPv6 support is
mandatory for all platforms. Systems without proper IPv6 support, such
as the getaddrinfo() function or the proper socket address structures,
will not be able to build QtNetwork anymore.

Change-Id: I3868166e5efc45538544fffd14d8c28046f9191b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-10-18 09:26:43 +00:00
Mårten Nordheim
c4cf90b1f7 Fix redirecting POST for HTTP 307 and 308
All POST requests that were redirected would previously turn into GET
requests. This does not follow the standard for HTTP codes 307 and 308.

Task-number: QTBUG-63142
Change-Id: Ibd25a9566066e589670a9bc34e5dc5111f8139d5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-10-17 18:50:14 +00:00
Mårten Nordheim
c5b7a3c922 Windows: Fix inability to have two topmost windows
Task-number: QTBUG-63621
Change-Id: I4ee6885d19907bff553149bef9efcffb209eb1f5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-10-17 18:08:41 +00:00
Liang Qi
7e4571b7e7 Merge "Merge remote-tracking branch 'origin/5.9' into 5.10" into refs/staging/5.10 2017-10-17 18:29:37 +00:00
Mårten Nordheim
8a39384e90 Open a session during redirects when needed
In some cases when a session isn't needed (i.e. for localhost), the
session is not opened at all. If a program (e.g. our tests) redirects
from localhost to a different system (e.g. the qt network test
servers, or the internet) it will wait for a session forever. So, we
need to check if a session is needed for the redirect-target and then
open one. It is usually opened in
QNetworkReplyHttpImplPrivate::_q_startOperation

Change-Id: Id3b78182a3fb3f63f0235ecb1fb665df8bd0c4ca
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-10-17 14:22:22 +00:00
Timur Pocheptsov
db333d6dba QNAM (redirects) - clear 'raw' headers before sending the next request
We already cleared 'cookedHeaders', which is a QHash for 'known headers'
(enumerators as keys instead of strings), now do the same for 'rawHeaders'-
not to end up with some weird mix of headers from all possible redirect
responses and the final response.

Task-number: QTBUG-61300
Change-Id: Ifd6655c4167840bb00d29446d36ce65ba2d5491a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-10-17 13:58:16 +00:00
Kai Koehne
574c8ec13c Doc: State that qDebug and friends are thread-safe
There's a common misconception that qDebug and friends are not
thread-safe, so let's explicitly state this.

Change-Id: I48d4ab8983017a9f2e7c9932a49ed573baa22929
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-10-17 13:57:45 +00:00
Frederik Gladhorn
8fcf171b42 Android Accessibility: protect from accessing invalid interfaces
I am not sure if this is going to help, but it is required that the
bridge checks that the interfaces it accesses are valid, since that
protects from accessing them when they are in the destructor.
This should be done, whether it fixes the issue or not.

Task-number: QTBUG-45855
Change-Id: I2b96999ca4043f8b33607c864d1d178695d03192
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2017-10-17 13:49:47 +00:00