Commit Graph

32987 Commits

Author SHA1 Message Date
Edward Welbourne
8095c33bcd Use qRadiansToDegrees() and qDegreesToRadians() more widely
Especially in examples, where we should show off our convenience
functions, prefer calling these functions over doing arithmetic with
M_PI (or approximations thereto) and 180 (give or take simple
factors).  This incidentally documents what's going on, just by the
name of the function used (and reveals at least one place where
variables were misnamed; the return from atan is in radians, *not*
degrees).

Task-number: QTBUG-58083
Change-Id: I6e5d66721cafab423378f970af525400423e971e
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-07-05 10:15:34 +00:00
Jesus Fernandez
827e53540c Make QTcpServerPrivate exportable
It is needed to create private implementations of classes inheriting
from QTcpServer.

Change-Id: I623aa37a6f112dc5db761bf299978ac1ccd52a2f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-07-05 10:13:16 +00:00
Liang Qi
207253384b Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev 2017-07-05 08:54:21 +00:00
BogDan Vatra
4f7507c523 Forward Service.onBind notification to Qt
It is needed to implement Android Binder in Qt.

Change-Id: I8f6f8ef778f97a444a1b16d6f62e211e188b65cc
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2017-07-04 18:38:19 +00:00
Richard J. Moore
cfbe03a6e0 QSslSocket: OpenSSL 1.1 backend
This patch-set implements a new QSslSocket backend based on OpenSSL 1.1.

1. General.

The code in this patch was organized to achieve these (somewhat contradicting)
objectives:
- keep the new code free of #if-ery, as far as possible;
- make it easy to clean away dead code when we're eventually able to retire
  out-dated OpenSSL versions;
- reduce the amount of code duplication.

If changes in some file/component were insignificant (~5 one-liners per file),
we still use pp-checks like: #if QT_CONFIG(opensslv11) ... #else ... #endif -
the logic is simple and it's still easy to clean the code if we remove the legacy
back-end. Where it saved #if-ery, we also introduced 'forward-compatible'
macros implementing equivalents of 1.1 functions using older OpenSSL.

In case some class contains a lot of version-specific ifdefs (particularly where
nested #if-ery was complex) we choose to split code into: "pre11" h/cpp files,
"shared" h/cpp files (they preserve their original names, e.g qsslsocket_openssl.cpp)
and "11" h/cpp files. If in future we remove the legacy back-end, "pre11" should be
removed; "shared" and "11" parts - merged.

2. Configuration.

We introduced a new feature 'opensslv11' which complements the pre-existing
'openssl' and 'openssl-linked' features. The 'opensslv11' feature is enabled
by a simple test which either compiles successfully or ends in a compilation
error, depending on a value of the OPENSSL_VERSION_NUMBER constant. If the
feature was enabled, we also append an additional compilation flag
-DOPENSSL_API_COMPAT=0x10100000L to make sure our new code does not contain
deprecated structures, function calls, macro-invocations from OpenSSL < 1.1.

Change-Id: I2064efbe9685def5d2bb2233a66f7581954fb74a
Reviewed-by: André Klitzing <aklitzing@gmail.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-07-04 18:03:59 +00:00
Liang Qi
c2b224a758 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/corelib/io/qprocess_unix.cpp
	src/plugins/platforms/xcb/qxcbconnection.cpp
	src/plugins/platforms/xcb/qxcbwindow.cpp
	src/widgets/util/util.pri
	tests/auto/corelib/thread/qthread/qthread.pro
	tests/auto/corelib/thread/qthread/tst_qthread.cpp

Change-Id: I5c45ab54d46d3c75a5c6c116777ebf5bc47a871b
2017-07-04 16:05:53 +02:00
Thiago Macieira
10de063ff1 QFSFileEnginePrivate::map: flags is not unused
It's used below:
    if (flags & QFileDevice::MapPrivateOption) {
        sharemode = MAP_PRIVATE;
        access |= PROT_WRITE;
    }

Change-Id: I8d96dea9955d4c749b99fffd14cd5222762699d4
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
2017-07-03 08:17:24 +00:00
Allan Sandfeld Jensen
eaee1209f0 Switch QSemaphore::tryAcquire to using QDeadlineTimer
A deadline timer is more correct for timeouts.

Also starts the timer before trying to acquire the mutex for more
precise timeouts.

Task-number: QTBUG-58745
Change-Id: I230266a3a5d7b7af33981efed4e6882e5727a41c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-07-02 20:08:36 +00:00
Liang Qi
ab2c1f9509 Merge "Merge remote-tracking branch 'origin/5.9.1' into 5.9" into refs/staging/5.9 2017-07-02 16:24:12 +00:00
Liang Qi
339dd36b27 Merge remote-tracking branch 'origin/5.9.1' into 5.9
Change-Id: Ic02646cbab8fd627bc73dac0c52d515d4084bbb0
2017-07-02 18:23:00 +02:00
Sami Nurmenniemi
d23e18189c Skip QThread stress test on Qemu
Qemu uses some memory for each generated thread. This test creates
> 80000 threads and consumes about 10Gb of memory which is too
heavy for a VM.

Task-number: QTBUG-59966
Change-Id: I1bb8a0d7955778f5201948b41befcb9f1f391514
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-02 15:58:40 +00:00
Oswald Buddenhagen
23e2cc38ff fix QMAKE_DEFAULT_INCDIRS detection with Xcode targeting uikit platforms
uikit/sdk.prf replaces QMAKE_MAC_SDK_PATH with a make expansion of that
variable, which of course does not work when we use the contents
directly.

amends 6d5489f5d.

Task-number: QTBUG-61690
Change-Id: Id77dff8ee7d737dd35f74cc7d39faaa50b4b1ab9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-07-02 15:38:32 +00:00
Oswald Buddenhagen
afdc4f439c actually make use of the detected ICU
Task-number: QTBUG-58012
Change-Id: I7a3d99277daa6566811b24111205548b89e77c53
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-07-02 15:38:25 +00:00
Stephan Binner
2fb9705521 Convert features.filesystemmodel to QT_[REQUIRE_]CONFIG
Change-Id: I862510387e79d04221ec075f3e79896908ee9d8f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-02 10:39:04 +00:00
Stephan Binner
341554e343 Convert features.fscompleter to QT_[REQUIRE_]CONFIG
Fix one #include as only QCompleter is used and not QFSCompleter.

Change-Id: Ia1e722122f7e322c678d2db6962c6086c684ddd9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-02 10:38:58 +00:00
Stephan Binner
379179df9d Convert features.errormessage to QT_[REQUIRE_]CONFIG
Change-Id: I9cc4f5190108c4bb96ddbd782ef1a031c9889f7e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-02 10:38:52 +00:00
Stephan Binner
330f024589 Convert features.wizard to QT_[REQUIRE_]CONFIG
Change-Id: I43e3d9f55a21ae0f602fc43c570321d0152cd8b6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-02 10:38:46 +00:00
Stephan Binner
3ab0ba7bf2 Convert features.colordialog to QT_[REQUIRE_]CONFIG
Change-Id: If2ac57a10f38002db5a49be3882dfc507a84a3df
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-02 10:38:40 +00:00
Sérgio Martins
7a1b7c7420 docs: Reference QOpenGLWidget::grabFramebuffer, not QGLWidget::grabFrameBuffer
QGLWidget is obsolete

Change-Id: I8db3bfd534a328d41815d445557d899dc17d6061
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-07-02 09:31:14 +00:00
Sérgio Martins
fd897629bf Fix moving a hidden QOpenGLWidget to another window
A visibile QOpenGLWidget receives a QEvent::WindowChangeInternal which triggers
a QOpenGLWidget::reset(). A hidden QOpenGLWidget never received this event
so it was never reset, resulting in a black rendering.

Includes unit-test that fails without this patch.

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

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

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

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

Change-Id: Ia53158e207a94bf49489fffd14c8cee1b968a619
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-30 21:19:10 +00:00
Laszlo Agocs
078f04254e Add support for OpenGL ES 3.2 in QOpenGLExtraFunctions
Follow the usual pattern:

Add a config test and automatic include of GLES3/gl32.h if there
is a GLES 3.2 capable header+lib at build time.

Then, regardless of this being enabled, expose all new 3.2 API
functions in QOpenGLExtraFunctions and resolve them dynamically
at run time.

This way 3.2 functions will be available when deployed to a 3.2
capable system (or OpenGL 3/4.x with the functions in question
available) regardless of what was present in the sysroot at build
time.

Change-Id: Ia52551f3178591e1e56ceac8e45d89c6b13f4927
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-06-30 18:12:58 +00:00
Thiago Macieira
bb8a61866e Linux: add a note to the ELF binary what minimum Linux is needed
Change-Id: Ia53158e207a94bf49489fffd14c8d2a1f173ff97
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-06-30 17:15:52 +00:00
Thiago Macieira
919b12d969 qglobal.h: fix build in assembler mode
QT_CONFIG and some other macros are unavailable there.

Change-Id: Ia53158e207a94bf49489fffd14c8d306e2dbd9d2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-30 17:15:51 +00:00
Andy Shaw
d0c5e29432 Respect the application and system configuration settings for the proxy
If an application proxy has been set or the usage of the system proxy
configuration has been turned off then these should be respected rather
than querying the system for the proxy. By using proxyForQuery() over
systemProxyForQuery() it ensures that it first checks if there is an
application proxy set before falling back to the system proxy, if using
the system proxy has not been turned off.

Task-number: QTBUG-61692
Change-Id: I65ed3e6bd7b3449cd4ae3757e583aa8d7724221b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-06-30 04:05:29 +00:00
James McDonnell
b2ec7317c8 Add query of default include/library paths for QNX
Change-Id: Iafc5a573a2ddb277d2a786cb6b48521985defe44
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-29 14:13:04 +00:00
Alexander Volkov
6dd61b4e62 xcb: Replace XCB_USE_XINPUT define by QT_CONFIG macro
.. and remove it from qxcbconnection_xi2.cpp as this file is build
_only_ when xinput2 is available.

Change-Id: I66d6a299c120fc034f8519cd188e1b845d5bd1bc
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2017-06-29 14:09:33 +00:00
Tor Arne Vestbø
92cfa3dfa6 macOS: Remove workaround for crash when closing window from title bar
The platform window is now protected by a QPointer, so we don't need
to juggle the NSWindow retain count.

Task-number: QTBUG-37287
Change-Id: Id55ea311f0793370e248aa58cc8e383b574fbb40
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-06-29 12:21:59 +00:00
Tor Arne Vestbø
d95414171f macOS: Remove unneeded Objective-C instance variable declarations
And their corresponding synthesizations. The compiler will take care
of it for us.

Change-Id: Ifa42e0732059008af6f3f65151bf203a1a19079d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-06-29 10:46:04 +00:00
Mårten Nordheim
5cc5c97554 Doc: Add note about fromPercentEncoding's behavior on invalid input
Add a note saying that invalid input to QByteArray::fromPercentEncoding
and QUrl::fromPercentEncoding will produce invalid output, and provide
an example.

Change-Id: Icc68f59c23cf199640b646cd4a6ca8e4808a3f71
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-06-29 10:15:30 +00:00
Tor Arne Vestbø
85cbd35178 macOS: Remove workaround for queued input events to stale windows
We now track the platform window with a QPointer, so the event callbacks
can (and do) check the validity of the platform window before passing
them on. The window property of the NSView is also nil at the point of
even delivery, if we need another way to check if the event is still
valid.

Task-number: QTBUG-39211
Change-Id: I6179bdb3af9606cd0abf981c0fe6cacb9a2d98ab
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-06-29 10:13:39 +00:00
Stephan Binner
3aed1fccda Convert features.fontcombobox to QT_[REQUIRE_]CONFIG
Change-Id: I98f85cdb3b1c1ceae010362a5d5747d62ba62a22
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-29 02:25:12 +00:00
Stephan Binner
bf6f91e527 Convert features.statustip to QT_CONFIG
Change-Id: Ic719ab93ed1802fcc713885ad0421cb44c7a998b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-29 02:23:52 +00:00
Stephan Binner
63cc734abb Convert features.messagebox to QT_[REQUIRE_]CONFIG
Change-Id: Ie25dc672f8a675c06585c7757255f7dbadbfc5ec
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-29 02:23:22 +00:00
Stephan Binner
003dc8e29a Convert features.inputdialog to QT_[REQUIRE_]CONFIG
Change-Id: Ie480efcfc1fdc00e2b2697cf4c5abb231b42cc0e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-29 02:23:08 +00:00
Stephan Binner
fd4f9c5e0c Convert features.progressdialog to QT_[REQUIRE_]CONFIG
Change-Id: Ic12a30480260e426f106baf7e2121889ea01db88
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-29 02:22:58 +00:00
Stephan Binner
1ebe68b01f Convert features.filedialog to QT_[REQUIRE_]CONFIG
Change-Id: I9bc229b0d1430b81eeb2cfca2b24474736d5d561
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-29 02:22:48 +00:00
Stephan Binner
150ee7f4f1 Convert features.whatsthis to QT_[REQUIRE_]CONFIG
Move feature definition to gui/configure.json

Change-Id: I00b35c0e259d0a695d84a9bf6803eba74d41465a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-29 02:22:34 +00:00
Jake Petroules
fa7626713b Allow using Xcode Command Line Tools to build Qt
Some users don't want to download the full Xcode installation which can
weigh upwards of 5 GB download and 20 GB installed.

[ChangeLog][macOS / iOS] Qt can now be built using just the Xcode
Command Line Tools, without needing to install the full Xcode IDE.

Task-number: QTBUG-35928
Task-number: QTBUG-41908
Change-Id: I6d13c9a03ab9087b3ab56e8547f53f0cc2806c7b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-06-29 02:00:12 +00:00
Jake Petroules
3c89c71da5 Fix handling of deprecated QMAKE_IOS_TARGETED_DEVICE_FAMILY
Since the mkspecs always set QMAKE_APPLE_TARGETED_DEVICE_FAMILY, it will
never be empty, and the warning message and automatic fallback to
QMAKE_IOS_TARGETED_DEVICE_FAMILY will never be used.

Task-number: QTBUG-60430
Change-Id: I79e36d355dae3f8a4429d73e753fed3c090a5d24
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-29 02:00:05 +00:00
Oleg Yadrov
6e9d24212d QTabBar: fix expanded tabs appearance
Fix regression introduced by 175f33ed8. 'expanding' property set to true
was ignored when QStyle::styleHint() returned Qt::AlignRight for
SH_TabBar_Alignment.

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

Task-number: QTBUG-61480
Change-Id: I6a1827ae8a3f2c6bee5124c18c7f2b1c0a7862f3
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-06-28 22:47:13 +00:00
Thiago Macieira
ffe8884ac3 QProcess/Unix: move strerror() up from child to parent
In theory, there's nothing wrong with having it in the child process. In
practice, we've found that strerror/malloc can hang: if an application-
wide lock was held by another thread before fork(), the child process
could wait forever for an unlocking that will not happen (no threads
running). See https://sourceware.org/bugzilla/show_bug.cgi?id=19431

As an added bonus, we now use qt_error_string(), which may produce
slightly different text from strerror.

[ChangeLog][QtCore][QProcess] Added a workaround for a rare race-
condition bug in some C libraries that caused the child process started
by QProcess to hang after trying to launch a non-existent executable or
change to a non-existent directory.

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

Change-Id: Id012d88b7b20c5c9f128f2ef53753cc1d479f358
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-06-28 17:58:13 +00:00
Friedemann Kleint
4f7be34a42 Windows code: Add Q_FALLTHROUGH or break to unmarked fallthroughs seen by GCC 7
Rearrange code handling QtWindows::DisplayChangedEvent.

Change-Id: If9f32516108fb64c4a252c84392f2fd7f1872bf1
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-06-28 17:57:53 +00:00
Friedemann Kleint
2087f120c3 QNativeSocketEnginePrivate::nativeAccept(): Add missing break
Fixes GCC 7 warning:
socket\qnativesocketengine_win.cpp:888:21: warning: this statement may fall through [-Wimplicit-fallthrough=]

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

Task-number: QTBUG-61673
Change-Id: I376bec81f52d75c9b601f2af9b7e0b63f5883bb0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-06-28 17:54:07 +00:00
Friedemann Kleint
807f3d32b1 tst_QSharedPointer: Terminate hanging qmake-processes
Change-Id: I580ff3ccbecba81c09ce3fc3e082b906f956171d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-06-28 17:53:24 +00:00
Tor Arne Vestbø
c888d302bc Fix QAbstractEventDispatcher::installNativeEventFilter documentation
Change-Id: I73c8385d4ef175acad218993be32494eb3a0d6e0
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-06-28 17:12:57 +00:00