summaryrefslogtreecommitdiffstats
path: root/examples/vulkan/hellovulkancubes
diff options
context:
space:
mode:
Diffstat (limited to 'examples/vulkan/hellovulkancubes')
-rw-r--r--examples/vulkan/hellovulkancubes/CMakeLists.txt36
-rw-r--r--examples/vulkan/hellovulkancubes/mainwindow.cpp2
-rw-r--r--examples/vulkan/hellovulkancubes/mainwindow.h10
-rw-r--r--examples/vulkan/hellovulkancubes/renderer.cpp2
4 files changed, 26 insertions, 24 deletions
diff --git a/examples/vulkan/hellovulkancubes/CMakeLists.txt b/examples/vulkan/hellovulkancubes/CMakeLists.txt
index 61c4ec4aee..5debb4efaf 100644
--- a/examples/vulkan/hellovulkancubes/CMakeLists.txt
+++ b/examples/vulkan/hellovulkancubes/CMakeLists.txt
@@ -1,16 +1,13 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(hellovulkancubes LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/vulkan/hellovulkancubes")
-
find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(hellovulkancubes
camera.cpp camera.h
main.cpp
@@ -26,11 +23,11 @@ set_target_properties(hellovulkancubes PROPERTIES
MACOSX_BUNDLE TRUE
)
-target_link_libraries(hellovulkancubes PUBLIC
- Qt::Concurrent
- Qt::Core
- Qt::Gui
- Qt::Widgets
+target_link_libraries(hellovulkancubes PRIVATE
+ Qt6::Concurrent
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
@@ -59,7 +56,14 @@ qt6_add_resources(hellovulkancubes "hellovulkancubes"
)
install(TARGETS hellovulkancubes
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_app_script(
+ TARGET hellovulkancubes
+ OUTPUT_SCRIPT deploy_script
+ NO_UNSUPPORTED_PLATFORM_ERROR
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/vulkan/hellovulkancubes/mainwindow.cpp b/examples/vulkan/hellovulkancubes/mainwindow.cpp
index e84436bb1d..198a168bce 100644
--- a/examples/vulkan/hellovulkancubes/mainwindow.cpp
+++ b/examples/vulkan/hellovulkancubes/mainwindow.cpp
@@ -42,7 +42,7 @@ MainWindow::MainWindow(VulkanWindow *vulkanWindow)
pauseButton->setFocusPolicy(Qt::NoFocus);
connect(quitButton, &QPushButton::clicked, qApp, &QCoreApplication::quit);
- connect(newButton, &QPushButton::clicked, vulkanWindow, [=] {
+ connect(newButton, &QPushButton::clicked, vulkanWindow, [this, vulkanWindow] {
vulkanWindow->addNew();
m_count = vulkanWindow->instanceCount();
counterLcd->display(m_count);
diff --git a/examples/vulkan/hellovulkancubes/mainwindow.h b/examples/vulkan/hellovulkancubes/mainwindow.h
index 2e931c1a52..8ecb0002e7 100644
--- a/examples/vulkan/hellovulkancubes/mainwindow.h
+++ b/examples/vulkan/hellovulkancubes/mainwindow.h
@@ -6,12 +6,10 @@
#include <QWidget>
-QT_BEGIN_NAMESPACE
-class QLCDNumber;
-class QLabel;
-class QPushButton;
-class QCheckBox;
-QT_END_NAMESPACE
+QT_FORWARD_DECLARE_CLASS(QLCDNumber)
+QT_FORWARD_DECLARE_CLASS(QLabel)
+QT_FORWARD_DECLARE_CLASS(QPushButton)
+QT_FORWARD_DECLARE_CLASS(QCheckBox)
class VulkanWindow;
diff --git a/examples/vulkan/hellovulkancubes/renderer.cpp b/examples/vulkan/hellovulkancubes/renderer.cpp
index 34023eefdb..037d97014c 100644
--- a/examples/vulkan/hellovulkancubes/renderer.cpp
+++ b/examples/vulkan/hellovulkancubes/renderer.cpp
@@ -38,7 +38,7 @@ Renderer::Renderer(VulkanWindow *w, int initialCount)
m_blockMesh.load(QStringLiteral(":/block.buf"));
m_logoMesh.load(QStringLiteral(":/qt_logo.buf"));
- QObject::connect(&m_frameWatcher, &QFutureWatcherBase::finished, [this] {
+ QObject::connect(&m_frameWatcher, &QFutureWatcherBase::finished, m_window, [this] {
if (m_framePending) {
m_framePending = false;
m_window->frameReady();