summaryrefslogtreecommitdiffstats
path: root/examples/sql/cachedtable
diff options
context:
space:
mode:
Diffstat (limited to 'examples/sql/cachedtable')
-rw-r--r--examples/sql/cachedtable/CMakeLists.txt33
-rw-r--r--examples/sql/cachedtable/tableeditor.cpp11
-rw-r--r--examples/sql/cachedtable/tableeditor.h8
3 files changed, 28 insertions, 24 deletions
diff --git a/examples/sql/cachedtable/CMakeLists.txt b/examples/sql/cachedtable/CMakeLists.txt
index 8dac743572..af6843b734 100644
--- a/examples/sql/cachedtable/CMakeLists.txt
+++ b/examples/sql/cachedtable/CMakeLists.txt
@@ -4,16 +4,10 @@
cmake_minimum_required(VERSION 3.16)
project(cachedtable LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/cachedtable")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
+qt_standard_project_setup()
+
qt_add_executable(cachedtable
../connection.h
main.cpp
@@ -25,15 +19,22 @@ set_target_properties(cachedtable PROPERTIES
MACOSX_BUNDLE TRUE
)
-target_link_libraries(cachedtable PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Sql
- Qt::Widgets
+target_link_libraries(cachedtable PRIVATE
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Sql
+ Qt6::Widgets
)
install(TARGETS cachedtable
- 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 cachedtable
+ OUTPUT_SCRIPT deploy_script
+ NO_UNSUPPORTED_PLATFORM_ERROR
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/sql/cachedtable/tableeditor.cpp b/examples/sql/cachedtable/tableeditor.cpp
index 97b3fa0d96..b92e256438 100644
--- a/examples/sql/cachedtable/tableeditor.cpp
+++ b/examples/sql/cachedtable/tableeditor.cpp
@@ -1,11 +1,16 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-#include <QtWidgets>
-#include <QtSql>
-
#include "tableeditor.h"
+#include <QDialogButtonBox>
+#include <QHBoxLayout>
+#include <QMessageBox>
+#include <QPushButton>
+#include <QSqlError>
+#include <QSqlTableModel>
+#include <QTableView>
+
//! [0]
TableEditor::TableEditor(const QString &tableName, QWidget *parent)
: QWidget(parent)
diff --git a/examples/sql/cachedtable/tableeditor.h b/examples/sql/cachedtable/tableeditor.h
index dfa50a8934..8c3c56b397 100644
--- a/examples/sql/cachedtable/tableeditor.h
+++ b/examples/sql/cachedtable/tableeditor.h
@@ -6,11 +6,9 @@
#include <QDialog>
-QT_BEGIN_NAMESPACE
-class QDialogButtonBox;
-class QPushButton;
-class QSqlTableModel;
-QT_END_NAMESPACE
+QT_FORWARD_DECLARE_CLASS(QDialogButtonBox)
+QT_FORWARD_DECLARE_CLASS(QPushButton)
+QT_FORWARD_DECLARE_CLASS(QSqlTableModel)
//! [0]
class TableEditor : public QWidget