Commit Graph

40962 Commits

Author SHA1 Message Date
Shawn Rutledge
f00bbd5eb7 Update QPA mouse event handling in offscreen and VNC plugins
This is needed after a37785ec76
deprecated the versions of QWindowSystemInterface::handleMouseEvent()
that were in use here.

Change-Id: Ib704ae2be905436f5a4a80ae6686b5fe3972d34c
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2019-08-30 12:40:31 +02:00
Edward Welbourne
acd7259a03 Extend QDate's benchmark
Test more methods.
Document what the existing test covers.
Use the right #include for QDate.

Change-Id: I051542c244e5bc381aafa3ae38144e246919db7a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-08-30 11:22:07 +02:00
Edward Welbourne
14aa481614 Convert foreach to ranged for in QDateTime benchmark
Change-Id: I05cf7b1916afa94a9f0f9b83af9b4ebe20a04cf0
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-08-30 11:09:59 +02:00
Edward Welbourne
0556366ddb Deduplicate list-building code in QDateTime benchmark
Aside from the start-date and the end-date, and a variant with a
time-zone, the lists various tests were building were all built the
same way; so pack that up as a pair of functions (one without
time-zone, one with) to save duplication. Make the list in each
function const, ready for conversion of foreach loops to ranged for.

In the process, replace QList with QVector, reserve space before we
populate and use auto for the now-const list variables it's saved in.

Change-Id: I7d8cce459a4d6111cd645e8d3966ad769ab7e201
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-08-30 11:09:36 +02:00
Marc Mutz
c78a716b72 QDateTimeParser: replace QVector with QVarLengthArray<12>
The lists of month and day-of-week names usually currently do not
exceed 13 elements (incl. possible leap months), so don't use
QVector, use QVarLengthArray with Prealloc = 13.

This value may be increased when ISO week-as-month is merged, but
the container remains valid even with 52 "months" (though the code
that calculates its runtime size will naturally need to be adjusted).

Change-Id: I4ead897d933f89fc092850fcc22ca41da0a6ddc6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-08-30 09:06:34 +00:00
Edward Welbourne
54f6c9bfd9 Fix unused variable warnings in QDateTime benchmark
Change-Id: Id123ace74cfa7b5ff406eabbfda0aad9f58c3fd4
Reviewed-by: David Faure <david.faure@kdab.com>
2019-08-30 10:55:46 +02:00
Edward Welbourne
06f69700af Fix some bogus date calculations in QDateTime's benchmark
Multiplying a Julian Day number by the number of milliseconds per day
does not get you a time since the start of 1970; it gets you a time
since the start of the Julian Day number system, which was several
millennia earlier.

Change-Id: Ic90a6c3de445baf9cfd30f28dd847f146e6a7adf
Reviewed-by: David Faure <david.faure@kdab.com>
2019-08-30 10:55:12 +02:00
Edward Welbourne
2faa6cafa9 Pass QDate, QTime as value classes, rather than by const reference
This can, of course, only be done in private APIs - but comment on
public APIs to do the same at Qt 6.

Change-Id: I3c79951572be3c37b0b0c5b1b05bced051a40964
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-08-30 10:54:27 +02:00
Edward Welbourne
20f69beae4 Optimize QDate by shortcutting some gregorian calendar methods
Add some static methods to QGregorianCalendar, some of which serve to
implement its methods, that QDate can use to bypass vtables and
exploit fixed truths of the Gregorian calendar in its default
handling.

Change-Id: Iec191cdf4d52945dbd5679e609180cb4fe59b5fd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-08-30 10:52:42 +02:00
Mårten Nordheim
108382e236 Mark QNetworkAccessManager::autoDeleteReplies as const
From the API review.

Amends cd816d4b6a.

Change-Id: I3d3e2ef331501fa498545c5eec0e321544165b0d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-08-29 18:16:52 +02:00
Alex Trotsenko
81408c0e76 QEventDispatcherWin32: avoid livelock in a foreign event loop
According to Windows docs, GetMessage() function retrieves the messages
from the input queue in defined order, where posted messages are
processed ahead of input messages, even if they were posted later.
Therefore, if the application produces a posted event permanently, as
a result of processing that event, user input messages may be blocked
due to hard CPU usage by the application.

It's not a problem, if an internal Qt event loop is running. By calling
sendPostedEvents() on the beginning of processEvents(), we are sending
posted events only once per iteration. However, during execution of
the foreign loop, we should artificially lower the priority of the
WM_QT_SENDPOSTEDEVENTS message in order to enable delivery of other
input messages.

To solve the problem, it is proposed to postpone the
WM_QT_SENDPOSTEDEVENTS message until the message queue becomes empty,
as it works for the internal loop.

Task-number: QTBUG-77464
Change-Id: I8dedb6837c6fc41aa6f497e67ab2352c2b4f3772
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-08-29 09:12:29 +00:00
Laszlo Agocs
2602209f54 rhi: vulkan: Introduce secondary command buffer usage
As an option. Must opt in via setting ExternalContentsInPass in
the flags for beginFrame(). It is somewhat unfortunate to require
declaring this up front, but forcing using secondary command buffers
always, even though beginExternal() may not be used in many applications,
would be an overkill.

Change-Id: I8d52bcab40c96f89f140c4c7877b6c459925e3c7
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2019-08-29 10:23:15 +02:00
Laszlo Agocs
0077e0f88c rhi: vulkan: Add missing VK_QUERY_RESULT_WAIT_BIT
Mainly to get the validation layer from newer Vulkan SDKs to shut up.

Change-Id: I3a00d2e7b5617eb1656625b1b2a919bb3c07feb9
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2019-08-29 10:23:05 +02:00
Laszlo Agocs
4e97c4061e rhi: Attempt to fix up the logic around beginExternal()
Mainly for Vulkan where it lacked the recording of the still queued
commands. Uncovered by Qt Quick examples that integrate custom Vulkan
rendering.

This still has an issue that needs to be tackled separately. (we probably
will switch to using a dedicated secondary command buffer with
RENDER_PASS_CONTINUE_BIT for the external commands, and then just have
a vkCmdExecuteCommands in our own queue instead of recording everything in
beginExternal).

The possibility of losing glMemoryBarrier() calls due to begin/endExternal()
with the OpenGL backend is fixed too. The logic here mirrors Vulkan
to some extent except that we do not have a concept of (and so the trouble
with) renderpass instances.

Clean up around the implementations of finish() as well. Attempting to share
code via a "flushCommandBuffer" function is admirable but is not worth it
since some semantics are different. (finish() cannot be called within a
begin/endPass, unlike begin/endExternal).

Change-Id: I5137db598d6a40d484e53678f5c919abf750d9ed
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2019-08-29 10:22:56 +02:00
Laszlo Agocs
2d7fc7a152 rhi: vulkan: Expose the VkRenderPass via the usual mechanisms
Qt Quick in turn will expose it via QSGRendererInterface. Essential when
adding custom Vulkan rendering into a Qt Quick application because the
custom pipeline state objects will need to reference a VkRenderPass.

Change-Id: Idf4092cfc3937830fb8123164081059b0d8d030e
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2019-08-29 10:22:41 +02:00
Volker Hilsheimer
d6551fe125 QTree/TableView: Don't emit clicked when releasing after double click
If an item is double clicked, then without this fix, the views emit the
clicked() signal when the mousebutton is released after the double click
event. This is unexpected and wrong.

QAbstractItemView keeps track of the item the mouse was pressed on, to
verify that the release occurred on the same item before emitting
clicked, and to make sure we have a valid pressed item before initiating
drag'n'drop. By resetting d->pressedItem when a double click has been
handled, we can prevent the emission of a clicked signal in the next
release event.

[ChangeLog][QtWidgets][QTreeView] Don't emit clicked signal after a
doubleClicked signal.

Fixes: QTBUG-77771
Change-Id: I05988e9e2222157f4216cebc40c22507e8d83b82
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
2019-08-29 09:52:10 +02:00
BogDan Vatra
c28b881c98 Android: Use LLVM tools where possible
Properly set CROSS_COMPILE qmake variable

Fixes: QTBUG-77890
Change-Id: I73e22d0f936d35c373c064d30ea8d92005d79b2c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-08-29 09:45:37 +03:00
BogDan Vatra
8e54fc0880 Android: AUX template doesn't require a multi arch build
Change-Id: I7b7abe7f016b4b85546986354653fc4ddf320dcc
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-08-29 09:45:34 +03:00
Tor Arne Vestbø
79bf1b7e34 widgets: Mark widgets as needing flush during painting
Except for the case of syncing in response to an expose event,
where the platform asked us to flush a specific region, we
should strive to only flush parts that have been repainted.

And we should flush those parts to their nearest native child,
instead of unconditionally flushing the root/top level widget
as well.

By allowing drawWidget to schedule the flush we automatically
flush the minimal region, to the right widgets.

Change-Id: I73c143761d4a0da6991433b41dea0a0bc83a448a
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-28 13:22:59 +02:00
Tor Arne Vestbø
984df39c79 widgets: Add logging for widget painting
Change-Id: I551ec290812369e3848c1096fed7e813cd9e1cd6
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-28 13:22:50 +02:00
Christian Ehrlicher
271d3bae38 QGraphicsItem: mark GraphicsItemChange::ItemMatrixChange as deprecated
The enum GraphicsItemChange::ItemMatrixChange is deprecated since Qt4
times. The corresponding matrix functions were also marked as deprecated
in 5.13 but the enum was forgotten. Therefore also mark it as deprecated
so it can be removed with Qt6.

Change-Id: I39bec89af14aaefe2e504f5a890ef314574766a1
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
2019-08-28 13:04:21 +02:00
BogDan Vatra
0315e1945e Android: install qmlfiles only for first ABI
qmlfiles are the same for all ABIs, and installing them for all leads to race condition

Change-Id: I69fe062f59f1d7c028dff5212e2f2fac7e71398d
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-08-28 13:50:31 +03:00
BogDan Vatra
3db14b5bd3 Say hello to -android-abis configure param
This configure parameter is useful to compile Qt only for a selected ABIs.

The old parameter, -android-arch, does the same thing, it's kept for compatibility.

[ChangeLog][Android] -android-abis configure script parameter useful to compile Qt
only for a selected Android ABIs.

Change-Id: I1f418c7e0914dd83b98d763e8cd8c09841e20fdf
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-08-28 12:36:34 +03:00
Tor Arne Vestbø
3542fc4958 widgets: Simplify QWidgetRepaintManager::flush
Change-Id: Icba88fa068aac2ac5d8bb04e46a3e3f34e279a48
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-28 10:41:29 +02:00
BogDan Vatra
4cc3615b4e Use QLatin1String where possible
Change-Id: I8f94ba4880bcac735e4445d71f0e22774d9f78eb
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-08-28 07:38:48 +03:00
Marc Mutz
00d972fa4f QReadWriteLock QT_NO_THREAD shell: make API compatible with the regular one
- add missing explicit
- drop static from member functions that aren't static in the regular version
  (ie. all functions)

As a drive-by, remove redundant inline keyword where it doesn't cause
wanton inconsistency with surrounding code.

Change-Id: I5aed73c3afa85d98d97b57c2c1874b1a5e664960
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-08-28 06:25:40 +02:00
Tor Arne Vestbø
ebec918722 widgets: Simplify markNeedsFlush in QWidgetPrivate::drawWidget
QWidgetRepaintManager::markNeedsFlush already ignores paintOnScreen
widgets.

Change-Id: I8b5d6f79c8fd60115f77d65aef05cc4baf840bdd
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-28 00:47:09 +02:00
Tor Arne Vestbø
25026defdc widgets: Clarify QWidgetRepaintManager::sync of specific widget
Change-Id: Ifa2a8245decfcb2b36c1952a39ec60b7eeca6e43
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-28 00:46:36 +02:00
Laszlo Agocs
af686f5aef Mark all rhi docs as internal
This is private API for the time being. Without this the QRhi*
classes show up in the class list in the docs.

Change-Id: I662abb9cc8eaae13ffe9266bd6313faa8e138353
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-08-27 23:08:09 +02:00
Liang Qi
4c3b221ba8 Merge "Merge remote-tracking branch 'origin/dev' into 5.14" 2019-08-27 10:29:29 +02:00
Liang Qi
0f1f7fb97f Merge remote-tracking branch 'origin/dev' into 5.14
Conflicts:
	src/widgets/kernel/qwidget.cpp
	src/widgets/kernel/qwidget_p.h
	src/widgets/kernel/qwidgetrepaintmanager.cpp
	src/widgets/kernel/qwidgetwindow.cpp
	tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp

Change-Id: Ifae457d0427be8e2465e474b055722e11b3b1e5c
2019-08-27 09:45:52 +02:00
BogDan Vatra
5bb178c479 Say hello to Android multi arch build in one go
Multi arch build in one go is need to support the new .aab packaging format.

By default the users apps are built for all Android ABIs: arm64-v8a armeabi-v7a x86_64 x86
The user can pass ANDROID_ABIS to qmake to filter the ABIs during development,
e.g. qmake ANDROID_ABIS="arm64-v8a armeabi-v7a" will build only for arm ABIs.

[ChangeLog][Android] Android multi arch build in one go,
needed to support the new .aab packaging format.

Change-Id: I3a64caf9621c2a195863976a62a57cdf47e6e3b5
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-08-26 12:59:15 +03:00
Tor Arne Vestbø
e8c70fb07f widgets: Rename QWidgetPrivate::repaint_sys to paintOnScreen
Change-Id: Ic853e42cbed9b770bef0e1d7c7376c861bceb891
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-25 23:14:52 +02:00
Tor Arne Vestbø
6dd5cb40ef widgets: Handle all flush tracking via markNeedsFlush
Change-Id: I3652c09012e36468ef90870637988b3fe8c5e735
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-25 23:14:48 +02:00
Tor Arne Vestbø
10e8faa72c widgets: Merge QWidgetRepaintManager::topLevelRect into callsite
Change-Id: Ia9bb0c396b8175f644e337ca73086208c637ed2d
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-25 23:14:44 +02:00
Tor Arne Vestbø
9b3935492b widgets: Remove unused QWidgetRepaintManager::dirtyRegion
It is no longer needed after qt_dirtyRegion was removed in e2a1fb901.

Change-Id: I120df76b08808842b304cb8de10de23ccd0e2845
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-25 23:14:40 +02:00
Tor Arne Vestbø
74be54684c widgets: Clarify how widgets needing flush is tracked
Change-Id: Ia2c2c4b830e4441e50c66dd3fef5bc060f76551e
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-25 23:14:36 +02:00
Tor Arne Vestbø
787314c230 widgets: Clarify top level flush region in QWidgetRepaintManager
Change-Id: I9a8d11569d33bf580bd50b710cf072952ea3626b
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-25 23:14:32 +02:00
Tor Arne Vestbø
dbab68a127 widgets: Use single return in QWidgetRepaintManager::markNeedsFlush
Change-Id: Ia21c5c57e4c642af2aa87b0539c4af51500a4827
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-25 23:14:28 +02:00
Tor Arne Vestbø
0af7e5564c widgets: Simplify QWidgetRepaintManager::sync
Change-Id: Ifd0cdcd7f4c03112fd93c24707e43273e211f688
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-25 23:14:24 +02:00
Tor Arne Vestbø
36d734b3f8 widgets: Rename markDirtyOnScreen to markNeedsFlush
Including renaming the member touched by this function. This leaves the
logic for appendDirtyOnScreenWidget, which still needs investigating.

Change-Id: I405a5e3757f0a79992f88d9f70867aeb7b9764d8
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-25 23:14:21 +02:00
Tor Arne Vestbø
ca3b48539d widgets: Share more code in appendDirtyOnScreenWidget
Change-Id: I0ed936c7d8b004d498a8956b1ba246ade41ce43d
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-25 23:14:17 +02:00
Tor Arne Vestbø
655e8b6eab widgets: Class initialize QWidgetRepaintManager members
Change-Id: Icc06ae8f5f542810d651e4834055cbcd1c1a4e2e
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-25 23:14:13 +02:00
Tor Arne Vestbø
1c2bcdb57a widgets: Rename a few missed uses of QWidgetRepaintManager
Change-Id: Ie28d5dea6fdf1c8728a68d419b487bc5e3e3ee16
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-25 23:14:09 +02:00
Tor Arne Vestbø
b553335651 widgets: Remove unused member in QWidgetRepaintManager
Change-Id: I2f7eac2916bdcd9101e96e78a3d7c3c6c395dde7
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-25 23:13:47 +02:00
Tor Arne Vestbø
5bcfe771a5 widgets: Merge QPlatformTextureListWatcher into implementation file
Change-Id: Icf177a5b559bd1c108a66ee14a51fb23cd36e083
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-08-25 23:13:43 +02:00
Alexandru Croitor
6a859f8112 CMake: Fix usage of non debug and release static builds on Windows
As was recently discovered, the debug_and_release CONFIG value is
always true on Windows, even if the feaure is disabled when specifying
-debug or -release when configuring Qt.

In order for the generated CMake Config files to be correct, we need
to use the true feature value.

Amends 44602224bf.

Change-Id: I42be684e8ad2a5ce72cb2e9d36f81de7589112c6
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-08-25 16:47:25 +02:00
Joerg Bornemann
7cbe1ca33d CMake: Fix detection of debug_and_release for Windows builds
If Qt is configured with -release or -debug we must set CMAKE_DEBUG_TYPE
or CMAKE_RELEASE_TYPE, but not both.

This was broken by 82a2c7df which fixed the issue for iOS
simulator_and_device builds.

We have the following situation for both relevant CONFIG values:

                           debug_and_release  build_all
iOS simulator_and_device   unset              set
Windows -release           set                unset
Windows -debug-and-release set                set

Trivia: On Windows, when configuring with -release (or -debug) then
the *feature* debug_and_release is not set.
The *CONFIG* *value* however, is unconditionally set in
msvc-desktop.conf.

Fixes: QTBUG-77754
Change-Id: I326ecb024056bc189be5fa03ec6f59bc71226544
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-25 14:47:22 +00:00
Marc Mutz
77de5a329c Long live QColorConstants!
QColorConstant is a C++11 version of Qt::GlobalColor, except that instead
of Qt::red being an enum, QColorConstants::red is an actual QColor instance,
a bit like in the Qt 3 days.

In addition, the SVG names that QColor understands are also available,
with the same values. Technically, when building a QColor from a color
name, QColor ignores casing and whitespaces; we stick to the SVG/CSS
official color names (which are lowercase), and prefix them with Svg
to clarify where they come from. For instance, note how SVG's gray
is not Qt::gray.

[ChangeLog][QtGui][[QColor] Added QColorConstants, a namespace
containing constexpr QColor instances.

Change-Id: Ic9fab26a9a537fcc43cc230da28f4c6314a32438
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-08-25 16:31:32 +02:00
Marc Mutz
fd785c3899 QtCore: port all QMutexLocker users to qt_{scoped,unique}_lock
... except four instances in QCoreApplication that would conflict with
another change.

Replace a locally-defined MutexUnlocker with a call to unlock() +
qScopedGuard'ed lock() to avoid having to spell out the locker type
while we can't depend on C++17 CTAD, yet.

In QSettings, move the new mutex locker into and out of
initDefaultPaths(), such as is idiomatic for std::unique_lock, but
wasn't possible with QMutexLocker (which is not movable).

Change-Id: I23056e13ecaa76159db583c7dccc6e05715e0788
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-08-25 12:00:28 +00:00