diff options
author | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2022-09-22 15:25:41 +0200 |
---|---|---|
committer | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2022-09-26 00:16:51 +0200 |
commit | ec9312687e36ac06faaf4d4cdbd2528cc297a849 (patch) | |
tree | 6006e7d9991f57e9f9848b3a3d41ecf98c78497d /examples | |
parent | aaab4e797a728538e23a6695eb3edfef756f2669 (diff) |
Contactlist example: use qt_add_qml_module() in CMakeLists.txt
This patch also includes a small change to a signal handler,
in order to avoid a warning message.
Task-number: QTBUG-98130
Pick-to: 6.2 6.4
Change-Id: I2df71f397a4a8cb43912b90c0c89b297f5463568
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/quickcontrols2/contactlist/CMakeLists.txt | 39 | ||||
-rw-r--r-- | examples/quickcontrols2/contactlist/contactlist.qml | 2 |
2 files changed, 16 insertions, 25 deletions
diff --git a/examples/quickcontrols2/contactlist/CMakeLists.txt b/examples/quickcontrols2/contactlist/CMakeLists.txt index a14f2517c3..ac7eccd9a7 100644 --- a/examples/quickcontrols2/contactlist/CMakeLists.txt +++ b/examples/quickcontrols2/contactlist/CMakeLists.txt @@ -14,41 +14,32 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/contactlist") find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick) -qt_add_executable(contactlist +qt_add_executable(contactlistexample WIN32 MACOSX_BUNDLE contactmodel.cpp contactmodel.h main.cpp ) -set_target_properties(contactlist PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE +qt_add_qml_module(contactlistexample + URI contactlist + VERSION 1.0 + NO_RESOURCE_TARGET_PATH + QML_FILES + "ContactDelegate.ui.qml" + "ContactDialog.qml" + "ContactForm.ui.qml" + "ContactView.ui.qml" + "SectionDelegate.ui.qml" + "contactlist.qml" + "designer/Backend/ContactModel.qml" ) -target_link_libraries(contactlist PUBLIC +target_link_libraries(contactlistexample PUBLIC Qt::Core Qt::Gui Qt::Quick ) -# Resources: -set(qmake_immediate_resource_files - "ContactDelegate.ui.qml" - "ContactDialog.qml" - "ContactForm.ui.qml" - "ContactView.ui.qml" - "SectionDelegate.ui.qml" - "contactlist.qml" - "designer/Backend/ContactModel.qml" -) - -qt6_add_resources(contactlist "qmake_immediate" - PREFIX - "/" - FILES - ${qmake_immediate_resource_files} -) - -install(TARGETS contactlist +install(TARGETS contactlistexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/examples/quickcontrols2/contactlist/contactlist.qml b/examples/quickcontrols2/contactlist/contactlist.qml index aa8ab08e65..28f887f2db 100644 --- a/examples/quickcontrols2/contactlist/contactlist.qml +++ b/examples/quickcontrols2/contactlist/contactlist.qml @@ -16,7 +16,7 @@ ApplicationWindow { ContactDialog { id: contactDialog - onFinished: { + onFinished: function(fullName, address, city, number) { if (currentContact === -1) contactView.model.append(fullName, address, city, number) else |