summaryrefslogtreecommitdiffstats
path: root/examples/designer/customwidgetplugin
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-01-24 09:48:14 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-02-02 10:56:31 +0000
commit4ef78d5bbf021ba0723f6cc14aba8ef65d3218c5 (patch)
treea4f0c6598be6b4cc53322414f2467e7682b0fb60 /examples/designer/customwidgetplugin
parent6992ba6c3ddc1ad517b6f88ff1e14e1471d735f5 (diff)
Qt Designer examples: Add explanation of CMake project files
Task-number: QTBUG-110447 Change-Id: I36769acc50921c2e6af33288b8e291b56328ddc7 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> (cherry picked from commit 64fab45f2696a4a54aa07136d6100b47454c488d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples/designer/customwidgetplugin')
-rw-r--r--examples/designer/customwidgetplugin/CMakeLists.txt11
-rw-r--r--examples/designer/customwidgetplugin/customwidgetplugin.pro15
2 files changed, 19 insertions, 7 deletions
diff --git a/examples/designer/customwidgetplugin/CMakeLists.txt b/examples/designer/customwidgetplugin/CMakeLists.txt
index 6174d4d66..91365b2fb 100644
--- a/examples/designer/customwidgetplugin/CMakeLists.txt
+++ b/examples/designer/customwidgetplugin/CMakeLists.txt
@@ -3,28 +3,37 @@ project(customwidgetplugin LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
+#! [0]
find_package(Qt6 REQUIRED COMPONENTS Core Gui UiPlugin Widgets)
qt_add_plugin(customwidgetplugin)
+#! [0]
+
+#! [1]
target_sources(customwidgetplugin PRIVATE
analogclock.cpp analogclock.h
customwidgetplugin.cpp customwidgetplugin.h
)
+#! [1]
set_target_properties(customwidgetplugin PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+#! [2]
target_link_libraries(customwidgetplugin PUBLIC
Qt::Core
Qt::Gui
Qt::UiPlugin
Qt::Widgets
)
+#! [2]
if(QT6_INSTALL_PREFIX)
+#! [3]
set(INSTALL_EXAMPLEDIR "${QT6_INSTALL_PREFIX}/${QT6_INSTALL_PLUGINS}/designer")
+#! [3]
else()
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
@@ -32,8 +41,10 @@ else()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/plugins/designer")
endif()
+#! [4]
install(TARGETS customwidgetplugin
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
+#! [4]
diff --git a/examples/designer/customwidgetplugin/customwidgetplugin.pro b/examples/designer/customwidgetplugin/customwidgetplugin.pro
index 1447acdc4..92abd7529 100644
--- a/examples/designer/customwidgetplugin/customwidgetplugin.pro
+++ b/examples/designer/customwidgetplugin/customwidgetplugin.pro
@@ -1,6 +1,6 @@
-#! [0]
+#! [1]
QT += widgets uiplugin
-#! [0]
+#! [1]
QTDIR_build {
# This is only for the Qt build. Do not use externally. We mean it.
@@ -11,22 +11,23 @@ CONFIG += install_ok
} else {
# Public example:
-#! [2]
+#! [0]
CONFIG += plugin
TEMPLATE = lib
-#! [2]
+#! [0]
+#! [3]
TARGET = $$qtLibraryTarget($$TARGET)
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
-
+#! [3]
}
-#! [3]
+#! [2]
HEADERS = analogclock.h \
customwidgetplugin.h
SOURCES = analogclock.cpp \
customwidgetplugin.cpp
OTHER_FILES += analogclock.json
-#! [3]
+#! [2]