Commit Graph

40951 Commits

Author SHA1 Message Date
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
Mårten Nordheim
0d336ab313 QNetworkConnectionMonitor(win): Fix memory leak
Through some misconceptions about ComPtr I ended up thinking that it did
not call AddRef internally on creation. But it does. This lead to always
having > 1 ref-counter.

Also stop the monitor on destruction if it hasn't already been stopped.
As was already done for QNetworkStatusMonitorPrivate.

Change-Id: Ic72a2f5cb3325f86c018f90b497caaec834cb214
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-08-25 09:54:06 +00:00
Marc Mutz
97db8e04ac Port away from QMutexLocker in public headers
We can't use qt_scoped_lock/qt_unique_lock here, so port to
std::unique_lock and std::lock_guard for now.

This is in preparation of deprecating QMutexLocker in favor
of std::unique_lock and std::scoped_lock.

In QFutureInterface, change the return type of mutex() from
QMutex* to QMutex&, so we don't need to deref when passing
to std::lock_guard. We need to keep the old method around
for BC reasons, so the new one needs an artificial function
argument for disambiguation. This will vanish come Qt 6.

Change-Id: I1a0f0205952a249512ec2dbd3f0f48dd209b1636
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-08-25 04:48:11 +00:00
Friedemann Kleint
c2aaa9e18e tst_QGraphicsScene: Pass on High DPI screens
The test requires High DPI scaling to be disabled since it
captures widgets.

Turn it off initially and introduce a member variable
containing a suitable size depending on the screen to make the
test pass on High DPI screens without violating minimum window
widths on Windows.

Change-Id: Ida9f306cff6abd48ee5de7001c7670a0da60c6c2
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-08-24 08:32:24 +02:00
Friedemann Kleint
ab55046862 Brush up tst_QGraphicsScene
- Fix includes
- Add window titles
- Introduce nullptr
- Remove unneeded C-style casts in QCOMPARE
- Replace remaining C-style casts
- Use range-based for
- Fix static invocation
- Fix class structure, add override, use member initialization
- Fix top level widget leaks and add a check
- Silence debug output by using a logging category
- Use Qt 5 connection syntax

Task-number: QTBUG-76497
Change-Id: I77532a517353d04d1da43ce844988ee0ac2ffc7d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-08-24 08:31:19 +02:00
Sona Kurazyan
1b7ce85a60 Remove usages of deprecated APIs of QWheelEvent
- Replaced the usages of deprecated QWheelEvent::delta() and
  QWheelEvent::orientation() with QWheelEvent::angleDelta().
  In most of the examples it is acceptable to use only the vertical
  component of angle delta.

- Made the docs APIs to build conditionally, based on the
  deprecation version.

Task-number: QTBUG-76491
Task-number: QTBUG-76540
Change-Id: Id4230d483f724af49e4b6349b44881c3944de2a2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-08-23 21:51:43 +02:00
Allan Sandfeld Jensen
5d94aac2ba Introduce QImage::Format_BGR888
Is pretty common on some architectures so we can avoid swizzling by
supporting it.

Fixes: QTBUG-45671
Change-Id: Ic7a21b5bfb374bf7496fd2b2b1252c2f1ed47705
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-08-23 11:54:09 +02:00
Marc Mutz
e913b690b9 QtDBus: port all QMutexLocker users to qt_{scoped,unique}_lock
Change-Id: Ibba27351a81b0b132ce702c1dfd49d56f23bd8c1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-08-23 08:44:03 +02:00
Friedemann Kleint
a4a1198708 Windows: Fix some widget tests to pass on High DPI screens
For tst_QFrame and tst_QOpenGLWidget, force scaling off
since they do screen captures which would fail with
scaling activated due to different device pixel ratios.

For tst_QGraphicsItem and tst_QHeaderView, force
scaling on for Windows since some tests otherwise fail
due to violation of the minimum size constraints of
framed windows on Windows.

The tests will then pass regardless of any environment
setting of the scaling variables on a developer
machine.

Change-Id: Iefa4e84b433f7e51dce4e416546a9eda8ee6d0f1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-08-23 08:39:16 +02:00
BogDan Vatra
3f603906b4 Android: Set RTLD_NODELETE on API 23+
Change-Id: Ia4b0a6abf862e79b6d7b4c2368f44de0d05a65e9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-08-23 09:29:11 +03:00
Friedemann Kleint
d603ee689f Widget style: Use per-screen DPI in QStyleHelper::dpiScaled()
Pass the style option to dpiScaled() in order to get
the correct screen DPI. The style option contains the
font, which again contains the current DPI value.

Add QFontMetrics::fontDpi() accessors to get the DPI
from the QFont. This DPI will/should be updated on screen
change.

Replace hardcoded Q_OS_MAC DPI with hardcoded base
DPI. This makes per-screen DPI testable on macOS, too.

Task-number: QTBUG-45055
Change-Id: I75f8b37d45eb50c3334b46b8469a546d29712f1b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-08-23 01:41:33 +00:00
Morten Johan Sørvig
f1e40dd6d6 Add high-DPI scale factor rounding policy C++ API
This API enables tuning of how Qt rounds fractional scale factors, and
corresponds to the QT_SCALE_FACTOR_ROUNDING_POLICY environment
variable

New API:
	Qt::HighDPiScaleFactorRoundingPolicy
	QGuiApplication::setHighDpiScaleFactorRoundingPolicy()
	QGuiApplication::highDpiScaleFactorRoundingPolicy()

Done-with: Friedemann Kleint <Friedemann.Kleint@qt.io>
Task-number: QTBUG-53022
Change-Id: Ic360f26a173caa757e4ebde35ce08a6b74290b7d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-08-23 03:41:23 +02:00