Commit Graph

33944 Commits

Author SHA1 Message Date
Jake Petroules
7fd3cc3980 Clean up OS version checks for Apple platforms
Convert QSysInfo/QOperatingSystemVersion to __builtin_available where
required or possible, or to QOperatingSystemVersion where
__builtin_available cannot be used and is not needed (such as negated
conditions, which are not supported by that construct).

Change-Id: I83c0e7e777605b99ff4d24598bfcccf22126fdda
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-29 03:30:13 +00:00
Tony Sarajärvi
06cb408979 Add support for ICC in toolchain.prf
Task-number: QTBUG-62531
Change-Id: Ie15a349c830258058d48c9da18b52b343bdb943a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-29 03:19:57 +00:00
Gabriel de Dietrich
8ea5c40109 QWindowsMouseHandler: Add documentation link for bitmask magic
Change-Id: I743aef0e15ef42347c5222d0e50577b006483cc4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-09-28 16:48:23 +00:00
Timur Pocheptsov
0f5c4ba7cb QtNetwork (examples) - update the fortune server example
Unlike client, this needs a bit more changes:
- remove redundant (and outdated) stdlib.h includes
- use QRandomGenerator (instead of qsrand/qrand pair)
- replace QStringList with QVector<QString>
- Q_NULLPTR->nullptr, ExplicitType * -> auto
- fix some weird indentation

Task-number: QTBUG-60628
Change-Id: I12eed12711b1e622407bd8ecd1afdf56a2cf2097
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-09-28 14:07:26 +00:00
Timur Pocheptsov
9e268185bb HTTP/2 protocol handler: set the redirect URL on reply
For HTTP/1 it's done when no data expected and response headers received -
protocol handler emits channel->allDone which handles the status code and
sets (if needed) a redirectUrl. HTTP/2 protocol handler cannot emit allDone
(it has many requests multiplexed and actually cannot say allDone yet).
So we set a redirect url if we have the corresponding status code and
found 'location' header. Before it's too late.

Task-number: QTBUG-63471
Change-Id: Icfa871fb999e676650d62c45a20e689596da4028
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-09-28 14:04:28 +00:00
Orgad Shaneh
1cb5943aee QFileSystemEngine: Remove unneeded test for relative symlink
symLinkTarget should always return absolute path.

Change-Id: Id0078924d2f0befdea91e652a6c7775707c1b3c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-28 12:42:07 +00:00
Orgad Shaneh
8805fdb391 QFileSystemEngine: Minor cleanup in unix
Change-Id: I4a123484ea1f5e53af85a52e86d4a80cef1cd7bc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-28 12:41:58 +00:00
Anders Hafreager
cbbf843e96 macOS: Bail out early when handling shortcut event results in closing window
When Cmd+W is used to close a window, check if m_platformWindow is still valid
before accessing window property.

Task-number: QTBUG-63389
Change-Id: I9abda19b8482e7a1fd07b07d8981b6a768e96c2e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-09-28 12:30:29 +00:00
Tor Arne Vestbø
eb2e984da1 macOS: Apply window file path when creating new NSWindow
Otherwise QWindow::setFilePath() before create() would have no effect.

Change-Id: Ia2171054aa13e21316d525193d330efaf4653dbf
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-09-28 12:21:23 +00:00
Paul Olav Tvete
ff2e9a17e7 Fix crash when reparenting window container
QWindowContainer assumed that a widget could never change from
native to non-native. This is not a fact when the window container
is reparented to toplevel and back. In this case, usesNativeWidgets
would be stuck at true, and parentWasChanged() would go down the
native widget path, triggering an assert.

The solution is to always recalculate the usesNativeWidgets bool.

Task-number: QTBUG-63168
Change-Id: I88178259878ace9eb5de2ee45ff5e69b170da71c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
2017-09-28 12:09:27 +00:00
Eirik Aavitsland
621c5baf66 Fix element overwrite in QRandomGenerator's fallback function
Copy into the intended array elements, not into the start of the
array.

Change-Id: I05c4ece2450583c9358aa1eddfd702262e995146
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-28 11:25:06 +00:00
André Klitzing
9c13ec5fa3 Replace bundled libjpeg by libjpeg-turbo 1.5.2
Most linux distribution uses libjpeg-turbo as a replacement for libjpeg.
Since Qt will be linked against -turbo more frequently than the "original"
libjpeg we should use it for the bundled copy, too.

Also add an import script.

[ChangeLog][Third-Party Code] Replaced bundled libjpeg by libjpeg-turbo 1.5.2

Change-Id: I41081db74f194cbc288820fc783c9fef16545efd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-09-28 10:06:26 +00:00
Timur Pocheptsov
0731c092d1 QtNetwork (examples) - update the fortune client example
Minimal changes: Q_NULLPTR->nullptr, Type->auto where initializing expression
self documents the type actually.

Task-number: QTBUG-60628
Change-Id: I2fa784aeb30ac40c6b78e34dd58ad837ad607180
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-09-28 09:29:41 +00:00
Timur Pocheptsov
553b6ab9cd QtNetwork (examples) - update multicastreceiver example
... as soon as we updated multicastsender. Changes are minimal and mostly
cosmetic - use 'explcit' and 'nullptr' where appropriate, make a socket
data-member and not a pointer, move the 'datagram's declaration outside
of a loop.

Task-number: QTBUG-60628
Change-Id: Icfa46e6d2844c40a605f2f4066847594943a8ea8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-09-28 09:28:18 +00:00
Jan Arve Saether
36af37c99c Fix BIC issue with QNativeGestureEvent
Problem was for 32 bit macOS, or if QT_COORD_TYPE was configured
to be float.

Change-Id: I0a3d3d305f2e8a0f9be7c40f4fef7eabf4643d05
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-09-28 04:45:35 +00:00
Friedemann Kleint
267b1a140a regularexpression example: Fix compilation with clipboard disabled
Use the new configure system consistently.

Task-number: QTBUG-63429
Change-Id: I6668ba9fde09492f3e60e614103e18e88783d0c4
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-09-28 04:14:02 +00:00
Tony Sarajärvi
e96c56c740 Blacklist tst_QWindow:testInputEvents on RHEL 7.4
Swapping from RHEL 7.2 to 7.4 produces new autotest failures.

Task-number: QTBUG-63433
Change-Id: I3e59aa73b5874cfec06e166f521e06b0c7829743
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-09-27 18:46:51 +00:00
Jake Petroules
70422449ef Add a "shim" to allow use of Clang 5's __builtin_available everywhere
This is mostly relevant for Apple platforms, where we can use the new
unguarded availability warnings to guarantee that proper version checks
are present when using APIs that are not necessarily available on the
deployment target.

Change-Id: Ie408704b2924e1220491a9ea30f0141dfa4867d9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-27 16:40:49 +00:00
Timur Pocheptsov
9d2cdb163f QtNetwork (examples) - update broadcastreceiver too
... as soon as we updated the 'sender' example. Changes are purely cosmetic
though - 'explicit', nullptrs and local variables instead of redundant
data-members (QPushButton).

Task-number: QTBUG-60628
Change-Id: I572219da9d2a0ced07d94efb6f52f00b5a9c546d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-09-27 16:35:11 +00:00
Thiago Macieira
1402f5d16e Workaround GCC 6 parsing error ("used but never defined")
GCC 7 and other compilers compile this code just fine. GCC 6 fails, so
this is clearly a compiler bug. So revert the implementation of the
qWait() function back to the original, to make the problem disappear.

 qtestsystem.h:58:42: error: ‘bool QTest::qWaitFor(Functor, int) [with Functor = bool (*)()]’ used but never defined [-Werror]

Change-Id: I0b48fc8e90304e0dacc3fffd14e8110138cc9f45
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-09-27 15:53:04 +00:00
Thiago Macieira
9fcbef15f6 Fix build: move Q_REQUIRED_RESULT to the right position
If you're using GCC 7 or Clang 4, Q_REQUIRED_RESULT expands to
[[nodiscard]] that must appear in as specific place on the line.

 qcompilerdetection.h:1182:29: error: attribute ignored [-Werror=attributes]
 qtestsystem.h:58:12: note: in expansion of macro ‘Q_REQUIRED_RESULT’
     static Q_REQUIRED_RESULT bool qWaitFor(Functor predicate, int timeout = 5000)
            ^~~~~~~~~~~~~~~~~

Change-Id: I0b48fc8e90304e0dacc3fffd14e80ede168d5c6b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-09-27 15:40:06 +00:00
Sérgio Martins
ef0129bb66 Don't read the statx struct in case of failure
Change-Id: I62d98e4463003a1da8f28318d82635f6e0b2cc8c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-27 15:35:58 +00:00
Edward Welbourne
d5ae3b1747 Reorder defines to respect alphabetic order in bootstrap config
Apparently it's all meant to be in alphabetic order by feature name
(except for where it isn't).  So move my new addition to it to where
that would put it, re-order everything else to follow that rule and
add a comment documenting it.

Change-Id: I6f00d3d18fc8c492992e9f701520f3e8731739b5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-09-27 13:15:50 +00:00
Joerg Bornemann
16f144db29 Do not define _HAS_EXCEPTIONS=0 in MSVC builds
This definition causes a build error if concrt.h is included.

According to Microsoft [1], this macro is unsupported. It was added in
f5908363 to silence compiler warnings that are generated when exceptions
are turned off and certain STL headers are included.

We specifically disable the warnings in question now.

[1] https://blogs.msdn.microsoft.com/vcblog/2015/07/14/stl-fixes-in-vs-2015-part-2/

Task-number: QTBUG-63409
Change-Id: I567d5d46292fbd7898394e217bb0987fbcdca9de
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-27 13:13:41 +00:00
Alex Trotsenko
f03cd9a7bc QAbstractSocket: fix handling of successful connectToHostByName()
In case connectToHostByName() returns 'true', we should fetch the
connection parameters and emit connected() signal.

Change-Id: Id36b6d71005b8cec070a1b12e7bb0caf8bf0bcb9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-09-27 08:37:57 +00:00
Kai Uwe Broulik
3c59065d5c qglxconvenience: Avoid null pointer dereference
glXGetVisualFromFBConfig according to documentation can return NULL [1].
This may result in a crash when running Qt applications using ARGB windows
with XLIB_SKIP_ARGB_VISUALS defined.

Also guard QXlibScopedPointerDeleter against illegally calling XFree(nullptr).

[1] https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glXGetVisualFromFBConfig.xml

Task-number: QTBUG-58910
Change-Id: Ie076a1e906ed632543bdab03ef365f699533a61a
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2017-09-27 08:35:28 +00:00
Eric Lemanissier
3d0fa4d4fb moc: remove useless cast in qt_static_metacall generated code
_a[1] was reinterpret_casted twice in a row, which triggers
clang's warning undefined-reinterpret-cast:
"dereference of type '_t *' (aka ...) that was reinterpret_cast
from type 'void **' has undefined behavior "
only the last reinterpret_cast is kept

Change-Id: I71d52c5ff08c674003aec29f8a907c90905c0d4c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-09-27 07:04:02 +00:00
Sze Howe Koh
33693473d4 Remove unnecessary copying in QSet::subtract()
Task-number: QTBUG-42810
Change-Id: I5d4793a12b078e34bea034b4500e270d42609de0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-27 00:56:04 +00:00
Thiago Macieira
f7350ac99e Improve qustrlen further by avoiding the alignment prologue
This avoids looping prior to the main 16-byte loop, by performing one
load that may include bytes prior to the start of the string. This is
guaranteed not to fault, since str points to a valid character, but it
may cause Valgrind to print warnings.

Change-Id: I6e9274c1e7444ad48c81fffd14dcae854bba24b2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-26 18:19:35 +00:00
Paul Olav Tvete
35781b3588 Return focus to correct widget after showing menu
By the time we call setKeyboardMode(true), the menu may
already have taken focus. This change sets keyboardFocusWidget
before opening the popup, and makes sure that keyboardFocusWidget
is not set to the popup. (We cannot remove the assignment from
setKeyboardMode(), since it's called from several places.)

[ChangeLog][QtWidgets] Fixed widget losing focus after showing
menu second time.

Task-number: QTBUG-56860
Change-Id: Ic01726bf694e6f365dd7b601ad555156e0fdf6c5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-09-26 13:38:06 +00:00
Tor Arne Vestbø
49154acde3 macOS: Deliver NSWindow notifications to all windows, not just top level
Child QWindows (or in the case of QWindows embedded in native applications:
top level QWindows where the corresponding NSView is a child of another
view, so not being the contentView of its window), still need some of the
NSWindow notifications to e.g. update their exposed state when the window
becomes visible.

We make sure to send the notification to all QCococaWindow children of
the relevant NSWindow, and let each callback decide if it should only
apply to content views.

This fixes an issue where a QWindow would never be exposed if the window
was a child NSView and added to a NSWindow that was yet to be shown.

Change-Id: I7f7df8bc5f4ca3ac553a2c146f8c3229b197c059
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-09-26 12:50:05 +00:00
Tor Arne Vestbø
44c304cefb Reset QWindowPrivate::platformWindow during destruction before deleting it
Otherwise the deletion of the platform window may result in platform events
that then conclude the QWindow has a valid platform window and calls into
it, when it's been half-way destroyed.

Change-Id: If9eaad1b4e6aa414ba0f96475756a2146e0c01d5
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2017-09-26 12:50:01 +00:00
Gatis Paeglis
542e11ab2b tests: make exposeEventOnShrink_QTBUG54040 not flakey on xcb
From: https://tronche.com/gui/x/xlib/events/exposure/expose.html

"The circumstances in which the X server generates Expose events
are not as definite as those for other events."

On windows with XCB_GRAVITY_NORTH_WEST flag set we should not get
expose events according to e2665600c0,
but as stated earlier this might not always be true.

Nevertheless, sometimes we get expose event from X server when shrinking
window, but most of the time we don't. Make the test not flakey by
checking that we get at least 1 expose event, instead of exactly 1.
Now running test 500 times in a loop does not fail.

Task-number: QTBUG-63424
Change-Id: I8004e622020cc09e11b7d592faf6d9ee1b9cfee2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-09-26 12:49:59 +00:00
Tor Arne Vestbø
113de68543 macOS: Don't send expose event as update request when becoming visible
QGuiApplicationPrivate::processExposeEvent updates the QWindow's exposed
state, so we need to call QWindowSystemInterface::handleExposeEvent()
when going from non-exposed to exposed.

Change-Id: I461b2fb27cd8fd4bdb250d05d47f9af6cb3eb15c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-09-26 12:49:40 +00:00
Allan Sandfeld Jensen
807fa90b32 Fix crash with clips entirely outside glyph map
When the range to work on is empty just continue to next span.

Task-number: QTBUG-63412
Change-Id: Ic5cb77ed438eb9c218f482095aa0cd4e3c2fc6e6
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-09-26 12:05:13 +00:00
Andy Shaw
2b51ad4712 Cups: Check the created QPrintDevice is valid before using it
Task-number: QTBUG-63293
Change-Id: Ibde0e8db955f6f3647b31cef8561d0744754cec1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-09-26 12:05:01 +00:00
Friedemann Kleint
bc31d2235c Windows QPA: Call raise() also for SubWindows with WindowStaysOnTopHint
QMdiSubWindows may have WindowStaysOnTopHint set.

Task-number: QTBUG-63121
Change-Id: I21f80311fdf57e775df895122299bb7beb6ec4e6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-09-26 08:06:50 +00:00
Friedemann Kleint
f1ec81b543 Windows QPA: Detect screen by mouse position when dragging a window
When dragging a window by its border, detect the screen by mouse position
to prevent it from oscillating between screens when it resizes.

Task-number: QTBUG-62971
Change-Id: I0a4a584ef8ff3bb7288d1abec4de51fb4091dccd
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2017-09-26 07:19:32 +00:00
Timur Pocheptsov
a732e16d5f QtNetwork (examples) - update multicastsender
Similar to broadcast sender:

- where possible use local variables instead of data-members
- where possible avoid heap-allocated objects, use sub-objects instead
- change signal-slot connection syntax (and as a "bonus" - show our QOverload)

Task-number: QTBUG-60628
Change-Id: I8cd4f888c1d0653bdc8591800e713bbd347ad2fb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-09-25 18:43:35 +00:00
Orgad Shaneh
b4e9cb4c29 Qmake: Introduce and use QMAKE_NULL_DEVICE variable
Task-number: QTBUG-62985
Change-Id: If1a4cabd54df7d69be1a580dc120f75d6c6b2092
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-09-25 17:08:01 +00:00
Timur Pocheptsov
ddb191e47a QtNetwork (examples) - update secure socket client example
This patch contains:

- some cosmetic changes to  make example look more like
  modern C++;
- UI initialization code and SSL signals handling were split
  into separate member-functions;
- useless checks 'if (socket)' were deleted;
- widget's minimum size is now fixed + font size
  in 'CertInfo' dialog increased to make it readable.

Change-Id: I7aadb78896832a989494d280d6da0635045f948c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-09-25 13:59:50 +00:00
Friedemann Kleint
7896efdd9f QNativeGestureEvent: Fix documentation
Fix qdoc-warnings:

src/gui/kernel/qevent.cpp:2772: warning: Undocumented parameter 'dev' in QNativeGestureEvent::QNativeGestureEvent()
src/gui/kernel/qevent.cpp:2794: warning: No documentation for 'QNativeGestureEvent::device()'

Change-Id: I845b0925ad4f1d8602455444ebbd4ec6320ebae7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-09-25 13:32:39 +00:00
Rainer Keller
bde42ffb8b Avoid window geometry jittering when changing geometry from JavaScript
The QML API allowed only separate setting of geometry parameters which
causes flickering when all parameters need to be changed.
By exposing the setGeometry function it is possible to set all of these
at once using an imperative setGeometry call from JavaScript.

Note that bindings for x/y/width/height are still evaluated
sequentially, resulting in four calls to the platform window's
setGeometry. This patch only introduces an imperative workaround for
that issue.

Change-Id: Ie9b0d3c39434740e50757ba7cff0385ae80f47f4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-09-25 12:56:04 +00:00
Tor Arne Vestbø
292cb12e02 testlib: Add qWaitFor to wait for predicate
Reduces duplication of logic and allows other primitives to be
built on top.

Change-Id: Ia100014cfb0c09ac2f47c3a156d0c76f0fddafa8
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2017-09-25 12:19:18 +00:00
Michal Klocek
bd72ead4d1 Fix docs about QMAKESPEC in INCLUDEPATH
QMAKESPEC is added in makefile generator,
it is not in INCLUDEPATH.

Change-Id: I2451b3c7b30bc237157e68e5ce9de67f55e784b2
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2017-09-25 10:22:11 +00:00
Friedemann Kleint
d03dba3f4a Windows QPA: Move function to find screen by HWND to QWindowsScreenManager
Task-number: QTBUG-62971
Change-Id: Ida0a8e758723f0f617011a89dc89c266d2506aad
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-09-25 10:11:07 +00:00
Edward Welbourne
aa4fef8812 Make QDateTimeParser a separate feature
It was being mis-described in some places by a QT_CONFIG(timezone)
test, replacing older QT_BOOTSTRAPPED checks; but it has no time-zone
dependency (until 5.10).  So make it a separate feature in its own
right.

It turns out QAbstractSpinBox's presumed dependency on datetimeedit
was an illusion caused by use of QDATETIMEEDIT_*_MIN symbols actually
provided by datetimeparser; so remove its bogus dependency.

Change-Id: Ibc12f4a9ee35acb64a39a1c7a15d2934b5710dc0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-25 09:54:22 +00:00
Gatis Paeglis
2c35ef04ff doc: fix code snippet of qConstOverload usage
Change-Id: I11628d2f9372f21f371ccf93000c26079eb9ef72
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-09-25 08:44:17 +00:00
Olivier Goffart
4dcd9145e7 moc: don't use const_cast in qt_metacast generated code
qt_metacast is not const so there is no need to use const_cast.
This fixes a warning in generated code.

Task-number: QTBUG-63352
Change-Id: I0c37442ac268a654316bc0e7e04f77fb51cae019
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-25 07:43:39 +00:00
Richard Moe Gustavsen
0dbede2b17 Widgets: be able to tab to a widget that has a focus proxy
When tabbing/searching for the next focus widget, the current
code would check if the next widget in the focus chain
had a focus proxy, and if so, ignore it. The exact reason
for this behavior is not clearly understood, but some widgets
(e.g QSpinBox) has children (a QLineEdit) that sets the parent
as focus proxy. If we didn't ignore children with focus proxy, tabbing
from a QSpinBox would lead us to find the inner QLineEdit, which
(because of its proxy), would lead us back to the QSpinBox. And
therefore not be able to tab out.

But ignoring the focus proxy has other problems. Normally a focus
proxy is the next sibling to the widget it acts as a proxy for, and
tabbing to the widget will therefore appear correct. But if the
focus proxy is not the next sibling, the logic will fail, since
the tab would anyway give focus to the next sibling. This becomes very
apparent if the focus proxy is a child of the widget, since then
its likely that the focus proxy is not the _first_ child among all
the children. So tabbing to the parent would not give focus to
the proxy.

This patch will change this logic so that you are allowed to tab to a
widget with a focus proxy. But we check that if you do so, you actually
end up moving focus in the right direction. If not, we ignore it like
before. This will ensure that we tab correctly when dealing with focus
proxies, and especially when focus proxies are used to construct
compound widgets.

[ChangeLog][Widgets] When tabbing to a widget with focus proxy, focus
will now be given to the proxy rather than just being ignored.

Task-number: QTBUG-10907
Change-Id: I66d1da5c941fdd984bb2783cc355ca65b553b5dd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-09-25 07:18:37 +00:00