Commit Graph

33 Commits

Author SHA1 Message Date
Kai Köhne
80a76df178 Examples: Fix whitespace issues in CMakeLists.txt
Pick-to: 6.3
Change-Id: I8e6dd1f250f8be6016ee4164cb2ab7034cbb1203
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-13 14:16:26 +00:00
Kai Köhne
51f22a3a04 Examples: Remove remaining conversion markers in CMakeLists.txt
Pick-to: 6.3
Change-Id: Ia5d474a3efd6aadbd0ef1537318f2f24e6c24fee
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-13 14:16:26 +00:00
Kai Köhne
28a9d116bb CMake: Prefer unversioned commands
Pick-to: 6.3
Change-Id: Ib32700ab82cf6b271c49e25d12fbad8c9c6bc1d1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-13 14:16:25 +00:00
Kai Köhne
7024e7a627 Examples: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiom
Also consolidate several find_package(Qt6 ...) calls in one call.

Task-number: QTBUG-98867
Change-Id: Idfd5e71f46d4489fac7411cbfadb84437a0658f3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-12-10 10:48:26 +01:00
Joerg Bornemann
ff00ef6410 Raise cmake_minimum_required to VERSION 3.16 in examples
Pick-to: 6.2
Task-number: QTBUG-95636
Change-Id: I1270b4846d8a23bc3563b6942c0910e095d2be4a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-17 19:18:54 +02:00
Laszlo Agocs
bbc6b5c3a7 vulkan: Update legacy tests and examples to the modern validation layer
Fixes: QTBUG-88388
Change-Id: Ib072f203ada5d692dea8d35da2b24db0deac0297
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-05-31 17:16:49 +02:00
Craig Scott
d97fd7af2b Build examples in isolated sub-builds using ExternalProject
Examples are intended to show how to build against an installed Qt.
Building them as part of the main build means the way the Qt targets
are defined and created are not representative of an end user's build.
By building them as separate projects using ExternalProject, we can
more closely replicate the intended audience's environment. This
should allow us to catch more problems earlier.

Having examples built as part of the main build also creates problems
with some static builds where a tool built by the main build is needed
during configure time. This happens with other repos like qtdeclarative
but not (currently) with qtbase. Converting the examples in qtbase to
be built using ExternalProject is intended as a demonstrator for how
other repos can do similar. Until other repos are converted, they will
continue to work as they did before, with examples as part of the main
build for non-static builds only.

The new build-externally behavior is only supported for non-prefix
builds with this change. Prefix builds will continue to use the old
non-external method. Support for building examples externally in
prefix builds will be a separate change.

Task-number: QTBUG-90820
Fixes: QTBUG-91068
Change-Id: I2304329940568dbdb7da18d54d5595ea7d8668bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-26 13:33:29 +02:00
Alexandru Croitor
397b372517 CMake: Regenerate examples to set the WIN32_EXECUTABLE property
As well as the MACOSX_BUNDLE properties as necessary.

Task-number: QTBUG-87664
Task-number: QTBUG-86827
Change-Id: I7677449a26d51fa853bd67bab6b3b61afbd2b12f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-27 12:49:39 +01:00
Alexandru Croitor
2ffbac7cb2 CMake: Regenerate examples to use qt_add_executable
Task-number: QTBUG-87661
Change-Id: I0dacfdc97a3fb7d88da85b67800f2c1b084d869b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-19 11:51:47 +02:00
Laszlo Agocs
cc570ce2fe Fix vulkan example build with MSVC
Undeclared identifier ssize_t etc. Just use int. Not like we can have
more than a handful of physical devices anyway.

Change-Id: Ie1fb7ab9794a7d39e84db864c2be6dbdd5d97f50
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-09-14 09:48:05 +02:00
Lars Knoll
2b0db55939 Fix compiler warning about qsizetype/int mismatch
Change-Id: I58624d8c5de0734bd0851e6744ed34c1408dfda6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-08-04 13:28:33 +02:00
Alexandru Croitor
74cb331af3 CMake: Regenerate examples
Change-Id: I1c51b10af4e2b26f54740f257164c56a0e2a03ce
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-07-09 09:38:28 +02:00
Jarek Kobus
29c99bddbf Use QList instead of QVector in examples
Task-number: QTBUG-84469
Change-Id: Id14119168bb1bf11f99bda7ef6ee9cf51bcfab2e
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-06-23 14:01:11 +02:00
Shawn Rutledge
a061a64642 Replace calls to deprecated QEvent accessor functions
Many of these were generated by clazy using the new qevent-accessors check.

Change-Id: Ie17af17f50fdc9f47d7859d267c14568cc350fd0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-08 19:11:51 +02:00
Vitaly Fanaskov
c977e74afd QtConcurrent::run: accept more then five function's arguments
[ChangeLog][Potentially Source-Incompatible Changes] QtConcurrent::run
has the following signatures: run(Function &&f, Args &&...args) and
run(QThreadPool *pool, Function &&f, Args &&...args). If f is a member
pointer, the first argument of args should be an object for which that
member is defined (or a reference, or a pointer to it). See the
documentation for more details.

Fixes: QTBUG-82383
Change-Id: I18f7fcfb2adbdd9f75b29c346bd3516304e32d31
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-03-11 14:46:25 +01:00
Liang Qi
6b2535ea15 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	examples/widgets/graphicsview/boxes/scene.h
	src/corelib/Qt5CoreMacros.cmake
	src/corelib/Qt6CoreMacros.cmake
	src/network/ssl/qsslsocket.cpp
	src/network/ssl/qsslsocket.h
	src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
	src/testlib/CMakeLists.txt
	src/testlib/.prev_CMakeLists.txt
	tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp

Disabled building manual tests with CMake for now, because qmake
doesn't do it, and it confuses people.

Done-With: Alexandru Croitor <alexandru.croitor@qt.io>
Done-With: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: I865ae347bd01f4e59f16d007b66d175a52f1f152
2020-02-13 18:31:40 +01:00
Alexandru Croitor
7610805879 Regenerate examples
Change-Id: I04b2adbe370ffea81d7787ad90e4ae69d2c165cb
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-04 18:50:39 +00:00
Topi Reinio
5d82cbcfc3 Doc: Specify install path for Vulkan examples
Vulkan examples, although part of the Qt GUI documentation project,
live under their own directory under /examples. Mark the correct
install path for these using the \meta command.

Fixes: QTBUG-81360
Change-Id: I0b98a19bf56d5b1953dbd90c0d5103be9041689a
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-01-30 10:42:57 +00:00
Frederik Gladhorn
331d1cf9fd cmake: add examples/vulkan
Fixes: QTBUG-78216
Change-Id: Id7d936ab0b3febc6b7ad3170ec2ea67836484217
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-07 07:22:09 +00:00
Edward Welbourne
4690d4efa6 Fix use of qrand/qsrand in an example
Convert an example to use QRandomGenerator::global().
This saves the need for seeding.

At the same time, use continuum random values rather than discrete
ones, to better fit what the example using it is doing.

Change-Id: I0adebaadb2e35832c629e314fda37e60b51f760d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-04-01 14:39:53 +00:00
Christian Ehrlicher
332f295743 QtBase: replace deprecated QString functions
Replace deprecated QString functions in examples and tests:
 - QString::sprintf()
 - QString::null
 - QString::fromAscii

Change-Id: I4404d17c1a65496c9079e8a7300e72a5b3740fe5
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2019-03-04 16:54:12 +00:00
Laszlo Agocs
1c6bd414dd Fix device local alloc in hellovulkantexture
Running with QT_VK_FORCE_STAGE_TEX does not work at all with recent
NVIDIA drivers due to QVulkanWindow's and the example's naive way of
picking the memory index. Enhance this and add a warning note to the
QVulkanWindow docs as well.

Change-Id: I7f200e11d982b56e3da3b71ee3915bd7bfca5cc1
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2018-09-12 08:34:15 +00:00
Laszlo Agocs
48897f97e7 Fix src access with staging buffer in hellovulkantexture
Change-Id: Iafcd94ec812a61dcfae6da43b1ca9f5771e05e56
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2018-09-12 08:34:11 +00:00
Laszlo Agocs
85f127cb04 Revise an incorrect QVulkanWindow doc note
Applying the transformation in question has no effect on the winding
order. Rewrite that section.

While all the examples are correct, clarify the rules for the geometry
they use since the winding order varies. Fix up the triangle example code
to use front=CCW for clarity (even though it does not matter much since
culling is off there).

Change-Id: Icb968c76cc9fa918a5608d3c66b4fccd5668175e
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2018-09-06 09:17:53 +00:00
Paul Wicking
8bd73ad989 Doc: Add missing full stops in briefs
Task-number: QTBUG-68933
Change-Id: I3f2a9f8c562f9a44bb32bddd31d75abbfe6de04d
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2018-06-21 14:23:30 +00:00
Friedemann Kleint
2677ad78e6 Vulkan Examples: Fix Clang warnings about initialization of VkClearColorValue
hellovulkanwindow.cpp(97,38):  warning: suggest braces around initialization of subobject [-Wmissing-braces]
    VkClearColorValue clearColor = { 0.0f, m_green, 0.0f, 1.0f };
hellovulkantexture.cpp(771,38):  warning: suggest braces around initialization of subobject [-Wmissing-braces]
    VkClearColorValue clearColor = { 0, 0, 0, 1 };
..\shared\trianglerenderer.cpp(455,38):  warning: suggest braces around initialization of subobject [-Wmissing-braces]
    VkClearColorValue clearColor = { 0, 0, 0, 1 };
renderer.cpp(896,38):  warning: suggest braces around initialization of subobject [-Wmissing-braces]
    VkClearColorValue clearColor = { 0.67f, 0.84f, 0.9f, 1.0f };

Change-Id: I3c2403699059dac2f88541f2a2102b774db0c887
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2018-04-30 08:35:15 +00:00
Laszlo Agocs
414c058ca7 hellovulkantexture: Fix issues with new validation layer
Upgrading to a recent Vulkan SDK (e.g. 1.0.61) leads to getting
a few previously unseen warnings from the validation layers.

Fix these:

vkDebug: ParameterValidation: 8: vkCreateSampler(): The
samplerAnisotropy feature was not enabled at device-creation
time, so the maxAnisotropy member of the VkSamplerCreateInfo
structure must be 1.0 but is 0.000000.

vkDebug: DS: 461375808: vkCmdPipelineBarrier():
pImageMemBarriers[0].srcAccessMask (0x4000) is not supported by
srcStageMask (0x1). The spec valid usage text states 'Any given
element of pMemoryBarriers, pBufferMemoryBarriers or
pImageMemoryBarriers must not have any access flag included in
its srcAccessMask member if that bit is not supported by any of
the pipeline stages in srcStageMask, as specified in the table of
supported access types.'

vkDebug: DS: 6: vkCmdDraw(): Cannot use image 0x7 with specific
layout VK_IMAGE_LAYOUT_GENERAL that doesn't match the actual
current layout VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL.

vkDebug: DS: 61: Descriptor set 0xc encountered the following
validation error at vkCmdDraw() time: Image layout specified at
vkUpdateDescriptorSets() time doesn't match actual image layout
at time descriptor is used. See previous error callback for
specific details.

Change-Id: I1a3200221ac725c2fa661eff3ac075262b9355c2
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-10-16 08:15:39 +00:00
Marc Mutz
5336e061ec QVulkanWindow: return QMatrix4x4 by value
The function never returns nullptr, so return the matrix by value.

Change-Id: I7c1eeb43b9693866049763565b575348ddd35548
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-05-22 09:23:15 +00:00
Marc Mutz
d3f1076d0a QVulkanWindow: use QVector, not QSet, for small int set
Apart from being more efficient to construct and test, for the
expected very small number of entries, the example code itself shows
that a sorted vector is much more useful than an unordered set.

Change-Id: Ic5e38df0176ac4be08eac6a89c2e1cabab2a9020
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-05-22 08:50:05 +00:00
Friedemann Kleint
4fd5273f61 hellovulkanwidget example: Add a widget showing debug output
Add a tab widget for vulkan info and debug log.

Change-Id: I0428bb5b6f847d0e94d62e846d34e4cb69eda5b6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-03-30 15:04:12 +00:00
Laszlo Agocs
c72b821b59 Add the Vulkan cube example
Features a little bit more than a cube, though.

Change-Id: I636d4875ba9ccf722ed3caab97f14570be785748
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-03-29 10:58:06 +00:00
Laszlo Agocs
dfef2e3f3e Clarify the front face winding order in the Vulkan examples
After applying the correction matrix the front face is CW, not CCW.

The examples work either way but fix them up to avoid reader confusion.

Change-Id: I491e6dc17c21897a59f36d32061e937f2b6c4c9d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-03-26 22:40:18 +00:00
Laszlo Agocs
8d72aba9e3 Introduce QVulkanWindow
A convenience subclass of QWindow that provides a Vulkan-capable
window with a double-buffered FIFO swapchain.

While advanced use cases are better served by a custom QWindow
subclass, many applications can benefit from having a convenient
helper that makes getting started easier.

Add also three examples of increasing complexity, and a variant that
shows embeddeding into widgets via QWindowContainer.

[ChangeLog][QtGui] Added QVulkanWindow, a convenience subclass of
QWindow.

Task-number: QTBUG-55981
Change-Id: I6cdc9ff1390ac6258e278377233fd369a0bfeddc
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-03-22 15:40:57 +00:00