diff options
Diffstat (limited to 'examples/quick')
147 files changed, 5802 insertions, 2068 deletions
diff --git a/examples/quick/.prev_CMakeLists.txt b/examples/quick/.prev_CMakeLists.txt new file mode 100644 index 0000000000..5299e95ae2 --- /dev/null +++ b/examples/quick/.prev_CMakeLists.txt @@ -0,0 +1,40 @@ +# Generated from quick.pro. + +add_subdirectory(quick-accessibility) +add_subdirectory(animation) +add_subdirectory(draganddrop) +add_subdirectory(externaldraganddrop) +add_subdirectory(canvas) +add_subdirectory(imageelements) +add_subdirectory(keyinteraction) +add_subdirectory(layouts) +add_subdirectory(localstorage) +add_subdirectory(models) +add_subdirectory(views) +add_subdirectory(tableview) +add_subdirectory(mousearea) +add_subdirectory(positioners) +add_subdirectory(righttoleft) +add_subdirectory(scenegraph) +add_subdirectory(shadereffects) +add_subdirectory(text) +add_subdirectory(threading) +add_subdirectory(touchinteraction) +add_subdirectory(tutorials) +add_subdirectory(customitems) +add_subdirectory(imageprovider) +add_subdirectory(imageresponseprovider) +add_subdirectory(window) +add_subdirectory(particles) +add_subdirectory(delegatechooser) +add_subdirectory(shapes) +if(QT_FEATURE_opengl OR QT_FEATURE_opengles2 OR QT_FEATURE_opengles3) + add_subdirectory(textureprovider) + add_subdirectory(rendercontrol) +endif() +if(TARGET Qt::Widgets) + add_subdirectory(embeddedinwidgets) +endif() +if(TARGET Qt::Widgets AND (QT_FEATURE_opengl OR QT_FEATURE_opengles2 OR QT_FEATURE_opengles3) AND (QT_FEATURE_opengles2 OR QT_FEATURE_opengles3 OR TARGET Qt::QuickWidgets)) + add_subdirectory(quickwidgets) +endif() diff --git a/examples/quick/CMakeLists.txt b/examples/quick/CMakeLists.txt new file mode 100644 index 0000000000..8940ff9c70 --- /dev/null +++ b/examples/quick/CMakeLists.txt @@ -0,0 +1,40 @@ +# Generated from quick.pro. + +add_subdirectory(quick-accessibility) +add_subdirectory(animation) +add_subdirectory(draganddrop) +add_subdirectory(externaldraganddrop) +add_subdirectory(canvas) +add_subdirectory(imageelements) +add_subdirectory(keyinteraction) +add_subdirectory(layouts) +add_subdirectory(localstorage) +add_subdirectory(models) +add_subdirectory(views) +add_subdirectory(tableview) +add_subdirectory(mousearea) +add_subdirectory(positioners) +add_subdirectory(righttoleft) +add_subdirectory(scenegraph) +add_subdirectory(shadereffects) +add_subdirectory(text) +add_subdirectory(threading) +add_subdirectory(touchinteraction) +add_subdirectory(tutorials) +add_subdirectory(customitems) +add_subdirectory(imageprovider) +add_subdirectory(imageresponseprovider) +add_subdirectory(window) +add_subdirectory(particles) +add_subdirectory(delegatechooser) +add_subdirectory(shapes) +if(QT_FEATURE_opengl OR QT_FEATURE_opengles2 OR QT_FEATURE_opengles3) + add_subdirectory(textureprovider) + add_subdirectory(rendercontrol) +endif() +if(TARGET Qt::Widgets) + add_subdirectory(embeddedinwidgets) +endif() +if(TARGET Qt::QuickWidgets AND TARGET Qt::Widgets AND (QT_FEATURE_opengl OR QT_FEATURE_opengles2 OR QT_FEATURE_opengles3)) + add_subdirectory(quickwidgets) +endif() diff --git a/examples/quick/animation/CMakeLists.txt b/examples/quick/animation/CMakeLists.txt new file mode 100644 index 0000000000..c44ab8b589 --- /dev/null +++ b/examples/quick/animation/CMakeLists.txt @@ -0,0 +1,136 @@ +# Generated from animation.pro. + +cmake_minimum_required(VERSION 3.14) +project(animation LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/animation") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(animation + main.cpp +) +target_link_libraries(animation PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set_source_files_properties("../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(animation "shared" + PREFIX + "/shared" + BASE + "../shared" + FILES + ${shared_resource_files} +) +set(animation_resource_files + "animation.qml" + "basics/animators.qml" + "basics/color-animation.qml" + "basics/images/face-smile.png" + "basics/images/moon.png" + "basics/images/shadow.png" + "basics/images/star.png" + "basics/images/sun.png" + "basics/property-animation.qml" + "behaviors/FocusRect.qml" + "behaviors/SideRect.qml" + "behaviors/behavior-example.qml" + "behaviors/tvtennis.qml" + "behaviors/wigglytext.qml" + "easing/easing.qml" + "pathanimation/pathanimation.qml" + "pathinterpolator/pathinterpolator.qml" + "states/qt-logo.png" + "states/states.qml" + "states/transitions.qml" +) + +qt6_add_resources(animation "animation" + PREFIX + "/animation" + FILES + ${animation_resource_files} +) + +install(TARGETS animation + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/canvas/CMakeLists.txt b/examples/quick/canvas/CMakeLists.txt new file mode 100644 index 0000000000..79a0479b6c --- /dev/null +++ b/examples/quick/canvas/CMakeLists.txt @@ -0,0 +1,127 @@ +# Generated from canvas.pro. + +cmake_minimum_required(VERSION 3.14) +project(canvas LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/canvas") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(canvas + main.cpp +) +target_link_libraries(canvas PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(canvas_resource_files + "bezierCurve/bezierCurve.qml" + "canvas.qml" + "clip/clip.qml" + "contents/qt-logo.png" + "quadraticCurveTo/quadraticCurveTo.qml" + "roundedrect/roundedrect.qml" + "smile/smile.qml" + "squircle/squircle.png" + "squircle/squircle.qml" + "tiger/tiger.js" + "tiger/tiger.qml" +) + +qt6_add_resources(canvas "canvas" + PREFIX + "/canvas" + FILES + ${canvas_resource_files} +) +set_source_files_properties("../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(canvas "shared" + PREFIX + "/shared" + BASE + "../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS canvas + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/customitems/.prev_CMakeLists.txt b/examples/quick/customitems/.prev_CMakeLists.txt new file mode 100644 index 0000000000..4afbfe3f6b --- /dev/null +++ b/examples/quick/customitems/.prev_CMakeLists.txt @@ -0,0 +1,4 @@ +# Generated from customitems.pro. + +add_subdirectory(painteditem) +add_subdirectory(maskedmousearea) diff --git a/examples/quick/customitems/CMakeLists.txt b/examples/quick/customitems/CMakeLists.txt new file mode 100644 index 0000000000..4afbfe3f6b --- /dev/null +++ b/examples/quick/customitems/CMakeLists.txt @@ -0,0 +1,4 @@ +# Generated from customitems.pro. + +add_subdirectory(painteditem) +add_subdirectory(maskedmousearea) diff --git a/examples/quick/customitems/dialcontrol/CMakeLists.txt b/examples/quick/customitems/dialcontrol/CMakeLists.txt new file mode 100644 index 0000000000..0ffee20a9b --- /dev/null +++ b/examples/quick/customitems/dialcontrol/CMakeLists.txt @@ -0,0 +1,53 @@ +# Generated from dialcontrol.pro. + +cmake_minimum_required(VERSION 3.14) +project(dialcontrol LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/customitems/dialcontrol") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(dialcontrol + main.cpp +) +target_link_libraries(dialcontrol PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(dialcontrol_resource_files + "content/Dial.qml" + "content/QuitButton.qml" + "content/background.png" + "content/needle.png" + "content/needle_shadow.png" + "content/overlay.png" + "content/quit.png" + "dialcontrol.qml" +) + +qt6_add_resources(dialcontrol "dialcontrol" + PREFIX + "/" + FILES + ${dialcontrol_resource_files} +) + +install(TARGETS dialcontrol + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/customitems/maskedmousearea/CMakeLists.txt b/examples/quick/customitems/maskedmousearea/CMakeLists.txt new file mode 100644 index 0000000000..7a9b0e0376 --- /dev/null +++ b/examples/quick/customitems/maskedmousearea/CMakeLists.txt @@ -0,0 +1,58 @@ +# Generated from maskedmousearea.pro. + +cmake_minimum_required(VERSION 3.14) +project(maskedmousearea LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/customitems/maskedmousearea") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(maskedmousearea + main.cpp + maskedmousearea.cpp maskedmousearea.h +) +target_link_libraries(maskedmousearea PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(maskedmousearea_resource_files + "images/cloud_1.png" + "images/cloud_2.png" + "images/moon.png" + "maskedmousearea.qml" +) + +qt6_add_resources(maskedmousearea "maskedmousearea" + PREFIX + "/customitems/maskedmousearea" + FILES + ${maskedmousearea_resource_files} +) + +install(TARGETS maskedmousearea + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(maskedmousearea PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI Example +) + +qt6_qml_type_registration(maskedmousearea) diff --git a/examples/quick/customitems/painteditem/CMakeLists.txt b/examples/quick/customitems/painteditem/CMakeLists.txt new file mode 100644 index 0000000000..8cf04fdfec --- /dev/null +++ b/examples/quick/customitems/painteditem/CMakeLists.txt @@ -0,0 +1,63 @@ +# Generated from painteditem.pro. + +cmake_minimum_required(VERSION 3.14) +project(qmltextballoonplugin LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/customitems/painteditem/TextBalloonPlugin") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +qt6_add_qml_module(qmltextballoonplugin + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TextBalloonPlugin" + VERSION 1.0 + URI "TextBalloonPlugin" + INSTALL_LOCATION ${INSTALL_EXAMPLEDIR} +) + +target_sources(qmltextballoonplugin PRIVATE + TextBalloonPlugin/plugin.h + textballoon.cpp textballoon.h +) +target_link_libraries(qmltextballoonplugin PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(painteditem_resource_files + "textballoon.h" + "textballoons.qml" +) + +qt6_add_resources(qmltextballoonplugin "painteditem" + PREFIX + "/painteditem" + FILES + ${painteditem_resource_files} +) + +install(TARGETS qmltextballoonplugin + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(qmltextballoonplugin PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI TextBalloonPlugin +) + +qt6_qml_type_registration(qmltextballoonplugin) diff --git a/examples/quick/delegatechooser/CMakeLists.txt b/examples/quick/delegatechooser/CMakeLists.txt new file mode 100644 index 0000000000..2abb900e4c --- /dev/null +++ b/examples/quick/delegatechooser/CMakeLists.txt @@ -0,0 +1,117 @@ +# Generated from delegatechooser.pro. + +cmake_minimum_required(VERSION 3.14) +project(delegatechooser LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/delegatechooser") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(delegatechooser + main.cpp +) +target_link_libraries(delegatechooser PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(qml_resource_files + "delegatechooser.qml" +) + +qt6_add_resources(delegatechooser "qml" + PREFIX + "/" + FILES + ${qml_resource_files} +) +set_source_files_properties("../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(delegatechooser "shared" + PREFIX + "/shared" + BASE + "../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS delegatechooser + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/draganddrop/CMakeLists.txt b/examples/quick/draganddrop/CMakeLists.txt new file mode 100644 index 0000000000..41c6d2c88d --- /dev/null +++ b/examples/quick/draganddrop/CMakeLists.txt @@ -0,0 +1,122 @@ +# Generated from draganddrop.pro. + +cmake_minimum_required(VERSION 3.14) +project(draganddrop LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/draganddrop") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(draganddrop + main.cpp +) +target_link_libraries(draganddrop PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(draganddrop_resource_files + "draganddrop.qml" + "tiles/DragTile.qml" + "tiles/DropTile.qml" + "tiles/tiles.qml" + "views/Icon.qml" + "views/gridview.qml" +) + +qt6_add_resources(draganddrop "draganddrop" + PREFIX + "/draganddrop" + FILES + ${draganddrop_resource_files} +) +set_source_files_properties("../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(draganddrop "shared" + PREFIX + "/shared" + BASE + "../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS draganddrop + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/embeddedinwidgets/CMakeLists.txt b/examples/quick/embeddedinwidgets/CMakeLists.txt new file mode 100644 index 0000000000..3064ce9105 --- /dev/null +++ b/examples/quick/embeddedinwidgets/CMakeLists.txt @@ -0,0 +1,47 @@ +# Generated from embeddedinwidgets.pro. + +cmake_minimum_required(VERSION 3.14) +project(embeddedinwidgets LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/embeddedinwidgets") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Widgets) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(embeddedinwidgets + main.cpp +) +target_link_libraries(embeddedinwidgets PUBLIC + Qt::Core + Qt::Gui + Qt::Quick + Qt::Widgets +) + + +# Resources: +set(embeddedinwidgets_resource_files + "TextBox.qml" + "main.qml" +) + +qt6_add_resources(embeddedinwidgets "embeddedinwidgets" + PREFIX + "/embeddedinwidgets" + FILES + ${embeddedinwidgets_resource_files} +) + +install(TARGETS embeddedinwidgets + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/externaldraganddrop/CMakeLists.txt b/examples/quick/externaldraganddrop/CMakeLists.txt new file mode 100644 index 0000000000..562de203e5 --- /dev/null +++ b/examples/quick/externaldraganddrop/CMakeLists.txt @@ -0,0 +1,118 @@ +# Generated from externaldraganddrop.pro. + +cmake_minimum_required(VERSION 3.14) +project(externaldraganddrop LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/externaldraganddrop") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(externaldraganddrop + main.cpp +) +target_link_libraries(externaldraganddrop PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(externaldraganddrop_resource_files + "DragAndDropTextItem.qml" + "externaldraganddrop.qml" +) + +qt6_add_resources(externaldraganddrop "externaldraganddrop" + PREFIX + "/externaldraganddrop" + FILES + ${externaldraganddrop_resource_files} +) +set_source_files_properties("../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(externaldraganddrop "shared" + PREFIX + "/shared" + BASE + "../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS externaldraganddrop + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/imageelements/CMakeLists.txt b/examples/quick/imageelements/CMakeLists.txt new file mode 100644 index 0000000000..03068241ec --- /dev/null +++ b/examples/quick/imageelements/CMakeLists.txt @@ -0,0 +1,140 @@ +# Generated from imageelements.pro. + +cmake_minimum_required(VERSION 3.14) +project(imageelements LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/imageelements") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(imageelements + main.cpp +) +target_link_libraries(imageelements PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(imageelements_resource_files + "animatedimage.qml" + "animatedsprite.qml" + "borderimage.qml" + "content/BearSheet.png" + "content/BorderImageSelector.qml" + "content/ImageCell.qml" + "content/MyBorderImage.qml" + "content/ShadowRectangle.qml" + "content/Uniflow_steam_engine.gif" + "content/arrow.png" + "content/bw.png" + "content/colors-round.sci" + "content/colors-stretch.sci" + "content/colors.png" + "content/multi.ico" + "content/qt-logo.png" + "content/shadow.png" + "content/speaker.png" + "framestepping.qml" + "image.qml" + "imageelements.qml" + "multiframeborderimage.qml" + "shadows.qml" + "spritesequence.qml" +) + +qt6_add_resources(imageelements "imageelements" + PREFIX + "/imageelements" + FILES + ${imageelements_resource_files} +) +set_source_files_properties("../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(imageelements "shared" + PREFIX + "/shared" + BASE + "../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS imageelements + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/imageprovider/CMakeLists.txt b/examples/quick/imageprovider/CMakeLists.txt new file mode 100644 index 0000000000..69008ef00a --- /dev/null +++ b/examples/quick/imageprovider/CMakeLists.txt @@ -0,0 +1,40 @@ +# Generated from imageprovider.pro. + +cmake_minimum_required(VERSION 3.14) +project(qmlimageproviderplugin LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/imageprovider/ImageProviderCore") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +qt6_add_qml_module(qmlimageproviderplugin + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ImageProviderCore" + VERSION 1.0 + URI "ImageProviderCore" + INSTALL_LOCATION ${INSTALL_EXAMPLEDIR} +) + +target_sources(qmlimageproviderplugin PRIVATE + imageprovider.cpp +) +target_link_libraries(qmlimageproviderplugin PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + +install(TARGETS qmlimageproviderplugin + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/imageresponseprovider/CMakeLists.txt b/examples/quick/imageresponseprovider/CMakeLists.txt new file mode 100644 index 0000000000..4b7a33c1b1 --- /dev/null +++ b/examples/quick/imageresponseprovider/CMakeLists.txt @@ -0,0 +1,40 @@ +# Generated from imageresponseprovider.pro. + +cmake_minimum_required(VERSION 3.14) +project(qmlimageresponseproviderplugin LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/imageresponseprovider/ImageResponseProviderCore") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +qt6_add_qml_module(qmlimageresponseproviderplugin + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ImageResponseProviderCore" + VERSION 1.0 + URI "ImageResponseProviderCore" + INSTALL_LOCATION ${INSTALL_EXAMPLEDIR} +) + +target_sources(qmlimageresponseproviderplugin PRIVATE + imageresponseprovider.cpp +) +target_link_libraries(qmlimageresponseproviderplugin PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + +install(TARGETS qmlimageresponseproviderplugin + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/keyinteraction/CMakeLists.txt b/examples/quick/keyinteraction/CMakeLists.txt new file mode 100644 index 0000000000..50505dd2da --- /dev/null +++ b/examples/quick/keyinteraction/CMakeLists.txt @@ -0,0 +1,54 @@ +# Generated from keyinteraction.pro. + +cmake_minimum_required(VERSION 3.14) +project(keyinteraction LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/keyinteraction") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(keyinteraction + main.cpp +) +target_link_libraries(keyinteraction PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(keyinteraction_resource_files + "focus/Core/ContextMenu.qml" + "focus/Core/GridMenu.qml" + "focus/Core/ListMenu.qml" + "focus/Core/ListViewDelegate.qml" + "focus/Core/TabMenu.qml" + "focus/Core/images/arrow.png" + "focus/Core/images/qt-logo.png" + "focus/focus.qml" + "keyinteraction.qml" +) + +qt6_add_resources(keyinteraction "keyinteraction" + PREFIX + "/keyinteraction" + FILES + ${keyinteraction_resource_files} +) + +install(TARGETS keyinteraction + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/layouts/CMakeLists.txt b/examples/quick/layouts/CMakeLists.txt new file mode 100644 index 0000000000..b83e3256a0 --- /dev/null +++ b/examples/quick/layouts/CMakeLists.txt @@ -0,0 +1,46 @@ +# Generated from layouts.pro. + +cmake_minimum_required(VERSION 3.14) +project(layouts LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/layouts") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(layouts + main.cpp +) +target_link_libraries(layouts PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(layouts_resource_files + "layouts.qml" +) + +qt6_add_resources(layouts "layouts" + PREFIX + "/layouts" + FILES + ${layouts_resource_files} +) + +install(TARGETS layouts + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/localstorage/CMakeLists.txt b/examples/quick/localstorage/CMakeLists.txt new file mode 100644 index 0000000000..913f64dd1b --- /dev/null +++ b/examples/quick/localstorage/CMakeLists.txt @@ -0,0 +1,3 @@ +# Generated from localstorage.pro. + +add_subdirectory(localstorage) diff --git a/examples/quick/localstorage/localstorage/CMakeLists.txt b/examples/quick/localstorage/localstorage/CMakeLists.txt new file mode 100644 index 0000000000..60d2e82fbf --- /dev/null +++ b/examples/quick/localstorage/localstorage/CMakeLists.txt @@ -0,0 +1,122 @@ +# Generated from localstorage.pro. + +cmake_minimum_required(VERSION 3.14) +project(localstorage LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/localstorage/localstorage") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(localstorage + main.cpp +) +target_link_libraries(localstorage PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(localstorage_resource_files + "Database.js" + "Header.qml" + "MyButton.qml" + "MyDelegate.qml" + "MyModel.qml" + "localstorage.qml" +) + +qt6_add_resources(localstorage "localstorage" + PREFIX + "/" + FILES + ${localstorage_resource_files} +) +set_source_files_properties("../../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(localstorage "shared" + PREFIX + "/shared" + BASE + "../../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS localstorage + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/models/CMakeLists.txt b/examples/quick/models/CMakeLists.txt new file mode 100644 index 0000000000..6beadd409c --- /dev/null +++ b/examples/quick/models/CMakeLists.txt @@ -0,0 +1,5 @@ +# Generated from models.pro. + +add_subdirectory(abstractitemmodel) +add_subdirectory(objectlistmodel) +add_subdirectory(stringlistmodel) diff --git a/examples/quick/models/abstractitemmodel/CMakeLists.txt b/examples/quick/models/abstractitemmodel/CMakeLists.txt new file mode 100644 index 0000000000..242a90f7c5 --- /dev/null +++ b/examples/quick/models/abstractitemmodel/CMakeLists.txt @@ -0,0 +1,47 @@ +# Generated from abstractitemmodel.pro. + +cmake_minimum_required(VERSION 3.14) +project(abstractitemmodel LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/models/abstractitemmodel") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(abstractitemmodel + main.cpp + model.cpp model.h +) +target_link_libraries(abstractitemmodel PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(abstractitemmodel_resource_files + "view.qml" +) + +qt6_add_resources(abstractitemmodel "abstractitemmodel" + PREFIX + "/" + FILES + ${abstractitemmodel_resource_files} +) + +install(TARGETS abstractitemmodel + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/models/objectlistmodel/CMakeLists.txt b/examples/quick/models/objectlistmodel/CMakeLists.txt new file mode 100644 index 0000000000..1c29dcdcb6 --- /dev/null +++ b/examples/quick/models/objectlistmodel/CMakeLists.txt @@ -0,0 +1,47 @@ +# Generated from objectlistmodel.pro. + +cmake_minimum_required(VERSION 3.14) +project(objectlistmodel LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/models/objectlistmodel") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(objectlistmodel + dataobject.cpp dataobject.h + main.cpp +) +target_link_libraries(objectlistmodel PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(objectlistmodel_resource_files + "view.qml" +) + +qt6_add_resources(objectlistmodel "objectlistmodel" + PREFIX + "/" + FILES + ${objectlistmodel_resource_files} +) + +install(TARGETS objectlistmodel + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/models/stringlistmodel/CMakeLists.txt b/examples/quick/models/stringlistmodel/CMakeLists.txt new file mode 100644 index 0000000000..3b15a97450 --- /dev/null +++ b/examples/quick/models/stringlistmodel/CMakeLists.txt @@ -0,0 +1,46 @@ +# Generated from stringlistmodel.pro. + +cmake_minimum_required(VERSION 3.14) +project(stringlistmodel LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/models/stringlistmodel") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(stringlistmodel + main.cpp +) +target_link_libraries(stringlistmodel PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(stringlistmodel_resource_files + "view.qml" +) + +qt6_add_resources(stringlistmodel "stringlistmodel" + PREFIX + "/" + FILES + ${stringlistmodel_resource_files} +) + +install(TARGETS stringlistmodel + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/mousearea/CMakeLists.txt b/examples/quick/mousearea/CMakeLists.txt new file mode 100644 index 0000000000..82a1d2fb35 --- /dev/null +++ b/examples/quick/mousearea/CMakeLists.txt @@ -0,0 +1,47 @@ +# Generated from mousearea.pro. + +cmake_minimum_required(VERSION 3.14) +project(mousearea LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/mousearea") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(mousearea + main.cpp +) +target_link_libraries(mousearea PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(mousearea_resource_files + "mousearea-wheel-example.qml" + "mousearea.qml" +) + +qt6_add_resources(mousearea "mousearea" + PREFIX + "/mousearea" + FILES + ${mousearea_resource_files} +) + +install(TARGETS mousearea + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/particles/.prev_CMakeLists.txt b/examples/quick/particles/.prev_CMakeLists.txt new file mode 100644 index 0000000000..9bc4e894a5 --- /dev/null +++ b/examples/quick/particles/.prev_CMakeLists.txt @@ -0,0 +1,8 @@ +# Generated from particles.pro. + +add_subdirectory(affectors) +add_subdirectory(customparticle) +add_subdirectory(emitters) +add_subdirectory(imageparticle) +add_subdirectory(itemparticle) +add_subdirectory(system) diff --git a/examples/quick/particles/CMakeLists.txt b/examples/quick/particles/CMakeLists.txt new file mode 100644 index 0000000000..9bc4e894a5 --- /dev/null +++ b/examples/quick/particles/CMakeLists.txt @@ -0,0 +1,8 @@ +# Generated from particles.pro. + +add_subdirectory(affectors) +add_subdirectory(customparticle) +add_subdirectory(emitters) +add_subdirectory(imageparticle) +add_subdirectory(itemparticle) +add_subdirectory(system) diff --git a/examples/quick/particles/affectors/CMakeLists.txt b/examples/quick/particles/affectors/CMakeLists.txt new file mode 100644 index 0000000000..9675a61051 --- /dev/null +++ b/examples/quick/particles/affectors/CMakeLists.txt @@ -0,0 +1,263 @@ +# Generated from affectors.pro. + +cmake_minimum_required(VERSION 3.14) +project(affectors LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/particles/affectors") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(affectors + main.cpp +) +target_link_libraries(affectors PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(affectors_resource_files + "affectors.qml" + "content/GreyButton.qml" + "content/age.qml" + "content/attractor.qml" + "content/customaffector.qml" + "content/friction.qml" + "content/gravity.qml" + "content/groupgoal.qml" + "content/move.qml" + "content/spritegoal.qml" + "content/turbulence.qml" + "content/wander.qml" +) + +qt6_add_resources(affectors "affectors" + PREFIX + "/particles/affectors" + FILES + ${affectors_resource_files} +) +set_source_files_properties("../images/_explo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/_explo.png" +) +set_source_files_properties("../images/backgroundLeaves.jpg" + PROPERTIES QT_RESOURCE_ALIAS "images/backgroundLeaves.jpg" +) +set_source_files_properties("../images/bear_tiles.png" + PROPERTIES QT_RESOURCE_ALIAS "images/bear_tiles.png" +) +set_source_files_properties("../images/candle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/candle.png" +) +set_source_files_properties("../images/colortable.png" + PROPERTIES QT_RESOURCE_ALIAS "images/colortable.png" +) +set_source_files_properties("../images/finalfrontier.png" + PROPERTIES QT_RESOURCE_ALIAS "images/finalfrontier.png" +) +set_source_files_properties("../images/flower.png" + PROPERTIES QT_RESOURCE_ALIAS "images/flower.png" +) +set_source_files_properties("../images/matchmask.png" + PROPERTIES QT_RESOURCE_ALIAS "images/matchmask.png" +) +set_source_files_properties("../images/meteor.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteor.png" +) +set_source_files_properties("../images/meteor_explo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteor_explo.png" +) +set_source_files_properties("../images/meteors.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteors.png" +) +set_source_files_properties("../images/nullRock.png" + PROPERTIES QT_RESOURCE_ALIAS "images/nullRock.png" +) +set_source_files_properties("../images/particle2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particle2.png" +) +set_source_files_properties("../images/particle3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particle3.png" +) +set_source_files_properties("../images/particleA.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particleA.png" +) +set_source_files_properties("../images/portal_bg.png" + PROPERTIES QT_RESOURCE_ALIAS "images/portal_bg.png" +) +set_source_files_properties("../images/realLeaf1.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf1.png" +) +set_source_files_properties("../images/realLeaf2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf2.png" +) +set_source_files_properties("../images/realLeaf3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf3.png" +) +set_source_files_properties("../images/realLeaf4.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf4.png" +) +set_source_files_properties("../images/rocket.png" + PROPERTIES QT_RESOURCE_ALIAS "images/rocket.png" +) +set_source_files_properties("../images/rocket2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/rocket2.png" +) +set_source_files_properties("../images/sizeInOut.png" + PROPERTIES QT_RESOURCE_ALIAS "images/sizeInOut.png" +) +set_source_files_properties("../images/snowflake.png" + PROPERTIES QT_RESOURCE_ALIAS "images/snowflake.png" +) +set_source_files_properties("../images/sparkleSize.png" + PROPERTIES QT_RESOURCE_ALIAS "images/sparkleSize.png" +) +set_source_files_properties("../images/starfish_0.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_0.png" +) +set_source_files_properties("../images/starfish_1.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_1.png" +) +set_source_files_properties("../images/starfish_2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_2.png" +) +set_source_files_properties("../images/starfish_3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_3.png" +) +set_source_files_properties("../images/starfish_4.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_4.png" +) +set_source_files_properties("../images/starfish_mask.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_mask.png" +) +set(images_resource_files + "images/_explo.png" + "images/backgroundLeaves.jpg" + "images/bear_tiles.png" + "images/candle.png" + "images/colortable.png" + "images/finalfrontier.png" + "images/flower.png" + "images/matchmask.png" + "images/meteor.png" + "images/meteor_explo.png" + "images/meteors.png" + "images/nullRock.png" + "images/particle2.png" + "images/particle3.png" + "images/particleA.png" + "images/portal_bg.png" + "images/realLeaf1.png" + "images/realLeaf2.png" + "images/realLeaf3.png" + "images/realLeaf4.png" + "images/rocket.png" + "images/rocket2.png" + "images/sizeInOut.png" + "images/snowflake.png" + "images/sparkleSize.png" + "images/starfish_0.png" + "images/starfish_1.png" + "images/starfish_2.png" + "images/starfish_3.png" + "images/starfish_4.png" + "images/starfish_mask.png" +) + +qt6_add_resources(affectors "images" + PREFIX + "/particles" + BASE + ".." + FILES + ${images_resource_files} +) +set_source_files_properties("../../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(affectors "shared" + PREFIX + "/shared" + BASE + "../../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS affectors + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/particles/customparticle/CMakeLists.txt b/examples/quick/particles/customparticle/CMakeLists.txt new file mode 100644 index 0000000000..d19a5a49b8 --- /dev/null +++ b/examples/quick/particles/customparticle/CMakeLists.txt @@ -0,0 +1,255 @@ +# Generated from customparticle.pro. + +cmake_minimum_required(VERSION 3.14) +project(customparticle LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/particles/customparticle") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(customparticle + main.cpp +) +target_link_libraries(customparticle PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(customparticle_resource_files + "content/blurparticles.qml" + "content/fragmentshader.qml" + "content/imagecolors.qml" + "customparticle.qml" +) + +qt6_add_resources(customparticle "customparticle" + PREFIX + "/particles/customparticle" + FILES + ${customparticle_resource_files} +) +set_source_files_properties("../images/_explo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/_explo.png" +) +set_source_files_properties("../images/backgroundLeaves.jpg" + PROPERTIES QT_RESOURCE_ALIAS "images/backgroundLeaves.jpg" +) +set_source_files_properties("../images/bear_tiles.png" + PROPERTIES QT_RESOURCE_ALIAS "images/bear_tiles.png" +) +set_source_files_properties("../images/candle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/candle.png" +) +set_source_files_properties("../images/colortable.png" + PROPERTIES QT_RESOURCE_ALIAS "images/colortable.png" +) +set_source_files_properties("../images/finalfrontier.png" + PROPERTIES QT_RESOURCE_ALIAS "images/finalfrontier.png" +) +set_source_files_properties("../images/flower.png" + PROPERTIES QT_RESOURCE_ALIAS "images/flower.png" +) +set_source_files_properties("../images/matchmask.png" + PROPERTIES QT_RESOURCE_ALIAS "images/matchmask.png" +) +set_source_files_properties("../images/meteor.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteor.png" +) +set_source_files_properties("../images/meteor_explo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteor_explo.png" +) +set_source_files_properties("../images/meteors.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteors.png" +) +set_source_files_properties("../images/nullRock.png" + PROPERTIES QT_RESOURCE_ALIAS "images/nullRock.png" +) +set_source_files_properties("../images/particle2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particle2.png" +) +set_source_files_properties("../images/particle3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particle3.png" +) +set_source_files_properties("../images/particleA.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particleA.png" +) +set_source_files_properties("../images/portal_bg.png" + PROPERTIES QT_RESOURCE_ALIAS "images/portal_bg.png" +) +set_source_files_properties("../images/realLeaf1.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf1.png" +) +set_source_files_properties("../images/realLeaf2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf2.png" +) +set_source_files_properties("../images/realLeaf3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf3.png" +) +set_source_files_properties("../images/realLeaf4.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf4.png" +) +set_source_files_properties("../images/rocket.png" + PROPERTIES QT_RESOURCE_ALIAS "images/rocket.png" +) +set_source_files_properties("../images/rocket2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/rocket2.png" +) +set_source_files_properties("../images/sizeInOut.png" + PROPERTIES QT_RESOURCE_ALIAS "images/sizeInOut.png" +) +set_source_files_properties("../images/snowflake.png" + PROPERTIES QT_RESOURCE_ALIAS "images/snowflake.png" +) +set_source_files_properties("../images/sparkleSize.png" + PROPERTIES QT_RESOURCE_ALIAS "images/sparkleSize.png" +) +set_source_files_properties("../images/starfish_0.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_0.png" +) +set_source_files_properties("../images/starfish_1.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_1.png" +) +set_source_files_properties("../images/starfish_2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_2.png" +) +set_source_files_properties("../images/starfish_3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_3.png" +) +set_source_files_properties("../images/starfish_4.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_4.png" +) +set_source_files_properties("../images/starfish_mask.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_mask.png" +) +set(images_resource_files + "images/_explo.png" + "images/backgroundLeaves.jpg" + "images/bear_tiles.png" + "images/candle.png" + "images/colortable.png" + "images/finalfrontier.png" + "images/flower.png" + "images/matchmask.png" + "images/meteor.png" + "images/meteor_explo.png" + "images/meteors.png" + "images/nullRock.png" + "images/particle2.png" + "images/particle3.png" + "images/particleA.png" + "images/portal_bg.png" + "images/realLeaf1.png" + "images/realLeaf2.png" + "images/realLeaf3.png" + "images/realLeaf4.png" + "images/rocket.png" + "images/rocket2.png" + "images/sizeInOut.png" + "images/snowflake.png" + "images/sparkleSize.png" + "images/starfish_0.png" + "images/starfish_1.png" + "images/starfish_2.png" + "images/starfish_3.png" + "images/starfish_4.png" + "images/starfish_mask.png" +) + +qt6_add_resources(customparticle "images" + PREFIX + "/particles" + BASE + ".." + FILES + ${images_resource_files} +) +set_source_files_properties("../../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(customparticle "shared" + PREFIX + "/shared" + BASE + "../../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS customparticle + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/particles/emitters/CMakeLists.txt b/examples/quick/particles/emitters/CMakeLists.txt new file mode 100644 index 0000000000..94e7e5ef18 --- /dev/null +++ b/examples/quick/particles/emitters/CMakeLists.txt @@ -0,0 +1,259 @@ +# Generated from emitters.pro. + +cmake_minimum_required(VERSION 3.14) +project(emitters LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/particles/emitters") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(emitters + main.cpp +) +target_link_libraries(emitters PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(emitters_resource_files + "content/burstandpulse.qml" + "content/customemitter.qml" + "content/emitmask.qml" + "content/maximumemitted.qml" + "content/shapeanddirection.qml" + "content/trailemitter.qml" + "content/velocityfrommotion.qml" + "emitters.qml" +) + +qt6_add_resources(emitters "emitters" + PREFIX + "/particles/emitters" + FILES + ${emitters_resource_files} +) +set_source_files_properties("../images/_explo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/_explo.png" +) +set_source_files_properties("../images/backgroundLeaves.jpg" + PROPERTIES QT_RESOURCE_ALIAS "images/backgroundLeaves.jpg" +) +set_source_files_properties("../images/bear_tiles.png" + PROPERTIES QT_RESOURCE_ALIAS "images/bear_tiles.png" +) +set_source_files_properties("../images/candle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/candle.png" +) +set_source_files_properties("../images/colortable.png" + PROPERTIES QT_RESOURCE_ALIAS "images/colortable.png" +) +set_source_files_properties("../images/finalfrontier.png" + PROPERTIES QT_RESOURCE_ALIAS "images/finalfrontier.png" +) +set_source_files_properties("../images/flower.png" + PROPERTIES QT_RESOURCE_ALIAS "images/flower.png" +) +set_source_files_properties("../images/matchmask.png" + PROPERTIES QT_RESOURCE_ALIAS "images/matchmask.png" +) +set_source_files_properties("../images/meteor.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteor.png" +) +set_source_files_properties("../images/meteor_explo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteor_explo.png" +) +set_source_files_properties("../images/meteors.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteors.png" +) +set_source_files_properties("../images/nullRock.png" + PROPERTIES QT_RESOURCE_ALIAS "images/nullRock.png" +) +set_source_files_properties("../images/particle2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particle2.png" +) +set_source_files_properties("../images/particle3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particle3.png" +) +set_source_files_properties("../images/particleA.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particleA.png" +) +set_source_files_properties("../images/portal_bg.png" + PROPERTIES QT_RESOURCE_ALIAS "images/portal_bg.png" +) +set_source_files_properties("../images/realLeaf1.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf1.png" +) +set_source_files_properties("../images/realLeaf2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf2.png" +) +set_source_files_properties("../images/realLeaf3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf3.png" +) +set_source_files_properties("../images/realLeaf4.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf4.png" +) +set_source_files_properties("../images/rocket.png" + PROPERTIES QT_RESOURCE_ALIAS "images/rocket.png" +) +set_source_files_properties("../images/rocket2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/rocket2.png" +) +set_source_files_properties("../images/sizeInOut.png" + PROPERTIES QT_RESOURCE_ALIAS "images/sizeInOut.png" +) +set_source_files_properties("../images/snowflake.png" + PROPERTIES QT_RESOURCE_ALIAS "images/snowflake.png" +) +set_source_files_properties("../images/sparkleSize.png" + PROPERTIES QT_RESOURCE_ALIAS "images/sparkleSize.png" +) +set_source_files_properties("../images/starfish_0.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_0.png" +) +set_source_files_properties("../images/starfish_1.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_1.png" +) +set_source_files_properties("../images/starfish_2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_2.png" +) +set_source_files_properties("../images/starfish_3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_3.png" +) +set_source_files_properties("../images/starfish_4.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_4.png" +) +set_source_files_properties("../images/starfish_mask.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_mask.png" +) +set(images_resource_files + "images/_explo.png" + "images/backgroundLeaves.jpg" + "images/bear_tiles.png" + "images/candle.png" + "images/colortable.png" + "images/finalfrontier.png" + "images/flower.png" + "images/matchmask.png" + "images/meteor.png" + "images/meteor_explo.png" + "images/meteors.png" + "images/nullRock.png" + "images/particle2.png" + "images/particle3.png" + "images/particleA.png" + "images/portal_bg.png" + "images/realLeaf1.png" + "images/realLeaf2.png" + "images/realLeaf3.png" + "images/realLeaf4.png" + "images/rocket.png" + "images/rocket2.png" + "images/sizeInOut.png" + "images/snowflake.png" + "images/sparkleSize.png" + "images/starfish_0.png" + "images/starfish_1.png" + "images/starfish_2.png" + "images/starfish_3.png" + "images/starfish_4.png" + "images/starfish_mask.png" +) + +qt6_add_resources(emitters "images" + PREFIX + "/particles" + BASE + ".." + FILES + ${images_resource_files} +) +set_source_files_properties("../../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(emitters "shared" + PREFIX + "/shared" + BASE + "../../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS emitters + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/particles/imageparticle/CMakeLists.txt b/examples/quick/particles/imageparticle/CMakeLists.txt new file mode 100644 index 0000000000..05b307f83d --- /dev/null +++ b/examples/quick/particles/imageparticle/CMakeLists.txt @@ -0,0 +1,259 @@ +# Generated from imageparticle.pro. + +cmake_minimum_required(VERSION 3.14) +project(imageparticle LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/particles/imageparticle") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(imageparticle + main.cpp +) +target_link_libraries(imageparticle PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(imageparticle_resource_files + "content/allatonce.qml" + "content/colored.qml" + "content/colortable.qml" + "content/deformation.qml" + "content/rotation.qml" + "content/sharing.qml" + "content/sprites.qml" + "imageparticle.qml" +) + +qt6_add_resources(imageparticle "imageparticle" + PREFIX + "/particles/imageparticle" + FILES + ${imageparticle_resource_files} +) +set_source_files_properties("../images/_explo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/_explo.png" +) +set_source_files_properties("../images/backgroundLeaves.jpg" + PROPERTIES QT_RESOURCE_ALIAS "images/backgroundLeaves.jpg" +) +set_source_files_properties("../images/bear_tiles.png" + PROPERTIES QT_RESOURCE_ALIAS "images/bear_tiles.png" +) +set_source_files_properties("../images/candle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/candle.png" +) +set_source_files_properties("../images/colortable.png" + PROPERTIES QT_RESOURCE_ALIAS "images/colortable.png" +) +set_source_files_properties("../images/finalfrontier.png" + PROPERTIES QT_RESOURCE_ALIAS "images/finalfrontier.png" +) +set_source_files_properties("../images/flower.png" + PROPERTIES QT_RESOURCE_ALIAS "images/flower.png" +) +set_source_files_properties("../images/matchmask.png" + PROPERTIES QT_RESOURCE_ALIAS "images/matchmask.png" +) +set_source_files_properties("../images/meteor.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteor.png" +) +set_source_files_properties("../images/meteor_explo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteor_explo.png" +) +set_source_files_properties("../images/meteors.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteors.png" +) +set_source_files_properties("../images/nullRock.png" + PROPERTIES QT_RESOURCE_ALIAS "images/nullRock.png" +) +set_source_files_properties("../images/particle2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particle2.png" +) +set_source_files_properties("../images/particle3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particle3.png" +) +set_source_files_properties("../images/particleA.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particleA.png" +) +set_source_files_properties("../images/portal_bg.png" + PROPERTIES QT_RESOURCE_ALIAS "images/portal_bg.png" +) +set_source_files_properties("../images/realLeaf1.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf1.png" +) +set_source_files_properties("../images/realLeaf2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf2.png" +) +set_source_files_properties("../images/realLeaf3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf3.png" +) +set_source_files_properties("../images/realLeaf4.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf4.png" +) +set_source_files_properties("../images/rocket.png" + PROPERTIES QT_RESOURCE_ALIAS "images/rocket.png" +) +set_source_files_properties("../images/rocket2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/rocket2.png" +) +set_source_files_properties("../images/sizeInOut.png" + PROPERTIES QT_RESOURCE_ALIAS "images/sizeInOut.png" +) +set_source_files_properties("../images/snowflake.png" + PROPERTIES QT_RESOURCE_ALIAS "images/snowflake.png" +) +set_source_files_properties("../images/sparkleSize.png" + PROPERTIES QT_RESOURCE_ALIAS "images/sparkleSize.png" +) +set_source_files_properties("../images/starfish_0.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_0.png" +) +set_source_files_properties("../images/starfish_1.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_1.png" +) +set_source_files_properties("../images/starfish_2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_2.png" +) +set_source_files_properties("../images/starfish_3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_3.png" +) +set_source_files_properties("../images/starfish_4.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_4.png" +) +set_source_files_properties("../images/starfish_mask.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_mask.png" +) +set(images_resource_files + "images/_explo.png" + "images/backgroundLeaves.jpg" + "images/bear_tiles.png" + "images/candle.png" + "images/colortable.png" + "images/finalfrontier.png" + "images/flower.png" + "images/matchmask.png" + "images/meteor.png" + "images/meteor_explo.png" + "images/meteors.png" + "images/nullRock.png" + "images/particle2.png" + "images/particle3.png" + "images/particleA.png" + "images/portal_bg.png" + "images/realLeaf1.png" + "images/realLeaf2.png" + "images/realLeaf3.png" + "images/realLeaf4.png" + "images/rocket.png" + "images/rocket2.png" + "images/sizeInOut.png" + "images/snowflake.png" + "images/sparkleSize.png" + "images/starfish_0.png" + "images/starfish_1.png" + "images/starfish_2.png" + "images/starfish_3.png" + "images/starfish_4.png" + "images/starfish_mask.png" +) + +qt6_add_resources(imageparticle "images" + PREFIX + "/particles" + BASE + ".." + FILES + ${images_resource_files} +) +set_source_files_properties("../../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(imageparticle "shared" + PREFIX + "/shared" + BASE + "../../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS imageparticle + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/particles/itemparticle/CMakeLists.txt b/examples/quick/particles/itemparticle/CMakeLists.txt new file mode 100644 index 0000000000..9e09849c30 --- /dev/null +++ b/examples/quick/particles/itemparticle/CMakeLists.txt @@ -0,0 +1,263 @@ +# Generated from itemparticle.pro. + +cmake_minimum_required(VERSION 3.14) +project(itemparticle LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/particles/itemparticle") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(itemparticle + main.cpp +) +target_link_libraries(itemparticle PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +file(GLOB resource_glob_0 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "content/*") +foreach(file IN LISTS resource_glob_0) + set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") +endforeach() + +file(GLOB resource_glob_1 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*qml") +foreach(file IN LISTS resource_glob_1) + set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") +endforeach() + +# Resources: +set_source_files_properties("../images/_explo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/_explo.png" +) +set_source_files_properties("../images/backgroundLeaves.jpg" + PROPERTIES QT_RESOURCE_ALIAS "images/backgroundLeaves.jpg" +) +set_source_files_properties("../images/bear_tiles.png" + PROPERTIES QT_RESOURCE_ALIAS "images/bear_tiles.png" +) +set_source_files_properties("../images/candle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/candle.png" +) +set_source_files_properties("../images/colortable.png" + PROPERTIES QT_RESOURCE_ALIAS "images/colortable.png" +) +set_source_files_properties("../images/finalfrontier.png" + PROPERTIES QT_RESOURCE_ALIAS "images/finalfrontier.png" +) +set_source_files_properties("../images/flower.png" + PROPERTIES QT_RESOURCE_ALIAS "images/flower.png" +) +set_source_files_properties("../images/matchmask.png" + PROPERTIES QT_RESOURCE_ALIAS "images/matchmask.png" +) +set_source_files_properties("../images/meteor.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteor.png" +) +set_source_files_properties("../images/meteor_explo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteor_explo.png" +) +set_source_files_properties("../images/meteors.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteors.png" +) +set_source_files_properties("../images/nullRock.png" + PROPERTIES QT_RESOURCE_ALIAS "images/nullRock.png" +) +set_source_files_properties("../images/particle2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particle2.png" +) +set_source_files_properties("../images/particle3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particle3.png" +) +set_source_files_properties("../images/particleA.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particleA.png" +) +set_source_files_properties("../images/portal_bg.png" + PROPERTIES QT_RESOURCE_ALIAS "images/portal_bg.png" +) +set_source_files_properties("../images/realLeaf1.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf1.png" +) +set_source_files_properties("../images/realLeaf2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf2.png" +) +set_source_files_properties("../images/realLeaf3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf3.png" +) +set_source_files_properties("../images/realLeaf4.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf4.png" +) +set_source_files_properties("../images/rocket.png" + PROPERTIES QT_RESOURCE_ALIAS "images/rocket.png" +) +set_source_files_properties("../images/rocket2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/rocket2.png" +) +set_source_files_properties("../images/sizeInOut.png" + PROPERTIES QT_RESOURCE_ALIAS "images/sizeInOut.png" +) +set_source_files_properties("../images/snowflake.png" + PROPERTIES QT_RESOURCE_ALIAS "images/snowflake.png" +) +set_source_files_properties("../images/sparkleSize.png" + PROPERTIES QT_RESOURCE_ALIAS "images/sparkleSize.png" +) +set_source_files_properties("../images/starfish_0.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_0.png" +) +set_source_files_properties("../images/starfish_1.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_1.png" +) +set_source_files_properties("../images/starfish_2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_2.png" +) +set_source_files_properties("../images/starfish_3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_3.png" +) +set_source_files_properties("../images/starfish_4.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_4.png" +) +set_source_files_properties("../images/starfish_mask.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_mask.png" +) +set(images_resource_files + "images/_explo.png" + "images/backgroundLeaves.jpg" + "images/bear_tiles.png" + "images/candle.png" + "images/colortable.png" + "images/finalfrontier.png" + "images/flower.png" + "images/matchmask.png" + "images/meteor.png" + "images/meteor_explo.png" + "images/meteors.png" + "images/nullRock.png" + "images/particle2.png" + "images/particle3.png" + "images/particleA.png" + "images/portal_bg.png" + "images/realLeaf1.png" + "images/realLeaf2.png" + "images/realLeaf3.png" + "images/realLeaf4.png" + "images/rocket.png" + "images/rocket2.png" + "images/sizeInOut.png" + "images/snowflake.png" + "images/sparkleSize.png" + "images/starfish_0.png" + "images/starfish_1.png" + "images/starfish_2.png" + "images/starfish_3.png" + "images/starfish_4.png" + "images/starfish_mask.png" +) + +qt6_add_resources(itemparticle "images" + PREFIX + "/particles" + BASE + ".." + FILES + ${images_resource_files} +) +set_source_files_properties("../../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(itemparticle "shared" + PREFIX + "/shared" + BASE + "../../shared" + FILES + ${shared_resource_files} +) +set(qmake_immediate_resource_files + ${resource_glob_0} + ${resource_glob_1} +) + +qt6_add_resources(itemparticle "qmake_immediate" + PREFIX + "/" + FILES + ${qmake_immediate_resource_files} +) + +install(TARGETS itemparticle + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/particles/system/CMakeLists.txt b/examples/quick/particles/system/CMakeLists.txt new file mode 100644 index 0000000000..09513b46f7 --- /dev/null +++ b/examples/quick/particles/system/CMakeLists.txt @@ -0,0 +1,257 @@ +# Generated from system.pro. + +cmake_minimum_required(VERSION 3.14) +project(system LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/particles/system") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(system + main.cpp +) +target_link_libraries(system PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(system_resource_files + "content/dynamiccomparison.qml" + "content/dynamicemitters.qml" + "content/multiplepainters.qml" + "content/startstop.qml" + "content/timedgroupchanges.qml" + "system.qml" +) + +qt6_add_resources(system "system" + PREFIX + "/particles/system" + FILES + ${system_resource_files} +) +set_source_files_properties("../images/_explo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/_explo.png" +) +set_source_files_properties("../images/backgroundLeaves.jpg" + PROPERTIES QT_RESOURCE_ALIAS "images/backgroundLeaves.jpg" +) +set_source_files_properties("../images/bear_tiles.png" + PROPERTIES QT_RESOURCE_ALIAS "images/bear_tiles.png" +) +set_source_files_properties("../images/candle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/candle.png" +) +set_source_files_properties("../images/colortable.png" + PROPERTIES QT_RESOURCE_ALIAS "images/colortable.png" +) +set_source_files_properties("../images/finalfrontier.png" + PROPERTIES QT_RESOURCE_ALIAS "images/finalfrontier.png" +) +set_source_files_properties("../images/flower.png" + PROPERTIES QT_RESOURCE_ALIAS "images/flower.png" +) +set_source_files_properties("../images/matchmask.png" + PROPERTIES QT_RESOURCE_ALIAS "images/matchmask.png" +) +set_source_files_properties("../images/meteor.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteor.png" +) +set_source_files_properties("../images/meteor_explo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteor_explo.png" +) +set_source_files_properties("../images/meteors.png" + PROPERTIES QT_RESOURCE_ALIAS "images/meteors.png" +) +set_source_files_properties("../images/nullRock.png" + PROPERTIES QT_RESOURCE_ALIAS "images/nullRock.png" +) +set_source_files_properties("../images/particle2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particle2.png" +) +set_source_files_properties("../images/particle3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particle3.png" +) +set_source_files_properties("../images/particleA.png" + PROPERTIES QT_RESOURCE_ALIAS "images/particleA.png" +) +set_source_files_properties("../images/portal_bg.png" + PROPERTIES QT_RESOURCE_ALIAS "images/portal_bg.png" +) +set_source_files_properties("../images/realLeaf1.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf1.png" +) +set_source_files_properties("../images/realLeaf2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf2.png" +) +set_source_files_properties("../images/realLeaf3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf3.png" +) +set_source_files_properties("../images/realLeaf4.png" + PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf4.png" +) +set_source_files_properties("../images/rocket.png" + PROPERTIES QT_RESOURCE_ALIAS "images/rocket.png" +) +set_source_files_properties("../images/rocket2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/rocket2.png" +) +set_source_files_properties("../images/sizeInOut.png" + PROPERTIES QT_RESOURCE_ALIAS "images/sizeInOut.png" +) +set_source_files_properties("../images/snowflake.png" + PROPERTIES QT_RESOURCE_ALIAS "images/snowflake.png" +) +set_source_files_properties("../images/sparkleSize.png" + PROPERTIES QT_RESOURCE_ALIAS "images/sparkleSize.png" +) +set_source_files_properties("../images/starfish_0.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_0.png" +) +set_source_files_properties("../images/starfish_1.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_1.png" +) +set_source_files_properties("../images/starfish_2.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_2.png" +) +set_source_files_properties("../images/starfish_3.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_3.png" +) +set_source_files_properties("../images/starfish_4.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_4.png" +) +set_source_files_properties("../images/starfish_mask.png" + PROPERTIES QT_RESOURCE_ALIAS "images/starfish_mask.png" +) +set(images_resource_files + "images/_explo.png" + "images/backgroundLeaves.jpg" + "images/bear_tiles.png" + "images/candle.png" + "images/colortable.png" + "images/finalfrontier.png" + "images/flower.png" + "images/matchmask.png" + "images/meteor.png" + "images/meteor_explo.png" + "images/meteors.png" + "images/nullRock.png" + "images/particle2.png" + "images/particle3.png" + "images/particleA.png" + "images/portal_bg.png" + "images/realLeaf1.png" + "images/realLeaf2.png" + "images/realLeaf3.png" + "images/realLeaf4.png" + "images/rocket.png" + "images/rocket2.png" + "images/sizeInOut.png" + "images/snowflake.png" + "images/sparkleSize.png" + "images/starfish_0.png" + "images/starfish_1.png" + "images/starfish_2.png" + "images/starfish_3.png" + "images/starfish_4.png" + "images/starfish_mask.png" +) + +qt6_add_resources(system "images" + PREFIX + "/particles" + BASE + ".." + FILES + ${images_resource_files} +) +set_source_files_properties("../../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(system "shared" + PREFIX + "/shared" + BASE + "../../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS system + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/positioners/CMakeLists.txt b/examples/quick/positioners/CMakeLists.txt new file mode 100644 index 0000000000..1f8cb8a855 --- /dev/null +++ b/examples/quick/positioners/CMakeLists.txt @@ -0,0 +1,119 @@ +# Generated from positioners.pro. + +cmake_minimum_required(VERSION 3.14) +project(positioners LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/positioners") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(positioners + main.cpp +) +target_link_libraries(positioners PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(positioners_resource_files + "positioners-attachedproperties.qml" + "positioners-transitions.qml" + "positioners.qml" +) + +qt6_add_resources(positioners "positioners" + PREFIX + "/positioners" + FILES + ${positioners_resource_files} +) +set_source_files_properties("../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(positioners "shared" + PREFIX + "/shared" + BASE + "../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS positioners + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/quick-accessibility/CMakeLists.txt b/examples/quick/quick-accessibility/CMakeLists.txt new file mode 100644 index 0000000000..965d4fd820 --- /dev/null +++ b/examples/quick/quick-accessibility/CMakeLists.txt @@ -0,0 +1,49 @@ +# Generated from quick-accessibility.pro. + +cmake_minimum_required(VERSION 3.14) +project(quick-accessibility LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/quick-accessibility") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(quick-accessibility + main.cpp +) +target_link_libraries(quick-accessibility PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(accessibility_resource_files + "accessibility.qml" + "content/Button.qml" + "content/Checkbox.qml" + "content/Slider.qml" +) + +qt6_add_resources(quick-accessibility "accessibility" + PREFIX + "/accessibility" + FILES + ${accessibility_resource_files} +) + +install(TARGETS quick-accessibility + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/quickwidgets/CMakeLists.txt b/examples/quick/quickwidgets/CMakeLists.txt new file mode 100644 index 0000000000..637e8a50eb --- /dev/null +++ b/examples/quick/quickwidgets/CMakeLists.txt @@ -0,0 +1,4 @@ +# Generated from quickwidgets.pro. + +add_subdirectory(quickwidget) +add_subdirectory(qquickviewcomparison) diff --git a/examples/quick/quickwidgets/qquickviewcomparison/CMakeLists.txt b/examples/quick/quickwidgets/qquickviewcomparison/CMakeLists.txt new file mode 100644 index 0000000000..f9d83f55b9 --- /dev/null +++ b/examples/quick/quickwidgets/qquickviewcomparison/CMakeLists.txt @@ -0,0 +1,59 @@ +# Generated from qquickviewcomparison.pro. + +cmake_minimum_required(VERSION 3.14) +project(qquickviewcomparison LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/quickwidgets/qquickviewcomparison") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Widgets) +find_package(Qt6 COMPONENTS QuickWidgets) + +add_qt_gui_executable(qquickviewcomparison + fbitem.cpp fbitem.h + logo.cpp logo.h + main.cpp + mainwindow.cpp mainwindow.h +) +target_link_libraries(qquickviewcomparison PUBLIC + Qt::Core + Qt::Gui + Qt::Quick + Qt::QuickWidgets + Qt::Widgets +) + + +# Resources: +set(qquickviewcomparison_resource_files + "test.qml" +) + +qt6_add_resources(qquickviewcomparison "qquickviewcomparison" + PREFIX + "/qquickviewcomparison" + FILES + ${qquickviewcomparison_resource_files} +) + +install(TARGETS qquickviewcomparison + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(qquickviewcomparison PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI fbitem +) + +qt6_qml_type_registration(qquickviewcomparison) diff --git a/examples/quick/quickwidgets/quickwidget/CMakeLists.txt b/examples/quick/quickwidgets/quickwidget/CMakeLists.txt new file mode 100644 index 0000000000..1396b830b4 --- /dev/null +++ b/examples/quick/quickwidgets/quickwidget/CMakeLists.txt @@ -0,0 +1,59 @@ +# Generated from quickwidget.pro. + +cmake_minimum_required(VERSION 3.14) +project(quickwidget LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/quickwidgets/quickwidget") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Widgets) +find_package(Qt6 COMPONENTS QuickWidgets) + +add_qt_gui_executable(quickwidget + fbitem.cpp fbitem.h + main.cpp +) +target_link_libraries(quickwidget PUBLIC + Qt::Core + Qt::Gui + Qt::Quick + Qt::QuickWidgets + Qt::Widgets +) + + +# Resources: +set(quickwidget_resource_files + "customgl.qml" + "rotatingsquare.qml" + "rotatingsquaretab.qml" +) + +qt6_add_resources(quickwidget "quickwidget" + PREFIX + "/quickwidget" + FILES + ${quickwidget_resource_files} +) + +install(TARGETS quickwidget + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(quickwidget PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI QuickWidgetExample +) + +qt6_qml_type_registration(quickwidget) diff --git a/examples/quick/quickwidgets/quickwidget/fbitem.cpp b/examples/quick/quickwidgets/quickwidget/fbitem.cpp index 95ff2da2e0..3e98168dcf 100644 --- a/examples/quick/quickwidgets/quickwidget/fbitem.cpp +++ b/examples/quick/quickwidgets/quickwidget/fbitem.cpp @@ -49,9 +49,9 @@ ****************************************************************************/ #include "fbitem.h" -#include <QtGui/QOpenGLFramebufferObject> -#include <QtGui/QOpenGLContext> -#include <QtGui/QOpenGLFunctions> +#include <QOpenGLFramebufferObject> +#include <QOpenGLContext> +#include <QOpenGLFunctions> #include <QtCore/QDebug> #if QT_CONFIG(opengl) diff --git a/examples/quick/rendercontrol/CMakeLists.txt b/examples/quick/rendercontrol/CMakeLists.txt new file mode 100644 index 0000000000..bfcd71de24 --- /dev/null +++ b/examples/quick/rendercontrol/CMakeLists.txt @@ -0,0 +1,3 @@ +# Generated from rendercontrol.pro. + +add_subdirectory(rendercontrol_opengl) diff --git a/examples/quick/rendercontrol/rendercontrol.pro b/examples/quick/rendercontrol/rendercontrol.pro index 3301a773a4..cdb431c8fd 100644 --- a/examples/quick/rendercontrol/rendercontrol.pro +++ b/examples/quick/rendercontrol/rendercontrol.pro @@ -1,17 +1,4 @@ -TEMPLATE = app +TEMPLATE = subdirs -QT += quick qml - -SOURCES += main.cpp \ - window_singlethreaded.cpp \ - window_multithreaded.cpp \ - cuberenderer.cpp - -HEADERS += window_singlethreaded.h \ - window_multithreaded.h \ - cuberenderer.h - -RESOURCES += rendercontrol.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/rendercontrol -INSTALLS += target +SUBDIRS = \ + rendercontrol_opengl diff --git a/examples/quick/rendercontrol/rendercontrol_opengl/CMakeLists.txt b/examples/quick/rendercontrol/rendercontrol_opengl/CMakeLists.txt new file mode 100644 index 0000000000..fb1c6ecf12 --- /dev/null +++ b/examples/quick/rendercontrol/rendercontrol_opengl/CMakeLists.txt @@ -0,0 +1,49 @@ +# Generated from rendercontrol_opengl.pro. + +cmake_minimum_required(VERSION 3.14) +project(rendercontrol_opengl LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/rendercontrol/rendercontrol_opengl") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(rendercontrol_opengl + cuberenderer.cpp cuberenderer.h + main.cpp + window_multithreaded.cpp window_multithreaded.h + window_singlethreaded.cpp window_singlethreaded.h +) +target_link_libraries(rendercontrol_opengl PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(rendercontrol_resource_files + "demo.qml" +) + +qt6_add_resources(rendercontrol_opengl "rendercontrol" + PREFIX + "/rendercontrol" + FILES + ${rendercontrol_resource_files} +) + +install(TARGETS rendercontrol_opengl + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/rendercontrol/cuberenderer.cpp b/examples/quick/rendercontrol/rendercontrol_opengl/cuberenderer.cpp index f3ecfc2566..f3ecfc2566 100644 --- a/examples/quick/rendercontrol/cuberenderer.cpp +++ b/examples/quick/rendercontrol/rendercontrol_opengl/cuberenderer.cpp diff --git a/examples/quick/rendercontrol/cuberenderer.h b/examples/quick/rendercontrol/rendercontrol_opengl/cuberenderer.h index c7655a3c8e..c7655a3c8e 100644 --- a/examples/quick/rendercontrol/cuberenderer.h +++ b/examples/quick/rendercontrol/rendercontrol_opengl/cuberenderer.h diff --git a/examples/quick/rendercontrol/demo.qml b/examples/quick/rendercontrol/rendercontrol_opengl/demo.qml index 0312c2ec1c..0312c2ec1c 100644 --- a/examples/quick/rendercontrol/demo.qml +++ b/examples/quick/rendercontrol/rendercontrol_opengl/demo.qml diff --git a/examples/quick/rendercontrol/doc/images/rendercontrol-example.jpg b/examples/quick/rendercontrol/rendercontrol_opengl/doc/images/rendercontrol-example.jpg Binary files differindex a899ebe7f5..a899ebe7f5 100644 --- a/examples/quick/rendercontrol/doc/images/rendercontrol-example.jpg +++ b/examples/quick/rendercontrol/rendercontrol_opengl/doc/images/rendercontrol-example.jpg diff --git a/examples/quick/rendercontrol/doc/src/rendercontrol.qdoc b/examples/quick/rendercontrol/rendercontrol_opengl/doc/src/rendercontrol.qdoc index 026a6f5a09..9b6b075a5b 100644 --- a/examples/quick/rendercontrol/doc/src/rendercontrol.qdoc +++ b/examples/quick/rendercontrol/rendercontrol_opengl/doc/src/rendercontrol.qdoc @@ -27,7 +27,7 @@ /*! \title QQuickRenderControl Example - \example rendercontrol + \example rendercontrol/rendercontrol_opengl \brief Shows how to render a Qt Quick scene into a texture that is then used by a non-Quick based OpenGL renderer. \image rendercontrol-example.jpg */ diff --git a/examples/quick/rendercontrol/main.cpp b/examples/quick/rendercontrol/rendercontrol_opengl/main.cpp index 71903045cc..71903045cc 100644 --- a/examples/quick/rendercontrol/main.cpp +++ b/examples/quick/rendercontrol/rendercontrol_opengl/main.cpp diff --git a/examples/quick/rendercontrol/rendercontrol.qrc b/examples/quick/rendercontrol/rendercontrol_opengl/rendercontrol.qrc index 2246eeb842..2246eeb842 100644 --- a/examples/quick/rendercontrol/rendercontrol.qrc +++ b/examples/quick/rendercontrol/rendercontrol_opengl/rendercontrol.qrc diff --git a/examples/quick/rendercontrol/rendercontrol_opengl/rendercontrol_opengl.pro b/examples/quick/rendercontrol/rendercontrol_opengl/rendercontrol_opengl.pro new file mode 100644 index 0000000000..900f5d14dd --- /dev/null +++ b/examples/quick/rendercontrol/rendercontrol_opengl/rendercontrol_opengl.pro @@ -0,0 +1,17 @@ +TEMPLATE = app + +QT += quick qml + +SOURCES += main.cpp \ + window_singlethreaded.cpp \ + window_multithreaded.cpp \ + cuberenderer.cpp + +HEADERS += window_singlethreaded.h \ + window_multithreaded.h \ + cuberenderer.h + +RESOURCES += rendercontrol.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/rendercontrol/rendercontrol_opengl +INSTALLS += target diff --git a/examples/quick/rendercontrol/window_multithreaded.cpp b/examples/quick/rendercontrol/rendercontrol_opengl/window_multithreaded.cpp index 01d6b8b5b2..01d6b8b5b2 100644 --- a/examples/quick/rendercontrol/window_multithreaded.cpp +++ b/examples/quick/rendercontrol/rendercontrol_opengl/window_multithreaded.cpp diff --git a/examples/quick/rendercontrol/window_multithreaded.h b/examples/quick/rendercontrol/rendercontrol_opengl/window_multithreaded.h index ded80a0064..ded80a0064 100644 --- a/examples/quick/rendercontrol/window_multithreaded.h +++ b/examples/quick/rendercontrol/rendercontrol_opengl/window_multithreaded.h diff --git a/examples/quick/rendercontrol/window_singlethreaded.cpp b/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.cpp index ddbbfe4b52..ddbbfe4b52 100644 --- a/examples/quick/rendercontrol/window_singlethreaded.cpp +++ b/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.cpp diff --git a/examples/quick/rendercontrol/window_singlethreaded.h b/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.h index 44b79d9f51..44b79d9f51 100644 --- a/examples/quick/rendercontrol/window_singlethreaded.h +++ b/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.h diff --git a/examples/quick/righttoleft/CMakeLists.txt b/examples/quick/righttoleft/CMakeLists.txt new file mode 100644 index 0000000000..e077f2e977 --- /dev/null +++ b/examples/quick/righttoleft/CMakeLists.txt @@ -0,0 +1,120 @@ +# Generated from righttoleft.pro. + +cmake_minimum_required(VERSION 3.14) +project(righttoleft LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/righttoleft") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(righttoleft + main.cpp +) +target_link_libraries(righttoleft PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(righttoleft_resource_files + "layoutdirection/layoutdirection.qml" + "layoutmirroring/layoutmirroring.qml" + "righttoleft.qml" + "textalignment/textalignment.qml" +) + +qt6_add_resources(righttoleft "righttoleft" + PREFIX + "/righttoleft" + FILES + ${righttoleft_resource_files} +) +set_source_files_properties("../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(righttoleft "shared" + PREFIX + "/shared" + BASE + "../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS righttoleft + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/scenegraph/.prev_CMakeLists.txt b/examples/quick/scenegraph/.prev_CMakeLists.txt new file mode 100644 index 0000000000..cf72c90b8d --- /dev/null +++ b/examples/quick/scenegraph/.prev_CMakeLists.txt @@ -0,0 +1,25 @@ +# Generated from scenegraph.pro. + +add_subdirectory(customgeometry) +add_subdirectory(rendernode) +add_subdirectory(threadedanimation) +if(QT_FEATURE_opengl OR QT_FEATURE_opengles2 OR QT_FEATURE_opengles3) + add_subdirectory(graph) + add_subdirectory(simplematerial) + add_subdirectory(sgengine) + add_subdirectory(fboitem) + add_subdirectory(openglunderqml) + add_subdirectory(textureinthread) + add_subdirectory(twotextureproviders) +endif() +if(IOS OR MACOS) + add_subdirectory(metalunderqml) + add_subdirectory(metaltextureimport) +endif() +if(WIN32) + add_subdirectory(d3d11underqml) +endif() +if(QT_FEATURE_vulkan) + add_subdirectory(vulkanunderqml) + add_subdirectory(vulkantextureimport) +endif() diff --git a/examples/quick/scenegraph/CMakeLists.txt b/examples/quick/scenegraph/CMakeLists.txt new file mode 100644 index 0000000000..2a5db7da54 --- /dev/null +++ b/examples/quick/scenegraph/CMakeLists.txt @@ -0,0 +1,22 @@ +# Generated from scenegraph.pro. + +add_subdirectory(customgeometry) +# add_subdirectory(rendernode) # special case needs fixing +add_subdirectory(threadedanimation) +if(QT_FEATURE_opengl OR QT_FEATURE_opengles2 OR QT_FEATURE_opengles3) + add_subdirectory(graph) + add_subdirectory(fboitem) + add_subdirectory(openglunderqml) + add_subdirectory(textureinthread) + add_subdirectory(twotextureproviders) +endif() +if(MACOS) + # add_subdirectory(metalunderqml) # special case needs fixing + # add_subdirectory(metaltextureimport) # special case TODO +endif() +if(WIN32) + add_subdirectory(d3d11underqml) +endif() +if(QT_FEATURE_vulkan) + #add_subdirectory(vulkanunderqml) # special case not yet converted +endif() diff --git a/examples/quick/scenegraph/customgeometry/CMakeLists.txt b/examples/quick/scenegraph/customgeometry/CMakeLists.txt new file mode 100644 index 0000000000..0b1a99097b --- /dev/null +++ b/examples/quick/scenegraph/customgeometry/CMakeLists.txt @@ -0,0 +1,53 @@ +# Generated from customgeometry.pro. + +cmake_minimum_required(VERSION 3.14) +project(customgeometry LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/scenegraph/customgeometry") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(customgeometry + beziercurve.cpp beziercurve.h + main.cpp +) +target_link_libraries(customgeometry PUBLIC + Qt::Core + Qt::Gui + Qt::Quick +) + + +# Resources: +set(customgeometry_resource_files + "main.qml" +) + +qt6_add_resources(customgeometry "customgeometry" + PREFIX + "/scenegraph/customgeometry" + FILES + ${customgeometry_resource_files} +) + +install(TARGETS customgeometry + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(customgeometry PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI CustomGeometry +) + +qt6_qml_type_registration(customgeometry) diff --git a/examples/quick/scenegraph/d3d11underqml/CMakeLists.txt b/examples/quick/scenegraph/d3d11underqml/CMakeLists.txt new file mode 100644 index 0000000000..23edb3eceb --- /dev/null +++ b/examples/quick/scenegraph/d3d11underqml/CMakeLists.txt @@ -0,0 +1,59 @@ +# Generated from d3d11underqml.pro. + +cmake_minimum_required(VERSION 3.14) +project(d3d11underqml LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/scenegraph/d3d11underqml") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(d3d11underqml + d3d11squircle.cpp d3d11squircle.h + main.cpp +) +target_link_libraries(d3d11underqml PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick + d3d11 + d3dcompiler +) + + +# Resources: +set(d3d11underqml_resource_files + "main.qml" + "squircle.frag" + "squircle.vert" +) + +qt6_add_resources(d3d11underqml "d3d11underqml" + PREFIX + "/scenegraph/d3d11underqml" + FILES + ${d3d11underqml_resource_files} +) + +install(TARGETS d3d11underqml + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(d3d11underqml PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI D3D11UnderQML +) + +qt6_qml_type_registration(d3d11underqml) diff --git a/examples/quick/scenegraph/fboitem/CMakeLists.txt b/examples/quick/scenegraph/fboitem/CMakeLists.txt new file mode 100644 index 0000000000..ba4b487415 --- /dev/null +++ b/examples/quick/scenegraph/fboitem/CMakeLists.txt @@ -0,0 +1,62 @@ +# Generated from fboitem.pro. + +cmake_minimum_required(VERSION 3.14) +project(fboitem LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/scenegraph/fboitem") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(fboitem + ../shared/logorenderer.cpp ../shared/logorenderer.h + fboinsgrenderer.cpp fboinsgrenderer.h + main.cpp +) +target_include_directories(fboitem PUBLIC + ../shared +) + +target_link_libraries(fboitem PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(fboitem_resource_files + "main.qml" + "shaders/+qsb/checker.frag" + "shaders/checker.frag" +) + +qt6_add_resources(fboitem "fboitem" + PREFIX + "/scenegraph/fboitem" + FILES + ${fboitem_resource_files} +) + +install(TARGETS fboitem + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(fboitem PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI SceneGraphRendering +) + +qt6_qml_type_registration(fboitem) diff --git a/examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp b/examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp index 8ba5bddb2a..1c7be258be 100644 --- a/examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp +++ b/examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp @@ -51,7 +51,7 @@ #include "fboinsgrenderer.h" #include "logorenderer.h" -#include <QtGui/QOpenGLFramebufferObject> +#include <QOpenGLFramebufferObject> #include <QtQuick/QQuickWindow> #include <qsgsimpletexturenode.h> diff --git a/examples/quick/scenegraph/graph/CMakeLists.txt b/examples/quick/scenegraph/graph/CMakeLists.txt new file mode 100644 index 0000000000..82cbe495bb --- /dev/null +++ b/examples/quick/scenegraph/graph/CMakeLists.txt @@ -0,0 +1,60 @@ +# Generated from graph.pro. + +cmake_minimum_required(VERSION 3.14) +project(graph LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/scenegraph/graph") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(graph + graph.cpp graph.h + gridnode.cpp gridnode.h + linenode.cpp linenode.h + main.cpp + noisynode.cpp noisynode.h +) +target_link_libraries(graph PUBLIC + Qt::Core + Qt::Gui + Qt::Quick +) + + +# Resources: +set(graph_resource_files + "main.qml" + "shaders/line.frag.qsb" + "shaders/line.vert.qsb" + "shaders/noisy.frag.qsb" + "shaders/noisy.vert.qsb" +) + +qt6_add_resources(graph "graph" + PREFIX + "/scenegraph/graph" + FILES + ${graph_resource_files} +) + +install(TARGETS graph + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(graph PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI Graph +) + +qt6_qml_type_registration(graph) diff --git a/examples/quick/scenegraph/graph/graph.pro b/examples/quick/scenegraph/graph/graph.pro index fe36585d77..56aebdc6ea 100644 --- a/examples/quick/scenegraph/graph/graph.pro +++ b/examples/quick/scenegraph/graph/graph.pro @@ -24,11 +24,7 @@ RESOURCES += \ graph.qrc OTHER_FILES += \ - main.qml \ - shaders/noisy.vsh \ - shaders/noisy.fsh \ - shaders/line.fsh \ - shaders/line.vsh + main.qml target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/graph INSTALLS += target diff --git a/examples/quick/scenegraph/graph/graph.qrc b/examples/quick/scenegraph/graph/graph.qrc index 2adaeac751..b7fc7539f8 100644 --- a/examples/quick/scenegraph/graph/graph.qrc +++ b/examples/quick/scenegraph/graph/graph.qrc @@ -1,9 +1,9 @@ <RCC> <qresource prefix="/scenegraph/graph"> <file>main.qml</file> - <file>shaders/noisy.vsh</file> - <file>shaders/noisy.fsh</file> - <file>shaders/line.vsh</file> - <file>shaders/line.fsh</file> + <file>shaders/noisy.vert.qsb</file> + <file>shaders/noisy.frag.qsb</file> + <file>shaders/line.vert.qsb</file> + <file>shaders/line.frag.qsb</file> </qresource> </RCC> diff --git a/examples/quick/scenegraph/graph/linenode.cpp b/examples/quick/scenegraph/graph/linenode.cpp index cb7f1c8e7f..5d4d8acd20 100644 --- a/examples/quick/scenegraph/graph/linenode.cpp +++ b/examples/quick/scenegraph/graph/linenode.cpp @@ -52,45 +52,90 @@ #include <QtGui/QColor> -#include <QtQuick/QSGSimpleMaterial> +#include <QtQuick/QSGMaterial> -struct LineMaterial +class LineShader : public QSGMaterialRhiShader { - QColor color; - float spread; - float size; +public: + LineShader() { + setShaderFileName(VertexStage, QLatin1String(":/scenegraph/graph/shaders/line.vert.qsb")); + setShaderFileName(FragmentStage, QLatin1String(":/scenegraph/graph/shaders/line.frag.qsb")); + } + + bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override; }; -class LineShader : public QSGSimpleMaterialShader<LineMaterial> +class LineMaterial : public QSGMaterial { - QSG_DECLARE_SIMPLE_SHADER(LineShader, LineMaterial) - public: - LineShader() { - setShaderSourceFile(QOpenGLShader::Vertex, ":/scenegraph/graph/shaders/line.vsh"); - setShaderSourceFile(QOpenGLShader::Fragment, ":/scenegraph/graph/shaders/line.fsh"); + LineMaterial() + { + setFlag(SupportsRhiShader); + setFlag(Blending); } - QList<QByteArray> attributes() const override { return QList<QByteArray>() << "pos" << "t"; } + QSGMaterialType *type() const override + { + static QSGMaterialType type; + return &type; + } - void updateState(const LineMaterial *m, const LineMaterial *) override { - program()->setUniformValue(id_color, m->color); - program()->setUniformValue(id_spread, m->spread); - program()->setUniformValue(id_size, m->size); + QSGMaterialShader *createShader() const override + { + Q_ASSERT(flags().testFlag(RhiShaderWanted)); + return new LineShader; } - void resolveUniforms() override { - id_spread = program()->uniformLocation("spread"); - id_size = program()->uniformLocation("size"); - id_color = program()->uniformLocation("color"); + int compare(const QSGMaterial *m) const override + { + const LineMaterial *other = static_cast<const LineMaterial *>(m); + + if (int diff = int(state.color.rgb()) - int(other->state.color.rgb())) + return diff; + + if (int diff = state.size - other->state.size) + return diff; + + if (int diff = state.spread - other->state.spread) + return diff; + + return 0; } -private: - int id_color = -1; - int id_spread = -1; - int id_size = -1; + struct { + QColor color; + float size; + float spread; + } state; }; +bool LineShader::updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *) +{ + QByteArray *buf = state.uniformData(); + Q_ASSERT(buf->size() >= 92); + + if (state.isMatrixDirty()) { + const QMatrix4x4 m = state.combinedMatrix(); + memcpy(buf->data(), m.constData(), 64); + } + + if (state.isOpacityDirty()) { + const float opacity = state.opacity(); + memcpy(buf->data() + 80, &opacity, 4); + } + + LineMaterial *mat = static_cast<LineMaterial *>(newMaterial); + float c[4] = { float(mat->state.color.redF()), + float(mat->state.color.greenF()), + float(mat->state.color.blueF()), + float(mat->state.color.alphaF()) }; + memcpy(buf->data() + 64, c, 16); + memcpy(buf->data() + 84, &mat->state.size, 4); + memcpy(buf->data() + 88, &mat->state.spread, 4); + + return true; +} + struct LineVertex { float x; float y; @@ -114,11 +159,11 @@ LineNode::LineNode(float size, float spread, const QColor &color) setGeometry(&m_geometry); m_geometry.setDrawingMode(GL_TRIANGLE_STRIP); - QSGSimpleMaterial<LineMaterial> *m = LineShader::createMaterial(); - m->state()->color = color; - m->state()->size = size; - m->state()->spread = spread; - m->setFlag(QSGMaterial::Blending); + LineMaterial *m = new LineMaterial; + m->state.color = color; + m->state.size = size; + m->state.spread = spread; + setMaterial(m); setFlag(OwnsMaterial); } diff --git a/examples/quick/scenegraph/graph/main.cpp b/examples/quick/scenegraph/graph/main.cpp index 854fad84e3..95c310131b 100644 --- a/examples/quick/scenegraph/graph/main.cpp +++ b/examples/quick/scenegraph/graph/main.cpp @@ -56,6 +56,8 @@ int main(int argc, char *argv[]) { + qputenv("QSG_RHI", "1"); // ### Qt 6 remove, this will be the default anyway + QGuiApplication a(argc, argv); QQuickView view; diff --git a/examples/quick/scenegraph/graph/noisynode.cpp b/examples/quick/scenegraph/graph/noisynode.cpp index de5a616da2..d67110f48a 100644 --- a/examples/quick/scenegraph/graph/noisynode.cpp +++ b/examples/quick/scenegraph/graph/noisynode.cpp @@ -51,63 +51,113 @@ #include "noisynode.h" #include <QtCore/QRandomGenerator> -#include <QtQuick/QSGSimpleMaterialShader> + #include <QtQuick/QSGTexture> #include <QtQuick/QQuickWindow> +#include <QtQuick/QSGMaterial> #define NOISE_SIZE 64 -struct NoisyMaterial +class NoisyShader : public QSGMaterialRhiShader { - ~NoisyMaterial() { - delete texture; +public: + NoisyShader() { + setShaderFileName(VertexStage, QLatin1String(":/scenegraph/graph/shaders/noisy.vert.qsb")); + setShaderFileName(FragmentStage, QLatin1String(":/scenegraph/graph/shaders/noisy.frag.qsb")); } - QColor color; - QSGTexture *texture; + bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override; + void updateSampledImage(RenderState &state, int binding, QSGTexture **texture, + QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override; }; -class NoisyShader : public QSGSimpleMaterialShader<NoisyMaterial> +class NoisyMaterial : public QSGMaterial { - QSG_DECLARE_SIMPLE_SHADER(NoisyShader, NoisyMaterial) - public: - NoisyShader() { - setShaderSourceFile(QOpenGLShader::Vertex, ":/scenegraph/graph/shaders/noisy.vsh"); - setShaderSourceFile(QOpenGLShader::Fragment, ":/scenegraph/graph/shaders/noisy.fsh"); + NoisyMaterial() + { + setFlag(SupportsRhiShader); + setFlag(Blending); + } + + ~NoisyMaterial() + { + delete state.texture; } - QList<QByteArray> attributes() const override { return QList<QByteArray>() << "aVertex" << "aTexCoord"; } + QSGMaterialType *type() const override + { + static QSGMaterialType type; + return &type; + } - void updateState(const NoisyMaterial *m, const NoisyMaterial *) override { + QSGMaterialShader *createShader() const override + { + Q_ASSERT(flags().testFlag(RhiShaderWanted)); + return new NoisyShader; + } - // Set the color - program()->setUniformValue(id_color, m->color); + int compare(const QSGMaterial *m) const override + { + const NoisyMaterial *other = static_cast<const NoisyMaterial *>(m); - // Bind the texture and set program to use texture unit 0 (the default) - m->texture->bind(); + if (int diff = int(state.color.rgb()) - int(other->state.color.rgb())) + return diff; - // Then set the texture size so we can adjust the texture coordinates accordingly in the - // vertex shader.. - QSize s = m->texture->textureSize(); - program()->setUniformValue(id_textureSize, QSizeF(1.0 / s.width(), 1.0 / s.height())); - } + if (!state.texture || !other->state.texture) + return state.texture ? 1 : -1; - void resolveUniforms() override { - id_texture = program()->uniformLocation("texture"); - id_textureSize = program()->uniformLocation("textureSize"); - id_color = program()->uniformLocation("color"); + if (int diff = state.texture->comparisonKey() - other->state.texture->comparisonKey()) + return diff; - // We will only use texture unit 0, so set it only once. - program()->setUniformValue(id_texture, 0); + return 0; } -private: - int id_color = -1; - int id_texture = -1; - int id_textureSize = -1; + struct { + QColor color; + QSGTexture *texture; + } state; }; +bool NoisyShader::updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *) +{ + QByteArray *buf = state.uniformData(); + Q_ASSERT(buf->size() >= 92); + + if (state.isMatrixDirty()) { + const QMatrix4x4 m = state.combinedMatrix(); + memcpy(buf->data(), m.constData(), 64); + } + + if (state.isOpacityDirty()) { + const float opacity = state.opacity(); + memcpy(buf->data() + 88, &opacity, 4); + } + + NoisyMaterial *mat = static_cast<NoisyMaterial *>(newMaterial); + float c[4] = { float(mat->state.color.redF()), + float(mat->state.color.greenF()), + float(mat->state.color.blueF()), + float(mat->state.color.alphaF()) }; + memcpy(buf->data() + 64, c, 16); + + const QSize s = mat->state.texture->textureSize(); + float textureSize[2] = { 1.0f / s.width(), 1.0f / s.height() }; + memcpy(buf->data() + 80, textureSize, 8); + + return true; +} + +void NoisyShader::updateSampledImage(RenderState &state, int binding, QSGTexture **texture, + QSGMaterial *newMaterial, QSGMaterial *) +{ + Q_UNUSED(state); + Q_UNUSED(binding); + + NoisyMaterial *mat = static_cast<NoisyMaterial *>(newMaterial); + *texture = mat->state.texture; +} + NoisyNode::NoisyNode(QQuickWindow *window) { // Make some noise... @@ -123,10 +173,9 @@ NoisyNode::NoisyNode(QQuickWindow *window) t->setHorizontalWrapMode(QSGTexture::Repeat); t->setVerticalWrapMode(QSGTexture::Repeat); - QSGSimpleMaterial<NoisyMaterial> *m = NoisyShader::createMaterial(); - m->state()->texture = t; - m->state()->color = QColor::fromRgbF(0.95, 0.95, 0.97); - m->setFlag(QSGMaterial::Blending); + NoisyMaterial *m = new NoisyMaterial; + m->state.texture = t; + m->state.color = QColor::fromRgbF(0.95, 0.95, 0.97); setMaterial(m); setFlag(OwnsMaterial, true); diff --git a/examples/quick/scenegraph/graph/shaders/compile.bat b/examples/quick/scenegraph/graph/shaders/compile.bat new file mode 100644 index 0000000000..4ec3f2ec8e --- /dev/null +++ b/examples/quick/scenegraph/graph/shaders/compile.bat @@ -0,0 +1,54 @@ +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: +:: Copyright (C) 2019 The Qt Company Ltd. +:: Contact: https://www.qt.io/licensing/ +:: +:: This file is part of the examples of the Qt Toolkit. +:: +:: $QT_BEGIN_LICENSE:BSD$ +:: Commercial License Usage +:: Licensees holding valid commercial Qt licenses may use this file in +:: accordance with the commercial license agreement provided with the +:: Software or, alternatively, in accordance with the terms contained in +:: a written agreement between you and The Qt Company. For licensing terms +:: and conditions see https://www.qt.io/terms-conditions. For further +:: information use the contact form at https://www.qt.io/contact-us. +:: +:: BSD License Usage +:: Alternatively, you may use this file under the terms of the BSD license +:: as follows: +:: +:: "Redistribution and use in source and binary forms, with or without +:: modification, are permitted provided that the following conditions are +:: met: +:: * Redistributions of source code must retain the above copyright +:: notice, this list of conditions and the following disclaimer. +:: * Redistributions in binary form must reproduce the above copyright +:: notice, this list of conditions and the following disclaimer in +:: the documentation and/or other materials provided with the +:: distribution. +:: * Neither the name of The Qt Company Ltd nor the names of its +:: contributors may be used to endorse or promote products derived +:: from this software without specific prior written permission. +:: +:: +:: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +:: "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +:: LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +:: A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +:: OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +:: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +:: LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +:: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +:: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +:: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +:: OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +:: +:: $QT_END_LICENSE$ +:: +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o noisy.vert.qsb noisy.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o noisy.frag.qsb noisy.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o line.vert.qsb line.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o line.frag.qsb line.frag diff --git a/examples/quick/scenegraph/graph/shaders/line.frag b/examples/quick/scenegraph/graph/shaders/line.frag new file mode 100644 index 0000000000..44b5b24c94 --- /dev/null +++ b/examples/quick/scenegraph/graph/shaders/line.frag @@ -0,0 +1,21 @@ +#version 440 + +layout(location = 0) in float vT; + +layout(location = 0) out vec4 fragColor; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + vec4 color; + float qt_Opacity; + float size; + float spread; +}; + +#define PI 3.14159265358979323846 + +void main(void) +{ + float tt = smoothstep(spread, 1.0, sin(vT * PI)); + fragColor = color * qt_Opacity * tt; +} diff --git a/examples/quick/scenegraph/graph/shaders/line.frag.qsb b/examples/quick/scenegraph/graph/shaders/line.frag.qsb Binary files differnew file mode 100644 index 0000000000..7efcd94c37 --- /dev/null +++ b/examples/quick/scenegraph/graph/shaders/line.frag.qsb diff --git a/examples/quick/scenegraph/graph/shaders/line.fsh b/examples/quick/scenegraph/graph/shaders/line.fsh deleted file mode 100644 index 77e05a2d15..0000000000 --- a/examples/quick/scenegraph/graph/shaders/line.fsh +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -uniform lowp vec4 color; -uniform lowp float qt_Opacity; -uniform lowp float spread; - -varying lowp float vT; - -#define PI 3.14159265358979323846 - -void main(void) -{ - lowp float tt = smoothstep(spread, 1.0, sin(vT * PI)); - - gl_FragColor = color * qt_Opacity * tt; -} diff --git a/examples/quick/scenegraph/graph/shaders/line.vert b/examples/quick/scenegraph/graph/shaders/line.vert new file mode 100644 index 0000000000..eac4273f0a --- /dev/null +++ b/examples/quick/scenegraph/graph/shaders/line.vert @@ -0,0 +1,25 @@ +#version 440 + +layout(location = 0) in vec4 pos; +layout(location = 1) in float t; + +layout(location = 0) out float vT; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + vec4 color; + float qt_Opacity; + float size; + float spread; +}; + +out gl_PerVertex { vec4 gl_Position; }; + +void main(void) +{ + vec4 adjustedPos = pos; + adjustedPos.y += (t * size); + gl_Position = qt_Matrix * adjustedPos; + + vT = t; +} diff --git a/examples/quick/scenegraph/graph/shaders/line.vert.qsb b/examples/quick/scenegraph/graph/shaders/line.vert.qsb Binary files differnew file mode 100644 index 0000000000..c17b16960f --- /dev/null +++ b/examples/quick/scenegraph/graph/shaders/line.vert.qsb diff --git a/examples/quick/scenegraph/graph/shaders/line.vsh b/examples/quick/scenegraph/graph/shaders/line.vsh deleted file mode 100644 index 4f00ab9e5d..0000000000 --- a/examples/quick/scenegraph/graph/shaders/line.vsh +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -attribute highp vec4 pos; -attribute highp float t; - -uniform lowp float size; -uniform highp mat4 qt_Matrix; - -varying lowp float vT; - -void main(void) -{ - vec4 adjustedPos = pos; - adjustedPos.y += (t * size); - gl_Position = qt_Matrix * adjustedPos; - - vT = t; -} diff --git a/examples/quick/scenegraph/graph/shaders/noisy.frag b/examples/quick/scenegraph/graph/shaders/noisy.frag new file mode 100644 index 0000000000..8cea9de02b --- /dev/null +++ b/examples/quick/scenegraph/graph/shaders/noisy.frag @@ -0,0 +1,24 @@ +#version 440 + +layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in vec2 vShadeCoord; + +layout(location = 0) out vec4 fragColor; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + vec4 color; + vec2 textureSize; + float qt_Opacity; +}; + +layout(binding = 1) uniform sampler2D qt_Texture; + +#define PI 3.14159265358979323846 + +void main() +{ + float shade = texture(qt_Texture, vTexCoord).r * 0.05 - length(vec2(0.5, 0.4) - vShadeCoord) * 0.3; + vec4 c = vec4(color.xyz + shade, color.w); + fragColor = c * qt_Opacity; +} diff --git a/examples/quick/scenegraph/graph/shaders/noisy.frag.qsb b/examples/quick/scenegraph/graph/shaders/noisy.frag.qsb Binary files differnew file mode 100644 index 0000000000..77f29bd253 --- /dev/null +++ b/examples/quick/scenegraph/graph/shaders/noisy.frag.qsb diff --git a/examples/quick/scenegraph/graph/shaders/noisy.fsh b/examples/quick/scenegraph/graph/shaders/noisy.fsh deleted file mode 100644 index 14ea675360..0000000000 --- a/examples/quick/scenegraph/graph/shaders/noisy.fsh +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -uniform sampler2D texture; -uniform lowp float qt_Opacity; -uniform lowp vec4 color; - -varying highp vec2 vTexCoord; -varying lowp vec2 vShadeCoord; - -#define PI 3.14159265358979323846 - -void main() -{ - lowp float shade = texture2D(texture, vTexCoord).r * 0.05 - length(vec2(0.5, 0.4) - vShadeCoord) * 0.3; - lowp vec4 c = vec4(color.xyz + shade, color.w); - gl_FragColor = c * qt_Opacity; -} diff --git a/examples/quick/scenegraph/graph/shaders/noisy.vert b/examples/quick/scenegraph/graph/shaders/noisy.vert new file mode 100644 index 0000000000..5728f2a02f --- /dev/null +++ b/examples/quick/scenegraph/graph/shaders/noisy.vert @@ -0,0 +1,22 @@ +#version 440 + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec2 aTexCoord; + +layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out vec2 vShadeCoord; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + vec4 color; + vec2 textureSize; + float qt_Opacity; +}; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() { + gl_Position = qt_Matrix * aVertex; + vTexCoord = aVertex.xy * textureSize; + vShadeCoord = aTexCoord; +} diff --git a/examples/quick/scenegraph/graph/shaders/noisy.vert.qsb b/examples/quick/scenegraph/graph/shaders/noisy.vert.qsb Binary files differnew file mode 100644 index 0000000000..d405024983 --- /dev/null +++ b/examples/quick/scenegraph/graph/shaders/noisy.vert.qsb diff --git a/examples/quick/scenegraph/graph/shaders/noisy.vsh b/examples/quick/scenegraph/graph/shaders/noisy.vsh deleted file mode 100644 index 1f89dbcc29..0000000000 --- a/examples/quick/scenegraph/graph/shaders/noisy.vsh +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -attribute highp vec4 aVertex; -attribute highp vec2 aTexCoord; - -uniform highp mat4 qt_Matrix; -uniform highp vec2 textureSize; - -varying highp vec2 vTexCoord; -varying lowp vec2 vShadeCoord; - -void main() { - gl_Position = qt_Matrix * aVertex; - vTexCoord = aVertex.xy * textureSize; - vShadeCoord = aTexCoord; -} diff --git a/examples/quick/scenegraph/metaltextureimport/CMakeLists.txt b/examples/quick/scenegraph/metaltextureimport/CMakeLists.txt new file mode 100644 index 0000000000..ee2c068cf7 --- /dev/null +++ b/examples/quick/scenegraph/metaltextureimport/CMakeLists.txt @@ -0,0 +1,64 @@ +# Generated from metaltextureimport.pro. + +cmake_minimum_required(VERSION 3.14) +project(metaltextureimport LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/scenegraph/metaltextureimport") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(metaltextureimport + main.cpp + metaltextureimport.h metaltextureimport.mm +) +target_link_libraries(metaltextureimport PUBLIC + "-framework Metal" + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(metaltextureimport_resource_files + "main.qml" + "squircle.frag" + "squircle.vert" +) + +qt6_add_resources(metaltextureimport "metaltextureimport" + PREFIX + "/scenegraph/metaltextureimport" + FILES + ${metaltextureimport_resource_files} +) + +if(MACOS) + target_link_libraries(metaltextureimport PUBLIC + "-framework AppKit" + ) +endif() + +install(TARGETS metaltextureimport + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(metaltextureimport PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI MetalTextureImport +) + +qt6_qml_type_registration(metaltextureimport) diff --git a/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm b/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm index 66a39083f7..5a86cacbfe 100644 --- a/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm +++ b/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm @@ -53,6 +53,7 @@ #include <QtQuick/QQuickWindow> #include <QtQuick/QSGTextureProvider> #include <QtQuick/QSGSimpleTextureNode> +#include <QtCore/QFile> #include <Metal/Metal.h> diff --git a/examples/quick/scenegraph/metalunderqml/CMakeLists.txt b/examples/quick/scenegraph/metalunderqml/CMakeLists.txt new file mode 100644 index 0000000000..fa778e270e --- /dev/null +++ b/examples/quick/scenegraph/metalunderqml/CMakeLists.txt @@ -0,0 +1,64 @@ +# Generated from metalunderqml.pro. + +cmake_minimum_required(VERSION 3.14) +project(metalunderqml LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/scenegraph/metalunderqml") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(metalunderqml + main.cpp + metalsquircle.h metalsquircle.mm +) +target_link_libraries(metalunderqml PUBLIC + "-framework Metal" + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(metalunderqml_resource_files + "main.qml" + "squircle.frag" + "squircle.vert" +) + +qt6_add_resources(metalunderqml "metalunderqml" + PREFIX + "/scenegraph/metalunderqml" + FILES + ${metalunderqml_resource_files} +) + +if(MACOS) + target_link_libraries(metalunderqml PUBLIC + "-framework AppKit" + ) +endif() + +install(TARGETS metalunderqml + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(metalunderqml PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI MetalUnderQML +) + +qt6_qml_type_registration(metalunderqml) diff --git a/examples/quick/scenegraph/metalunderqml/metalsquircle.mm b/examples/quick/scenegraph/metalunderqml/metalsquircle.mm index 4844df0c70..4acedcab02 100644 --- a/examples/quick/scenegraph/metalunderqml/metalsquircle.mm +++ b/examples/quick/scenegraph/metalunderqml/metalsquircle.mm @@ -51,6 +51,7 @@ #include "metalsquircle.h" #include <QtCore/QRunnable> #include <QtQuick/QQuickWindow> +#include <QtCore/QFile> #include <Metal/Metal.h> diff --git a/examples/quick/scenegraph/openglunderqml/CMakeLists.txt b/examples/quick/scenegraph/openglunderqml/CMakeLists.txt new file mode 100644 index 0000000000..6f45e28a4a --- /dev/null +++ b/examples/quick/scenegraph/openglunderqml/CMakeLists.txt @@ -0,0 +1,55 @@ +# Generated from openglunderqml.pro. + +cmake_minimum_required(VERSION 3.14) +project(openglunderqml LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/scenegraph/openglunderqml") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(openglunderqml + main.cpp + squircle.cpp squircle.h +) +target_link_libraries(openglunderqml PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(openglunderqml_resource_files + "main.qml" +) + +qt6_add_resources(openglunderqml "openglunderqml" + PREFIX + "/scenegraph/openglunderqml" + FILES + ${openglunderqml_resource_files} +) + +install(TARGETS openglunderqml + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(openglunderqml PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI OpenGLUnderQML +) + +qt6_qml_type_registration(openglunderqml) diff --git a/examples/quick/scenegraph/openglunderqml/squircle.cpp b/examples/quick/scenegraph/openglunderqml/squircle.cpp index 828857fe24..1c4563baa5 100644 --- a/examples/quick/scenegraph/openglunderqml/squircle.cpp +++ b/examples/quick/scenegraph/openglunderqml/squircle.cpp @@ -51,8 +51,8 @@ #include "squircle.h" #include <QtQuick/qquickwindow.h> -#include <QtGui/QOpenGLShaderProgram> -#include <QtGui/QOpenGLContext> +#include <QOpenGLShaderProgram> +#include <QOpenGLContext> #include <QtCore/QRunnable> //! [7] diff --git a/examples/quick/scenegraph/openglunderqml/squircle.h b/examples/quick/scenegraph/openglunderqml/squircle.h index c24fdd50c2..ecd92161fc 100644 --- a/examples/quick/scenegraph/openglunderqml/squircle.h +++ b/examples/quick/scenegraph/openglunderqml/squircle.h @@ -52,8 +52,8 @@ #define SQUIRCLE_H #include <QtQuick/QQuickItem> -#include <QtGui/QOpenGLShaderProgram> -#include <QtGui/QOpenGLFunctions> +#include <QOpenGLShaderProgram> +#include <QOpenGLFunctions> diff --git a/examples/quick/scenegraph/rendernode/CMakeLists.txt b/examples/quick/scenegraph/rendernode/CMakeLists.txt new file mode 100644 index 0000000000..c2de412b64 --- /dev/null +++ b/examples/quick/scenegraph/rendernode/CMakeLists.txt @@ -0,0 +1,70 @@ +# Generated from rendernode.pro. + +cmake_minimum_required(VERSION 3.14) +project(rendernode LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/scenegraph/rendernode") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(rendernode + customrenderitem.cpp customrenderitem.h + main.cpp + openglrenderer.cpp openglrenderer.h + softwarerenderer.cpp softwarerenderer.h +) +target_link_libraries(rendernode PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(rendernode_resource_files + "main.qml" + "metalshader.frag" + "metalshader.vert" +) + +qt6_add_resources(rendernode "rendernode" + PREFIX + "/scenegraph/rendernode" + FILES + ${rendernode_resource_files} +) + +if(MACOS) + target_sources(rendernode PUBLIC + metalrenderer.h metalrenderer.mm + ) + + target_link_libraries(rendernode PUBLIC + "-framework AppKit" + "-framework Metal" + ) +endif() + +install(TARGETS rendernode + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(rendernode PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 2.0 + QT_QML_MODULE_URI SceneGraphRendering +) + +qt6_qml_type_registration(rendernode) diff --git a/examples/quick/scenegraph/rendernode/customrenderitem.cpp b/examples/quick/scenegraph/rendernode/customrenderitem.cpp index 5f51522c47..aae91120a7 100644 --- a/examples/quick/scenegraph/rendernode/customrenderitem.cpp +++ b/examples/quick/scenegraph/rendernode/customrenderitem.cpp @@ -56,9 +56,6 @@ #ifdef Q_OS_MACOS #include "metalrenderer.h" #endif -#if QT_CONFIG(d3d12) -#include "d3d12renderer.h" -#endif #include "softwarerenderer.h" //! [1] @@ -105,14 +102,6 @@ QSGNode *CustomRenderItem::updatePaintNode(QSGNode *node, UpdatePaintNodeData *) #endif break; - case QSGRendererInterface::Direct3D12: // ### Qt 6: remove -#if QT_CONFIG(d3d12) - if (!n) - n = new D3D12RenderNode; - static_cast<D3D12RenderNode *>(n)->sync(this); -#endif - break; - case QSGRendererInterface::Software: if (!n) n = new SoftwareRenderNode; diff --git a/examples/quick/scenegraph/rendernode/d3d12renderer.cpp b/examples/quick/scenegraph/rendernode/d3d12renderer.cpp deleted file mode 100644 index e85811c089..0000000000 --- a/examples/quick/scenegraph/rendernode/d3d12renderer.cpp +++ /dev/null @@ -1,309 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "d3d12renderer.h" -#include <QQuickItem> -#include <QQuickWindow> -#include <QSGRendererInterface> -#include <QFile> - -// ### Qt 6: remove - -#if QT_CONFIG(d3d12) - -D3D12RenderNode::~D3D12RenderNode() -{ - releaseResources(); -} - -void D3D12RenderNode::releaseResources() -{ - if (vbPtr) { - vertexBuffer->Unmap(0, nullptr); - vbPtr = nullptr; - } - if (cbPtr) { - constantBuffer->Unmap(0, nullptr); - cbPtr = nullptr; - } - constantBuffer = nullptr; - vertexBuffer = nullptr; - rootSignature = nullptr; - pipelineState = nullptr; - m_device = nullptr; -} - -void D3D12RenderNode::init() -{ - QSGRendererInterface *rif = m_window->rendererInterface(); - m_device = static_cast<ID3D12Device *>(rif->getResource(m_window, QSGRendererInterface::DeviceResource)); - Q_ASSERT(m_device); - - D3D12_ROOT_PARAMETER rootParameter; - rootParameter.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; - rootParameter.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; - rootParameter.Descriptor.ShaderRegister = 0; // b0 - rootParameter.Descriptor.RegisterSpace = 0; - - D3D12_ROOT_SIGNATURE_DESC desc; - desc.NumParameters = 1; - desc.pParameters = &rootParameter; - desc.NumStaticSamplers = 0; - desc.pStaticSamplers = nullptr; - desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT; - - ComPtr<ID3DBlob> signature; - ComPtr<ID3DBlob> error; - if (FAILED(D3D12SerializeRootSignature(&desc, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error))) { - qWarning("Failed to serialize root signature"); - return; - } - if (FAILED(m_device->CreateRootSignature(0, signature->GetBufferPointer(), signature->GetBufferSize(), - IID_PPV_ARGS(&rootSignature)))) { - qWarning("Failed to create root signature"); - return; - } - - D3D12_INPUT_ELEMENT_DESC inputElementDescs[] = { - { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, - { "COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 8, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 } - }; - - QFile f(QStringLiteral(":/scenegraph/rendernode/shader_vert.cso")); - if (!f.open(QIODevice::ReadOnly)) { - qWarning("Failed to open file with vertex shader bytecode"); - return; - } - QByteArray vshader_cso = f.readAll(); - f.close(); - f.setFileName(QStringLiteral(":/scenegraph/rendernode/shader_frag.cso")); - if (!f.open(QIODevice::ReadOnly)) { - qWarning("Failed to open file with fragment shader bytecode"); - return; - } - QByteArray fshader_cso = f.readAll(); - D3D12_SHADER_BYTECODE vshader; - vshader.pShaderBytecode = vshader_cso.constData(); - vshader.BytecodeLength = vshader_cso.size(); - D3D12_SHADER_BYTECODE pshader; - pshader.pShaderBytecode = fshader_cso.constData(); - pshader.BytecodeLength = fshader_cso.size(); - - D3D12_RASTERIZER_DESC rastDesc = {}; - rastDesc.FillMode = D3D12_FILL_MODE_SOLID; - rastDesc.CullMode = D3D12_CULL_MODE_BACK; - rastDesc.FrontCounterClockwise = TRUE; // Vertices are given CCW - - // Enable color write and blending (premultiplied alpha). The latter is - // needed because the example changes the item's opacity and we pass - // inheritedOpacity() into the pixel shader. If that wasn't the case, - // blending could have stayed disabled. - const D3D12_RENDER_TARGET_BLEND_DESC premulBlendDesc = { - TRUE, FALSE, - D3D12_BLEND_ONE, D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_OP_ADD, - D3D12_BLEND_ONE, D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_OP_ADD, - D3D12_LOGIC_OP_NOOP, - D3D12_COLOR_WRITE_ENABLE_ALL - }; - D3D12_BLEND_DESC blendDesc = {}; - blendDesc.RenderTarget[0] = premulBlendDesc; - - D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {}; - psoDesc.InputLayout = { inputElementDescs, _countof(inputElementDescs) }; - psoDesc.pRootSignature = rootSignature.Get(); - psoDesc.VS = vshader; - psoDesc.PS = pshader; - psoDesc.RasterizerState = rastDesc; - psoDesc.BlendState = blendDesc; - // No depth. The correct stacking of the item is ensured by the projection matrix. - // Note that this does not support clipping. - // If clipping is desired, render() needs to set a different PSO - // with stencil enabled whenever the RenderState indicates so. - psoDesc.SampleMask = UINT_MAX; - psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; - psoDesc.NumRenderTargets = 1; - psoDesc.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM; - psoDesc.DSVFormat = DXGI_FORMAT_D24_UNORM_S8_UINT; // not in use due to !DepthEnable, but this would be the correct format otherwise - // We are rendering on the default render target so if the QuickWindow/View - // has requested samples > 0 then we have to follow suit. - const uint samples = qMax(1, m_window->format().samples()); - psoDesc.SampleDesc.Count = samples; - if (samples > 1) { - D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS msaaInfo = {}; - msaaInfo.Format = psoDesc.RTVFormats[0]; - msaaInfo.SampleCount = samples; - if (SUCCEEDED(m_device->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &msaaInfo, sizeof(msaaInfo)))) { - if (msaaInfo.NumQualityLevels > 0) - psoDesc.SampleDesc.Quality = msaaInfo.NumQualityLevels - 1; - } - } - - if (FAILED(m_device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&pipelineState)))) { - qWarning("Failed to create graphics pipeline state"); - return; - } - - const UINT vertexBufferSize = (2 + 3) * 3 * sizeof(float); - - D3D12_HEAP_PROPERTIES heapProp = {}; - heapProp.Type = D3D12_HEAP_TYPE_UPLOAD; - - D3D12_RESOURCE_DESC bufDesc; - bufDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; - bufDesc.Alignment = 0; - bufDesc.Width = vertexBufferSize; - bufDesc.Height = 1; - bufDesc.DepthOrArraySize = 1; - bufDesc.MipLevels = 1; - bufDesc.Format = DXGI_FORMAT_UNKNOWN; - bufDesc.SampleDesc.Count = 1; - bufDesc.SampleDesc.Quality = 0; - bufDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; - bufDesc.Flags = D3D12_RESOURCE_FLAG_NONE; - - if (FAILED(m_device->CreateCommittedResource(&heapProp, D3D12_HEAP_FLAG_NONE, &bufDesc, - D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, - IID_PPV_ARGS(&vertexBuffer)))) { - qWarning("Failed to create committed resource (vertex buffer)"); - return; - } - - vertexBufferView.BufferLocation = vertexBuffer->GetGPUVirtualAddress(); - vertexBufferView.StrideInBytes = vertexBufferSize / 3; - vertexBufferView.SizeInBytes = vertexBufferSize; - - bufDesc.Width = 256; - if (FAILED(m_device->CreateCommittedResource(&heapProp, D3D12_HEAP_FLAG_NONE, &bufDesc, - D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, - IID_PPV_ARGS(&constantBuffer)))) { - qWarning("Failed to create committed resource (constant buffer)"); - return; - } - - const D3D12_RANGE readRange = { 0, 0 }; - if (FAILED(vertexBuffer->Map(0, &readRange, reinterpret_cast<void **>(&vbPtr)))) { - qWarning("Map failed"); - return; - } - - if (FAILED(constantBuffer->Map(0, &readRange, reinterpret_cast<void **>(&cbPtr)))) { - qWarning("Map failed (constant buffer)"); - return; - } - - float *vp = reinterpret_cast<float *>(vbPtr); - vp += 2; - *vp++ = 1.0f; *vp++ = 0.0f; *vp++ = 0.0f; - vp += 2; - *vp++ = 0.0f; *vp++ = 1.0f; *vp++ = 0.0f; - vp += 2; - *vp++ = 0.0f; *vp++ = 0.0f; *vp++ = 1.0f; -} - -void D3D12RenderNode::render(const RenderState *state) -{ - if (!m_device) - init(); - - QSGRendererInterface *rif = m_window->rendererInterface(); - ID3D12GraphicsCommandList *commandList = static_cast<ID3D12GraphicsCommandList *>( - rif->getResource(m_window, QSGRendererInterface::CommandListResource)); - Q_ASSERT(commandList); - - const int msize = 16 * sizeof(float); - memcpy(cbPtr, matrix()->constData(), msize); - memcpy(cbPtr + msize, state->projectionMatrix()->constData(), msize); - const float opacity = inheritedOpacity(); - memcpy(cbPtr + 2 * msize, &opacity, sizeof(float)); - - const QPointF p0(m_width - 1, m_height - 1); - const QPointF p1(0, 0); - const QPointF p2(0, m_height - 1); - - float *vp = reinterpret_cast<float *>(vbPtr); - *vp++ = p0.x(); - *vp++ = p0.y(); - vp += 3; - *vp++ = p1.x(); - *vp++ = p1.y(); - vp += 3; - *vp++ = p2.x(); - *vp++ = p2.y(); - - commandList->SetPipelineState(pipelineState.Get()); - commandList->SetGraphicsRootSignature(rootSignature.Get()); - commandList->SetGraphicsRootConstantBufferView(0, constantBuffer->GetGPUVirtualAddress()); - commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); - commandList->IASetVertexBuffers(0, 1, &vertexBufferView); - - commandList->DrawInstanced(3, 1, 0, 0); -} - -// No need to reimplement changedStates() because no relevant commands are -// added to the command list in render(). - -QSGRenderNode::RenderingFlags D3D12RenderNode::flags() const -{ - return BoundedRectRendering | DepthAwareRendering; -} - -QRectF D3D12RenderNode::rect() const -{ - return QRect(0, 0, m_width, m_height); -} - -void D3D12RenderNode::sync(QQuickItem *item) -{ - m_window = item->window(); - m_width = item->width(); - m_height = item->height(); -} - -#endif // d3d12 diff --git a/examples/quick/scenegraph/rendernode/d3d12renderer.h b/examples/quick/scenegraph/rendernode/d3d12renderer.h deleted file mode 100644 index 7186b72c04..0000000000 --- a/examples/quick/scenegraph/rendernode/d3d12renderer.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef D3D12RENDERER_H -#define D3D12RENDERER_H - -#include <qsgrendernode.h> -#include <QQuickItem> - -#if QT_CONFIG(d3d12) - -#include <d3d12.h> -#include <wrl/client.h> - -using namespace Microsoft::WRL; - -class D3D12RenderNode : public QSGRenderNode -{ -public: - ~D3D12RenderNode(); - - void render(const RenderState *state) override; - void releaseResources() override; - RenderingFlags flags() const override; - QRectF rect() const override; - - void sync(QQuickItem *item); - -private: - void init(); - - QQuickWindow *m_window = nullptr; - int m_width = 0; - int m_height = 0; - - ID3D12Device *m_device = nullptr; - ComPtr<ID3D12PipelineState> pipelineState; - ComPtr<ID3D12RootSignature> rootSignature; - ComPtr<ID3D12Resource> vertexBuffer; - ComPtr<ID3D12Resource> constantBuffer; - D3D12_VERTEX_BUFFER_VIEW vertexBufferView; - quint8 *vbPtr = nullptr; - quint8 *cbPtr = nullptr; -}; - -#endif // d3d12 - -#endif diff --git a/examples/quick/scenegraph/rendernode/main.qml b/examples/quick/scenegraph/rendernode/main.qml index 5631df317c..a02fa128d5 100644 --- a/examples/quick/scenegraph/rendernode/main.qml +++ b/examples/quick/scenegraph/rendernode/main.qml @@ -143,7 +143,6 @@ Item { var apiStr; switch (api) { case GraphicsInfo.OpenGL: apiStr = "OpenGL (direct)"; break; - case GraphicsInfo.Direct3D12: apiStr = "Direct3D 12 (direct)"; break; case GraphicsInfo.Software: apiStr = "Software (QPainter)"; break; case GraphicsInfo.OpenGLRhi: apiStr = "OpenGL (RHI)"; break; case GraphicsInfo.MetalRhi: apiStr = "Metal (RHI)"; break; diff --git a/examples/quick/scenegraph/rendernode/metalrenderer.mm b/examples/quick/scenegraph/rendernode/metalrenderer.mm index b83dc62c48..d78a54b88a 100644 --- a/examples/quick/scenegraph/rendernode/metalrenderer.mm +++ b/examples/quick/scenegraph/rendernode/metalrenderer.mm @@ -51,6 +51,7 @@ #include "metalrenderer.h" #include <QQuickItem> #include <QQuickWindow> +#include <QFile> #include <Metal/Metal.h> diff --git a/examples/quick/scenegraph/rendernode/rendernode.pro b/examples/quick/scenegraph/rendernode/rendernode.pro index cfec905764..4ae46de2a4 100644 --- a/examples/quick/scenegraph/rendernode/rendernode.pro +++ b/examples/quick/scenegraph/rendernode/rendernode.pro @@ -21,12 +21,6 @@ INSTALLS += target OTHER_FILES += \ main.qml -qtConfig(d3d12) { - HEADERS += d3d12renderer.h - SOURCES += d3d12renderer.cpp - LIBS += -ld3d12 -} - macos { HEADERS += metalrenderer.h SOURCES += metalrenderer.mm diff --git a/examples/quick/scenegraph/rendernode/rendernode.qrc b/examples/quick/scenegraph/rendernode/rendernode.qrc index 5907eab62c..a93fd0270f 100644 --- a/examples/quick/scenegraph/rendernode/rendernode.qrc +++ b/examples/quick/scenegraph/rendernode/rendernode.qrc @@ -1,8 +1,6 @@ <RCC> <qresource prefix="/scenegraph/rendernode"> <file>main.qml</file> - <file>shader_vert.cso</file> - <file>shader_frag.cso</file> <file>metalshader.vert</file> <file>metalshader.frag</file> </qresource> diff --git a/examples/quick/scenegraph/rendernode/shader_frag.cso b/examples/quick/scenegraph/rendernode/shader_frag.cso Binary files differdeleted file mode 100644 index 686c6af3fc..0000000000 --- a/examples/quick/scenegraph/rendernode/shader_frag.cso +++ /dev/null diff --git a/examples/quick/scenegraph/rendernode/shader_vert.cso b/examples/quick/scenegraph/rendernode/shader_vert.cso Binary files differdeleted file mode 100644 index fa13be5160..0000000000 --- a/examples/quick/scenegraph/rendernode/shader_vert.cso +++ /dev/null diff --git a/examples/quick/scenegraph/scenegraph.pro b/examples/quick/scenegraph/scenegraph.pro index 08ca18fa0c..b9ce61e21d 100644 --- a/examples/quick/scenegraph/scenegraph.pro +++ b/examples/quick/scenegraph/scenegraph.pro @@ -3,8 +3,6 @@ TEMPLATE = subdirs qtConfig(opengl(es1|es2)?) { SUBDIRS += \ graph \ - simplematerial \ - sgengine \ fboitem \ openglunderqml \ textureinthread \ diff --git a/examples/quick/scenegraph/sgengine/face-smile.png b/examples/quick/scenegraph/sgengine/face-smile.png Binary files differdeleted file mode 100644 index 3d66d72578..0000000000 --- a/examples/quick/scenegraph/sgengine/face-smile.png +++ /dev/null diff --git a/examples/quick/scenegraph/sgengine/main.cpp b/examples/quick/scenegraph/sgengine/main.cpp deleted file mode 100644 index a4dd3a6b72..0000000000 --- a/examples/quick/scenegraph/sgengine/main.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "window.h" -#include <QGuiApplication> - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - Window window; - window.show(); - - return app.exec(); -} diff --git a/examples/quick/scenegraph/sgengine/sgengine.pro b/examples/quick/scenegraph/sgengine/sgengine.pro deleted file mode 100644 index c6507a4982..0000000000 --- a/examples/quick/scenegraph/sgengine/sgengine.pro +++ /dev/null @@ -1,11 +0,0 @@ -QT += quick - -HEADERS += window.h -SOURCES += window.cpp main.cpp -RESOURCES += \ - sgengine.qrc \ - ../../shared/shared.qrc - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/sgengine -INSTALLS += target diff --git a/examples/quick/scenegraph/sgengine/sgengine.qrc b/examples/quick/scenegraph/sgengine/sgengine.qrc deleted file mode 100644 index 5d55bcfb6f..0000000000 --- a/examples/quick/scenegraph/sgengine/sgengine.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/scenegraph/sgengine"> - <file>face-smile.png</file> - </qresource> -</RCC> diff --git a/examples/quick/scenegraph/sgengine/window.cpp b/examples/quick/scenegraph/sgengine/window.cpp deleted file mode 100644 index 6f22510a81..0000000000 --- a/examples/quick/scenegraph/sgengine/window.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "window.h" - -#include <QOpenGLContext> -#include <QSGAbstractRenderer> -#include <QSGEngine> -#include <QSGSimpleTextureNode> -#include <QSGTransformNode> -#include <QScreen> -#include <QVariantAnimation> -#include <QOpenGLFunctions> -#include <QRandomGenerator> - -class Item { -public: - Item(QSGNode *parentNode, QSGTexture *texture, const QPointF &fromPos, const QPointF &toPos) { - textureNode = new QSGSimpleTextureNode; - textureNode->setRect(QRect(QPoint(), texture->textureSize())); - textureNode->setTexture(texture); - - transformNode = new QSGTransformNode; - transformNode->setFlag(QSGNode::OwnedByParent, false); - transformNode->appendChildNode(textureNode); - parentNode->appendChildNode(transformNode); - - int duration = QRandomGenerator::global()->generateDouble() * 400 + 800; - rotAnimation.setStartValue(QRandomGenerator::global()->generateDouble() * 720 - 180); - rotAnimation.setEndValue(QRandomGenerator::global()->generateDouble() * 720 - 180); - rotAnimation.setDuration(duration); - rotAnimation.start(); - - posAnimation.setStartValue(fromPos); - posAnimation.setEndValue(toPos); - posAnimation.setDuration(duration); - posAnimation.start(); - } - - ~Item() { - delete transformNode; - } - - bool isDone() const { return posAnimation.state() != QAbstractAnimation::Running; } - - void sync() { - QPointF currentPos = posAnimation.currentValue().toPointF(); - QPointF center = textureNode->rect().center(); - QMatrix4x4 m; - m.translate(currentPos.x(), currentPos.y()); - m.translate(center.x(), center.y()); - m.rotate(rotAnimation.currentValue().toFloat(), 0, 0, 1); - m.translate(-center.x(), -center.y()); - transformNode->setMatrix(m); - } - -private: - QSGTransformNode *transformNode; - QSGSimpleTextureNode *textureNode; - QVariantAnimation posAnimation; - QVariantAnimation rotAnimation; -}; - -Window::Window() - : m_initialized(false) - , m_context(new QOpenGLContext) - , m_sgEngine(new QSGEngine) - , m_sgRootNode(new QSGRootNode) -{ - setSurfaceType(QWindow::OpenGLSurface); - QRect g(0, 0, 640, 480); - g.moveCenter(screen()->geometry().center()); - setGeometry(g); - setTitle(QStringLiteral("Click me!")); - - QSurfaceFormat format; - format.setDepthBufferSize(16); - setFormat(format); - m_context->setFormat(format); - m_context->create(); - - m_animationDriver.install(); - connect(&m_animationDriver, &QAnimationDriver::started, this, &Window::update); -} - -Window::~Window() -{ -} - -void Window::timerEvent(QTimerEvent *e) -{ - if (e->timerId() == m_updateTimer.timerId()) { - m_updateTimer.stop(); - - if (!m_context->makeCurrent(this)) - return; - - if (!m_initialized) - initialize(); - - sync(); - render(); - - if (m_animationDriver.isRunning()) { - m_animationDriver.advance(); - update(); - } - } else - QWindow::timerEvent(e); -} - -void Window::exposeEvent(QExposeEvent *) -{ - if (isExposed()) - update(); - else - invalidate(); -} - -void Window::mousePressEvent(QMouseEvent *) -{ - addItems(); -} - -void Window::keyPressEvent(QKeyEvent *) -{ - addItems(); -} - -void Window::addItems() -{ - if (!m_initialized) - return; - - QSGTexture *textures[] = { m_smileTexture.data(), m_qtTexture.data() }; - for (int i = 0; i < 50; ++i) { - QSGTexture *tex = textures[i%2]; - QPointF fromPos(-tex->textureSize().width(), QRandomGenerator::global()->generateDouble() * (height() - tex->textureSize().height())); - QPointF toPos(width(), QRandomGenerator::global()->generateDouble() * height() * 1.5 - height() * 0.25); - m_items.append(QSharedPointer<Item>::create(m_sgRootNode.data(), tex, fromPos, toPos)); - } - update(); -} - -void Window::update() -{ - if (!m_updateTimer.isActive()) - m_updateTimer.start(0, this); -} - -void Window::sync() -{ - QList<QSharedPointer<Item> > validItems; - for (QSharedPointer<Item> item : qAsConst(m_items)) { - if (!item->isDone()) { - validItems.append(item); - item->sync(); - } - } - m_items.swap(validItems); -} - -void Window::render() -{ - m_sgRenderer->setDeviceRect(size()); - m_sgRenderer->setViewportRect(size()); - m_sgRenderer->setProjectionMatrixToRect(QRectF(QPointF(), size())); - m_sgRenderer->renderScene(); - - m_context->swapBuffers(this); -} - -void Window::initialize() -{ - m_sgEngine->initialize(m_context.data()); - m_sgRenderer.reset(m_sgEngine->createRenderer()); - m_sgRenderer->setRootNode(m_sgRootNode.data()); - m_sgRenderer->setClearColor(QColor(32, 32, 32)); - - // With QSGEngine::createTextureFromId - QOpenGLFunctions glFuncs(m_context.data()); - GLuint glTexture; - glFuncs.glGenTextures(1, &glTexture); - glFuncs.glBindTexture(GL_TEXTURE_2D, glTexture); - QImage smile = QImage(":/scenegraph/sgengine/face-smile.png").scaled(48, 48, Qt::KeepAspectRatio, Qt::SmoothTransformation); - smile = smile.convertToFormat(QImage::Format_RGBA8888_Premultiplied); - Q_ASSERT(!smile.isNull()); - glFuncs.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, smile.width(), smile.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, smile.constBits()); - m_smileTexture.reset(m_sgEngine->createTextureFromId(glTexture, smile.size(), QFlag(QSGEngine::TextureOwnsGLTexture | QSGEngine::TextureHasAlphaChannel))); - - // With QSGEngine::createTextureFromImage - QImage qtLogo = QImage(":/shared/images/qt-logo.png").scaled(48, 48, Qt::KeepAspectRatio, Qt::SmoothTransformation); - Q_ASSERT(!qtLogo.isNull()); - m_qtTexture.reset(m_sgEngine->createTextureFromImage(qtLogo)); - m_initialized = true; -} - -void Window::invalidate() -{ - m_updateTimer.stop(); - m_items.clear(); - m_smileTexture.reset(); - m_qtTexture.reset(); - m_sgRenderer.reset(); - m_sgEngine->invalidate(); - m_initialized = false; -} diff --git a/examples/quick/scenegraph/sgengine/window.h b/examples/quick/scenegraph/sgengine/window.h deleted file mode 100644 index 1b27467b06..0000000000 --- a/examples/quick/scenegraph/sgengine/window.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QWindow> - -#include <QAnimationDriver> -#include <QBasicTimer> -#include <QSharedPointer> - -class Item; -QT_FORWARD_DECLARE_CLASS(QSGAbstractRenderer) -QT_FORWARD_DECLARE_CLASS(QSGEngine) -QT_FORWARD_DECLARE_CLASS(QSGRootNode) -QT_FORWARD_DECLARE_CLASS(QSGTexture) - -class Window : public QWindow -{ - Q_OBJECT -public: - Window(); - ~Window(); - - void addItems(); - void update(); - -private: - void timerEvent(QTimerEvent *); - void exposeEvent(QExposeEvent *); - void mousePressEvent(QMouseEvent *); - void keyPressEvent(QKeyEvent *); - - void sync(); - void render(); - void initialize(); - void invalidate(); - - bool m_initialized; - QScopedPointer<QOpenGLContext> m_context; - QScopedPointer<QSGEngine> m_sgEngine; - QScopedPointer<QSGRootNode> m_sgRootNode; - QScopedPointer<QSGAbstractRenderer> m_sgRenderer; - QScopedPointer<QSGTexture> m_smileTexture; - QScopedPointer<QSGTexture> m_qtTexture; - QList<QSharedPointer<Item> > m_items; - - QBasicTimer m_updateTimer; - QAnimationDriver m_animationDriver; -}; diff --git a/examples/quick/scenegraph/shared/logorenderer.h b/examples/quick/scenegraph/shared/logorenderer.h index 6e7c4b897f..03821919a9 100644 --- a/examples/quick/scenegraph/shared/logorenderer.h +++ b/examples/quick/scenegraph/shared/logorenderer.h @@ -53,8 +53,8 @@ #include <QtGui/qvector3d.h> #include <QtGui/qmatrix4x4.h> -#include <QtGui/qopenglshaderprogram.h> -#include <QtGui/qopenglfunctions.h> +#include <qopenglshaderprogram.h> +#include <qopenglfunctions.h> #include <QTime> #include <QVector> diff --git a/examples/quick/scenegraph/simplematerial/doc/images/simplematerial-example.jpg b/examples/quick/scenegraph/simplematerial/doc/images/simplematerial-example.jpg Binary files differdeleted file mode 100644 index 08db8dee4e..0000000000 --- a/examples/quick/scenegraph/simplematerial/doc/images/simplematerial-example.jpg +++ /dev/null diff --git a/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc b/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc deleted file mode 100644 index d7de1613e4..0000000000 --- a/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc +++ /dev/null @@ -1,180 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \example scenegraph/simplematerial - \title Scene Graph - Simple Material - \ingroup qtquickexamples - \brief Shows how to define a scene graph material to fill a shape. - - \image simplematerial-example.jpg - - In this example, we will make use of the \l - QSGSimpleMaterialShader class to fill a shape in the scene - graph. This is a convenience class intended to avoid a lot of the - boilerplate code required when creating materials with the \l - QSGMaterial, \l QSGMaterialShader and \l QSGMaterialType classes - directly. - - A simple material consists of two parts: the material state and - the material shader. The material shader has one instance per - scene graph and contains the actual OpenGL shader program and - information about which attributes and uniforms it uses. The - material state is what we assign to each individual node; in this - case to give them different colors. - - \snippet scenegraph/simplematerial/simplematerialitem.cpp 1 - - The first thing we do when creating custom materials with the - simplified scheme is to create a state class. In this case the - state class contains only one member, a QColor. It also defines a - compare function which the scene graph can use to reorder the node - rendering. - - \snippet scenegraph/simplematerial/simplematerialitem.cpp 2 - - Next we define the material shader, by subclassing a template - instantiation of \l QSGSimpleMaterialShader with our \c State. - - Then we use the macro \l QSG_DECLARE_SIMPLE_COMPARABLE_SHADER() - which will generate some boilerplate code for us. Since our \c - State class has a compare function, we declare that the states can - be compared. It would have been possible to remove the \c - State::compare() function and instead declare the shader with \l - QSG_DECLARE_SIMPLE_SHADER(), but this could then reduce performance - in certain use cases. - - The state struct is used as a template parameter to - automatically generate a \l QSGMaterialType for us, so it is - crucial that the pair of shader and state are made up of unique - classes. Using the same \c State class in multiple shaders will - will lead to undefined behavior. - - \snippet scenegraph/simplematerial/simplematerialitem.cpp 3 - - Next comes the declaration of the shader source code, where we - define a vertex and fragment shader. The simple material assumes - the presence of \c qt_Matrix in the vertex shader and \c - qt_Opacity in the fragment shader. - - \snippet scenegraph/simplematerial/simplematerialitem.cpp 4 - - We reimplement the \c attributes function to return the name of - the \c aVertex and \c aTexCoord attributes. These attributes - will be mapped to attribute indices 0 and 1 in the node's - geometry. - - \snippet scenegraph/simplematerial/simplematerialitem.cpp 6 - - Uniforms can be accessed either by name or by index, where index - is faster than name. We reimplement the \c resolveUniforms() - function to find the index of the \c color uniform. We do not have - to worry about resolving \c qt_Opacity or \c qt_Matrix as these - are handled by the baseclass. - - \snippet scenegraph/simplematerial/simplematerialitem.cpp 5 - - The \c updateState() function is called once for every unique - state and we use it to update the shader program with the current - color. The previous state is passed in as a second parameter so - that the user can update only that which has changed. In our - use case, where all the colors are different, the updateState() - function will be called once for every node. - - \snippet scenegraph/simplematerial/simplematerialitem.cpp 7 - - The \c ColorNode class is supposed to draw something, so it needs - to be a subclass of \l QSGGeometryNode. - - Since our shader expects both a position and a texture coordinate, - we use the default attribute set \l - QSGGeometry::defaultAttributes_TexturedPoint2D() and declare that - the geometry consists of a total of four vertices. To avoid the - allocation, we make the QSGGeometry a member of the - QSGGeometryNode. - - When we used the macro \l QSG_DECLARE_SIMPLE_COMPARABLE_SHADER() above, - it defined the \c createMaterial() function which we use to - instantiate materials for our \c State struct. - - As we will be making use of opacity in our custom material, we - need to set the \l QSGMaterial::Blending flag. The scene graph may - use this flag to either disable or enable \c GL_BLEND when drawing - the node or to reorder the drawing of the node. - - Finally, we tell the node to take ownership of the material, so we - do not have to explicitly memory-manage it. - - \snippet scenegraph/simplematerial/simplematerialitem.h 8 - - Since the Item is providing its own graphics to the scene graph, - we set the flag \l QQuickItem::ItemHasContents. We also make sure - the item is exposed to QML by adding the QML_ELEMENT macro. - - \snippet scenegraph/simplematerial/simplematerialitem.cpp 9 - - Whenever the Item has changed graphically, the \l - QQuickItem::updatePaintNode() function is called. - - \note The scene graph may be rendered in a different thread than the - GUI thread and \l QQuickItem::updatePaintNode() is one of the few - places where it is safe to access properties of the QML - object. Any interaction with the scene graph from a custom \l - QQuickItem should be contained within this function. The function is - called on the rendering thread while the GUI thread is blocked. - - The first time this function is called for an \c Item instance, - the node will be 0, and so we create a new one. For every consecutive - call, the node will be what we returned previously. There are - scenarios where the scene graph will be removed and rebuilt from - scratch however, so one should always check the node and recreate - it if required. - - Once we have a \c ColorNode, we update its geometry and material - state. Finally, we notify the scene graph that the node has - undergone changes to its geometry and material. - - \snippet scenegraph/simplematerial/simplematerial.cpp 11 - - The \c main() function of the application opens up a \l QQuickView - with our QML file. - - \snippet scenegraph/simplematerial/main.qml 1 - - In the QML file, we import our custom type so we can instantiate - it. - - \snippet scenegraph/simplematerial/main.qml 2 - - Then we create a column containing three instances of our custom item, - each with a different color. - - \snippet scenegraph/simplematerial/main.qml 3 - - And finally we overlay a short descriptive text. - - */ diff --git a/examples/quick/scenegraph/simplematerial/main.qml b/examples/quick/scenegraph/simplematerial/main.qml deleted file mode 100644 index 98d0e92940..0000000000 --- a/examples/quick/scenegraph/simplematerial/main.qml +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [1] -import QtQuick 2.0 -import SimpleMaterial 1.0 - -Rectangle { - width: 320 - height: 480 - color: "black" - -//! [1] //! [2] - - Column { - anchors.fill: parent - - SimpleMaterialItem { - width: parent.width; - height: parent.height / 3; - color: "steelblue" - } - - SimpleMaterialItem { - width: parent.width; - height: parent.height / 3; - color: "darkorchid" - } - - SimpleMaterialItem { - width: parent.width; - height: parent.height / 3; - color: "springgreen" - } - } - - -//! [2] //! [3] - Rectangle { - color: Qt.rgba(0, 0, 0, 0.8) - radius: 10 - antialiasing: true - border.width: 1 - border.color: "black" - anchors.fill: label - anchors.margins: -10 - } - - Text { - id: label - color: "white" - wrapMode: Text.WordWrap - text: "These three gradient boxes are colorized using a custom material." - anchors.right: parent.right - anchors.left: parent.left - anchors.bottom: parent.bottom - anchors.margins: 20 - } -} -//! [3] diff --git a/examples/quick/scenegraph/simplematerial/simplematerial.cpp b/examples/quick/scenegraph/simplematerial/simplematerial.cpp deleted file mode 100644 index 35866bd6d0..0000000000 --- a/examples/quick/scenegraph/simplematerial/simplematerial.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qguiapplication.h> -#include <qquickview.h> - -//! [11] -int main(int argc, char **argv) -{ - QGuiApplication app(argc, argv); - - QQuickView view; - view.setResizeMode(QQuickView::SizeRootObjectToView); - view.setSource(QUrl("qrc:///scenegraph/simplematerial/main.qml")); - view.show(); - - return app.exec(); -} -//! [11] diff --git a/examples/quick/scenegraph/simplematerial/simplematerial.pro b/examples/quick/scenegraph/simplematerial/simplematerial.pro deleted file mode 100644 index 131af45974..0000000000 --- a/examples/quick/scenegraph/simplematerial/simplematerial.pro +++ /dev/null @@ -1,20 +0,0 @@ - -QT += quick - -CONFIG += qmltypes -QML_IMPORT_NAME = SimpleMaterial -QML_IMPORT_MAJOR_VERSION = 1 - -SOURCES += \ - simplematerial.cpp \ - simplematerialitem.cpp -RESOURCES += simplematerial.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/simplematerial -qml.files = main.qml -qml.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/simplematerial - -INSTALLS += target qml - -HEADERS += \ - simplematerialitem.h diff --git a/examples/quick/scenegraph/simplematerial/simplematerial.qrc b/examples/quick/scenegraph/simplematerial/simplematerial.qrc deleted file mode 100644 index 4cc1eaafe4..0000000000 --- a/examples/quick/scenegraph/simplematerial/simplematerial.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/scenegraph/simplematerial"> - <file>main.qml</file> - </qresource> -</RCC> diff --git a/examples/quick/scenegraph/simplematerial/simplematerialitem.cpp b/examples/quick/scenegraph/simplematerial/simplematerialitem.cpp deleted file mode 100644 index c4c7b2e07e..0000000000 --- a/examples/quick/scenegraph/simplematerial/simplematerialitem.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simplematerialitem.h" - -#include <QtQuick/qsgsimplematerial.h> -#include <QtQuick/qsggeometry.h> -#include <QtQuick/qsgnode.h> - -//! [1] -struct State -{ - QColor color; - - int compare(const State *other) const { - uint rgb = color.rgba(); - uint otherRgb = other->color.rgba(); - - if (rgb == otherRgb) { - return 0; - } else if (rgb < otherRgb) { - return -1; - } else { - return 1; - } - } -}; -//! [1] - -//! [2] -class Shader : public QSGSimpleMaterialShader<State> -{ - QSG_DECLARE_SIMPLE_COMPARABLE_SHADER(Shader, State); -//! [2] //! [3] -public: - - const char *vertexShader() const override { - return - "attribute highp vec4 aVertex; \n" - "attribute highp vec2 aTexCoord; \n" - "uniform highp mat4 qt_Matrix; \n" - "varying highp vec2 texCoord; \n" - "void main() { \n" - " gl_Position = qt_Matrix * aVertex; \n" - " texCoord = aTexCoord; \n" - "}"; - } - - const char *fragmentShader() const override { - return - "uniform lowp float qt_Opacity; \n" - "uniform lowp vec4 color; \n" - "varying highp vec2 texCoord; \n" - "void main () \n" - "{ \n" - " gl_FragColor = texCoord.y * texCoord.x * color * qt_Opacity; \n" - "}"; - } -//! [3] //! [4] - QList<QByteArray> attributes() const override - { - return QList<QByteArray>() << "aVertex" << "aTexCoord"; - } -//! [4] //! [5] - void updateState(const State *state, const State *) override - { - program()->setUniformValue(id_color, state->color); - } -//! [5] //! [6] - void resolveUniforms() override - { - id_color = program()->uniformLocation("color"); - } - -private: - int id_color; -//! [6] -}; - - -//! [7] -class ColorNode : public QSGGeometryNode -{ -public: - ColorNode() - : m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4) - { - setGeometry(&m_geometry); - - QSGSimpleMaterial<State> *material = Shader::createMaterial(); - material->setFlag(QSGMaterial::Blending); - setMaterial(material); - setFlag(OwnsMaterial); - } - - QSGGeometry m_geometry; -}; -//! [7] - -void SimpleMaterialItem::setColor(const QColor &color) { - if (m_color != color) { - m_color = color; - emit colorChanged(); - update(); - } -} - -//! [9] -QSGNode *SimpleMaterialItem::updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNodeData *) -{ - ColorNode *n = static_cast<ColorNode *>(node); - if (!node) - n = new ColorNode(); - - QSGGeometry::updateTexturedRectGeometry(n->geometry(), boundingRect(), QRectF(0, 0, 1, 1)); - static_cast<QSGSimpleMaterial<State>*>(n->material())->state()->color = m_color; - - n->markDirty(QSGNode::DirtyGeometry | QSGNode::DirtyMaterial); - - return n; -} -//! [9] diff --git a/examples/quick/scenegraph/simplematerial/simplematerialitem.h b/examples/quick/scenegraph/simplematerial/simplematerialitem.h deleted file mode 100644 index 5775ad097b..0000000000 --- a/examples/quick/scenegraph/simplematerial/simplematerialitem.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMPLEMATERIALITEM_H -#define SIMPLEMATERIALITEM_H - -#include <QtQuick/qquickitem.h> - -//! [8] -class SimpleMaterialItem : public QQuickItem -{ - Q_OBJECT - - Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) - QML_ELEMENT - -public: - - SimpleMaterialItem() { setFlag(ItemHasContents, true); } - - void setColor(const QColor &color); - QColor color() const { return m_color; } - -signals: - void colorChanged(); - -private: - QColor m_color; - -public: - QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *) override; -}; -//! [8] - -#endif // SIMPLEMATERIALITEM_H diff --git a/examples/quick/scenegraph/textureinthread/CMakeLists.txt b/examples/quick/scenegraph/textureinthread/CMakeLists.txt new file mode 100644 index 0000000000..d29a5c63f3 --- /dev/null +++ b/examples/quick/scenegraph/textureinthread/CMakeLists.txt @@ -0,0 +1,61 @@ +# Generated from textureinthread.pro. + +cmake_minimum_required(VERSION 3.14) +project(textureinthread LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/scenegraph/textureinthread") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(textureinthread + ../shared/logorenderer.cpp ../shared/logorenderer.h + main.cpp + threadrenderer.cpp threadrenderer.h +) +target_include_directories(textureinthread PUBLIC + ../shared +) + +target_link_libraries(textureinthread PUBLIC + Qt::Core + Qt::CorePrivate + Qt::Gui + Qt::GuiPrivate + Qt::Quick +) + + +# Resources: +set(textureinthread_resource_files + "error.qml" + "main.qml" +) + +qt6_add_resources(textureinthread "textureinthread" + PREFIX + "/scenegraph/textureinthread" + FILES + ${textureinthread_resource_files} +) + +install(TARGETS textureinthread + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(textureinthread PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI SceneGraphRendering +) + +qt6_qml_type_registration(textureinthread) diff --git a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp index c364d0b7dd..5fd8037193 100644 --- a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp +++ b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp @@ -54,8 +54,8 @@ #include <QtCore/QMutex> #include <QtCore/QThread> -#include <QtGui/QOpenGLContext> -#include <QtGui/QOpenGLFramebufferObject> +#include <QOpenGLContext> +#include <QOpenGLFramebufferObject> #include <QtGui/QGuiApplication> #include <QtGui/QOffscreenSurface> diff --git a/examples/quick/scenegraph/threadedanimation/CMakeLists.txt b/examples/quick/scenegraph/threadedanimation/CMakeLists.txt new file mode 100644 index 0000000000..4ae1ae1d70 --- /dev/null +++ b/examples/quick/scenegraph/threadedanimation/CMakeLists.txt @@ -0,0 +1,56 @@ +# Generated from threadedanimation.pro. + +cmake_minimum_required(VERSION 3.14) +project(threadedanimation LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/scenegraph/threadedanimation") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(threadedanimation + main.cpp + spinner.cpp spinner.h +) +target_link_libraries(threadedanimation PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(threadedanimation_resource_files + "main.qml" + "spinner.png" +) + +qt6_add_resources(threadedanimation "threadedanimation" + PREFIX + "/scenegraph/threadedanimation" + FILES + ${threadedanimation_resource_files} +) + +install(TARGETS threadedanimation + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(threadedanimation PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI Spinner +) + +qt6_qml_type_registration(threadedanimation) diff --git a/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt b/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt new file mode 100644 index 0000000000..0f6104ae40 --- /dev/null +++ b/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt @@ -0,0 +1,61 @@ +# Generated from twotextureproviders.pro. + +cmake_minimum_required(VERSION 3.14) +project(twotextureproviders LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/scenegraph/twotextureproviders") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(twotextureproviders + main.cpp + xorblender.cpp xorblender.h +) +target_link_libraries(twotextureproviders PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(twotextureproviders_resource_files + "main.qml" + "shaders/+qsb/checker.frag" + "shaders/+qsb/xorblender.frag" + "shaders/+qsb/xorblender.vert" + "shaders/checker.frag" + "shaders/xorblender.frag" + "shaders/xorblender.vert" +) + +qt6_add_resources(twotextureproviders "twotextureproviders" + PREFIX + "/scenegraph/twotextureproviders" + FILES + ${twotextureproviders_resource_files} +) + +install(TARGETS twotextureproviders + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(twotextureproviders PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI SceneGraphRendering +) + +qt6_qml_type_registration(twotextureproviders) diff --git a/examples/quick/scenegraph/twotextureproviders/main.cpp b/examples/quick/scenegraph/twotextureproviders/main.cpp index df0454ce40..669b42cb40 100644 --- a/examples/quick/scenegraph/twotextureproviders/main.cpp +++ b/examples/quick/scenegraph/twotextureproviders/main.cpp @@ -56,6 +56,8 @@ int main(int argc, char **argv) { + qputenv("QSG_RHI", "1"); // ### Qt 6 remove, this will be the default anyway + QGuiApplication app(argc, argv); QQuickView view; diff --git a/examples/quick/scenegraph/twotextureproviders/xorblender.cpp b/examples/quick/scenegraph/twotextureproviders/xorblender.cpp index d5881b9adc..5471cf733f 100644 --- a/examples/quick/scenegraph/twotextureproviders/xorblender.cpp +++ b/examples/quick/scenegraph/twotextureproviders/xorblender.cpp @@ -52,9 +52,6 @@ #include <QtCore/QPointer> -#include <QtGui/QOpenGLContext> -#include <QtGui/QOpenGLFunctions> - #include <QtQuick/QSGMaterial> #include <QtQuick/QSGTexture> #include <QtQuick/QSGGeometryNode> @@ -81,20 +78,7 @@ public: } state; }; -class XorBlendShader : public QSGMaterialShader // for when the scenegraph is using OpenGL directly -{ -public: - XorBlendShader(); - void initialize() override; - char const *const *attributeNames() const override; - void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override; - -private: - int m_matrix_id; - int m_opacity_id; -}; - -class XorBlendRhiShader : public QSGMaterialRhiShader // for when the scenegraph is using QRhi +class XorBlendRhiShader : public QSGMaterialRhiShader { public: XorBlendRhiShader(); @@ -112,10 +96,8 @@ XorBlendMaterial::XorBlendMaterial() QSGMaterialShader *XorBlendMaterial::createShader() const { - if (flags().testFlag(RhiShaderWanted)) - return new XorBlendRhiShader; - else - return new XorBlendShader; + Q_ASSERT(flags().testFlag(RhiShaderWanted)); + return new XorBlendRhiShader; } QSGMaterialType *XorBlendMaterial::type() const @@ -144,49 +126,6 @@ int XorBlendMaterial::compare(const QSGMaterial *o) const return 0; } -XorBlendShader::XorBlendShader() -{ - setShaderSourceFile(QOpenGLShader::Vertex, QLatin1String(":/scenegraph/twotextureproviders/shaders/xorblender.vert")); - setShaderSourceFile(QOpenGLShader::Fragment, QLatin1String(":/scenegraph/twotextureproviders/shaders/xorblender.frag")); -} - -void XorBlendShader::initialize() -{ - m_matrix_id = program()->uniformLocation("qt_Matrix"); - m_opacity_id = program()->uniformLocation("qt_Opacity"); - // The texture units never change, only the textures we bind to them so - // we set these once and for all here. - program()->setUniformValue("uSource1", 0); // GL_TEXTURE0 - program()->setUniformValue("uSource2", 1); // GL_TEXTURE1 -} - -char const *const *XorBlendShader::attributeNames() const -{ - static char const *const attr[] = { "aVertex", "aTexCoord", nullptr }; - return attr; -} - -void XorBlendShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *) -{ - XorBlendMaterial *material = static_cast<XorBlendMaterial *>(newEffect); - - if (state.isMatrixDirty()) - program()->setUniformValue(m_matrix_id, state.combinedMatrix()); - - if (state.isOpacityDirty()) - program()->setUniformValue(m_opacity_id, state.opacity()); - - QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); - // We bind the textures in inverse order so that we leave the updateState - // function with GL_TEXTURE0 as the active texture unit. This is maintain - // the "contract" that updateState should not mess up the GL state beyond - // what is needed for this material. - f->glActiveTexture(GL_TEXTURE1); - material->state.texture2->bind(); - f->glActiveTexture(GL_TEXTURE0); - material->state.texture1->bind(); -} - XorBlendRhiShader::XorBlendRhiShader() { setShaderFileName(VertexStage, QLatin1String(":/scenegraph/twotextureproviders/shaders/+qsb/xorblender.vert")); diff --git a/examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp b/examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp index a4201c1dfa..a09a05e735 100644 --- a/examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp +++ b/examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp @@ -57,6 +57,7 @@ #include <QVulkanInstance> #include <QVulkanFunctions> +#include <QFile> class CustomTextureNode : public QSGTextureProvider, public QSGSimpleTextureNode { diff --git a/examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt b/examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt new file mode 100644 index 0000000000..450af3d5f3 --- /dev/null +++ b/examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt @@ -0,0 +1,57 @@ +# Generated from vulkanunderqml.pro. + +cmake_minimum_required(VERSION 3.14) +project(vulkanunderqml LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/scenegraph/vulkanunderqml") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Quick) + +add_qt_gui_executable(vulkanunderqml + main.cpp + vulkansquircle.cpp vulkansquircle.h +) +target_link_libraries(vulkanunderqml PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(vulkanunderqml_resource_files + "main.qml" + "squircle.frag.spv" + "squircle.vert.spv" +) + +qt6_add_resources(vulkanunderqml "vulkanunderqml" + PREFIX + "/scenegraph/vulkanunderqml" + FILES + ${vulkanunderqml_resource_files} +) + +install(TARGETS vulkanunderqml + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(vulkanunderqml PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI VulkanUnderQML +) + +qt6_qml_type_registration(vulkanunderqml) diff --git a/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp b/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp index 21f46a25c1..5942b49843 100644 --- a/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp +++ b/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp @@ -54,6 +54,7 @@ #include <QVulkanInstance> #include <QVulkanFunctions> +#include <QFile> class SquircleRenderer : public QObject { diff --git a/examples/quick/shadereffects/CMakeLists.txt b/examples/quick/shadereffects/CMakeLists.txt new file mode 100644 index 0000000000..039baf31b7 --- /dev/null +++ b/examples/quick/shadereffects/CMakeLists.txt @@ -0,0 +1,61 @@ +# Generated from shadereffects.pro. + +cmake_minimum_required(VERSION 3.14) +project(shadereffects LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/shadereffects") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(shadereffects + main.cpp +) +target_link_libraries(shadereffects PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(shadereffects_resource_files + "content/Slider.qml" + "content/face-smile.png" + "content/qt-logo.png" + "content/shaders/+qsb/blur.frag" + "content/shaders/+qsb/colorize.frag" + "content/shaders/+qsb/genie.vert" + "content/shaders/+qsb/outline.frag" + "content/shaders/+qsb/shadow.frag" + "content/shaders/+qsb/wobble.frag" + "content/shaders/blur.frag" + "content/shaders/colorize.frag" + "content/shaders/genie.vert" + "content/shaders/outline.frag" + "content/shaders/shadow.frag" + "content/shaders/wobble.frag" + "shadereffects.qml" +) + +qt6_add_resources(shadereffects "shadereffects" + PREFIX + "/shadereffects" + FILES + ${shadereffects_resource_files} +) + +install(TARGETS shadereffects + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/shadereffects/content/shaders/+hlsl/blur.frag b/examples/quick/shadereffects/content/shaders/+hlsl/blur.frag deleted file mode 100644 index 481a238d2a..0000000000 --- a/examples/quick/shadereffects/content/shaders/+hlsl/blur.frag +++ /dev/null @@ -1,18 +0,0 @@ -cbuffer ConstantBuffer : register(b0) -{ - float4x4 qt_Matrix; - float qt_Opacity; - float2 delta; -}; - -Texture2D source : register(t0); -SamplerState sourceSampler : register(s0); - -float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET -{ - return (0.0538 * source.Sample(sourceSampler, coord - 3.182 * delta) - + 0.3229 * source.Sample(sourceSampler, coord - 1.364 * delta) - + 0.2466 * source.Sample(sourceSampler, coord) - + 0.3229 * source.Sample(sourceSampler, coord + 1.364 * delta) - + 0.0538 * source.Sample(sourceSampler, coord + 3.182 * delta)) * qt_Opacity; -} diff --git a/examples/quick/shadereffects/content/shaders/+hlsl/colorize.frag b/examples/quick/shadereffects/content/shaders/+hlsl/colorize.frag deleted file mode 100644 index d6e65b6b10..0000000000 --- a/examples/quick/shadereffects/content/shaders/+hlsl/colorize.frag +++ /dev/null @@ -1,17 +0,0 @@ -cbuffer ConstantBuffer : register(b0) -{ - float4x4 qt_Matrix; - float qt_Opacity; - float4 tint; -}; - -Texture2D source : register(t0); -SamplerState sourceSampler : register(s0); - -float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET -{ - float4 c = source.Sample(sourceSampler, coord); - float lo = min(min(c.x, c.y), c.z); - float hi = max(max(c.x, c.y), c.z); - return float4(lerp(float3(lo, lo, lo), float3(hi, hi, hi), tint.xyz), c.w) * qt_Opacity; -} diff --git a/examples/quick/shadereffects/content/shaders/+hlsl/genie.vert b/examples/quick/shadereffects/content/shaders/+hlsl/genie.vert deleted file mode 100644 index 40876e7996..0000000000 --- a/examples/quick/shadereffects/content/shaders/+hlsl/genie.vert +++ /dev/null @@ -1,31 +0,0 @@ -cbuffer ConstantBuffer : register(b0) -{ - float4x4 qt_Matrix; - float qt_Opacity; - float bend; - float minimize; - float side; - float width; - float height; -}; - -struct PSInput -{ - float4 position : SV_POSITION; - float2 coord : TEXCOORD0; -}; - -PSInput main(float4 position : POSITION, float2 coord : TEXCOORD0) -{ - PSInput result; - result.coord = coord; - - float4 pos = position; - pos.y = lerp(position.y, height, minimize); - float t = pos.y / height; - t = (3.0 - 2.0 * t) * t * t; - pos.x = lerp(position.x, side * width, t * bend); - result.position = mul(qt_Matrix, pos); - - return result; -} diff --git a/examples/quick/shadereffects/content/shaders/+hlsl/outline.frag b/examples/quick/shadereffects/content/shaders/+hlsl/outline.frag deleted file mode 100644 index b6e7e51f35..0000000000 --- a/examples/quick/shadereffects/content/shaders/+hlsl/outline.frag +++ /dev/null @@ -1,21 +0,0 @@ -cbuffer ConstantBuffer : register(b0) -{ - float4x4 qt_Matrix; - float qt_Opacity; - float2 delta; -}; - -Texture2D source : register(t0); -SamplerState sourceSampler : register(s0); - -float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET -{ - float4 tl = source.Sample(sourceSampler, coord - delta); - float4 tr = source.Sample(sourceSampler, coord + float2(delta.x, -delta.y)); - float4 bl = source.Sample(sourceSampler, coord - float2(delta.x, -delta.y)); - float4 br = source.Sample(sourceSampler, coord + delta); - float4 gx = (tl + bl) - (tr + br); - float4 gy = (tl + tr) - (bl + br); - return float4(0.0, 0.0, 0.0, - clamp(dot(sqrt(gx * gx + gy * gy), float4(1.0, 1.0, 1.0, 1.0)), 0.0, 1.0) * qt_Opacity); -} diff --git a/examples/quick/shadereffects/content/shaders/+hlsl/shadow.frag b/examples/quick/shadereffects/content/shaders/+hlsl/shadow.frag deleted file mode 100644 index a86a25e007..0000000000 --- a/examples/quick/shadereffects/content/shaders/+hlsl/shadow.frag +++ /dev/null @@ -1,20 +0,0 @@ -cbuffer ConstantBuffer : register(b0) -{ - float4x4 qt_Matrix; - float qt_Opacity; - float2 offset; - float2 delta; - float darkness; -}; - -Texture2D source : register(t0); -SamplerState sourceSampler : register(s0); -Texture2D shadow : register(t1); -SamplerState shadowSampler : register(s1); - -float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET -{ - float4 fg = source.Sample(sourceSampler, coord); - float4 bg = shadow.Sample(shadowSampler, coord + delta); - return (fg + float4(0.0, 0.0, 0.0, darkness * bg.a) * (1.0 - fg.a)) * qt_Opacity; -} diff --git a/examples/quick/shadereffects/content/shaders/+hlsl/wobble.frag b/examples/quick/shadereffects/content/shaders/+hlsl/wobble.frag deleted file mode 100644 index c28612a2fd..0000000000 --- a/examples/quick/shadereffects/content/shaders/+hlsl/wobble.frag +++ /dev/null @@ -1,17 +0,0 @@ -cbuffer ConstantBuffer : register(b0) -{ - float4x4 qt_Matrix; - float qt_Opacity; - float amplitude; - float frequency; - float time; -}; - -Texture2D source : register(t0); -SamplerState sourceSampler : register(s0); - -float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET -{ - float2 p = sin(time + frequency * coord); - return source.Sample(sourceSampler, coord + amplitude * float2(p.y, -p.x)) * qt_Opacity; -} diff --git a/examples/quick/shadereffects/doc/src/shadereffects.qdoc b/examples/quick/shadereffects/doc/src/shadereffects.qdoc index d35989c262..d217c956ad 100644 --- a/examples/quick/shadereffects/doc/src/shadereffects.qdoc +++ b/examples/quick/shadereffects/doc/src/shadereffects.qdoc @@ -59,21 +59,6 @@ Direct 3D, or OpenGL. Qt automatically selects the file under the \c qsb selector, for example \c{shaders/+qsb/wobble.frag}, when present. - On the traditional code path, which can mean using OpenGL or Direct3D 12, - file selectors are used to select the correct variant at runtime. Based on - the Qt Quick backend in use, Qt will automatically select either - \c{shaders/wobble.frag} with the GLSL source code or - \c{shaders/+hlsl/wobble.frag} with the HLSL source code. - - \note For simplicity shader source code is used in all variants of the - files. However, with the Direct3D backend of Qt Quick pre-compiled shaders - are also supported. For example, try the following commands in the - \c{content/shaders/+hlsl} directory: \c{move wobble.frag wobble.frag.src} - followed by \c{fxc /E main /T ps_5_0 /Fo wobble.frag wobble.frag.src}. Now - \c wobble.frag contains Direct3D bytecode and that is what gets shipped - with the application instead of the shader source. Further changes are not - necessary, the application will function like before. - You can use any custom property on the ShaderEffect in your shader. This makes animated shader code very easy: \snippet shadereffects/shadereffects.qml properties diff --git a/examples/quick/shadereffects/shadereffects.qrc b/examples/quick/shadereffects/shadereffects.qrc index 762ad0d037..72ad2d9054 100644 --- a/examples/quick/shadereffects/shadereffects.qrc +++ b/examples/quick/shadereffects/shadereffects.qrc @@ -5,22 +5,16 @@ <file>content/qt-logo.png</file> <file>content/Slider.qml</file> <file>content/shaders/wobble.frag</file> - <file>content/shaders/+hlsl/wobble.frag</file> <file>content/shaders/+qsb/wobble.frag</file> <file>content/shaders/blur.frag</file> - <file>content/shaders/+hlsl/blur.frag</file> <file>content/shaders/+qsb/blur.frag</file> <file>content/shaders/shadow.frag</file> - <file>content/shaders/+hlsl/shadow.frag</file> <file>content/shaders/+qsb/shadow.frag</file> <file>content/shaders/outline.frag</file> - <file>content/shaders/+hlsl/outline.frag</file> <file>content/shaders/+qsb/outline.frag</file> <file>content/shaders/colorize.frag</file> - <file>content/shaders/+hlsl/colorize.frag</file> <file>content/shaders/+qsb/colorize.frag</file> <file>content/shaders/genie.vert</file> - <file>content/shaders/+hlsl/genie.vert</file> <file>content/shaders/+qsb/genie.vert</file> </qresource> </RCC> diff --git a/examples/quick/shapes/CMakeLists.txt b/examples/quick/shapes/CMakeLists.txt new file mode 100644 index 0000000000..5428f96710 --- /dev/null +++ b/examples/quick/shapes/CMakeLists.txt @@ -0,0 +1,161 @@ +# Generated from shapes.pro. + +cmake_minimum_required(VERSION 3.14) +project(shapes LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/shapes") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(shapes + main.cpp +) +target_link_libraries(shapes PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set_source_files_properties("../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("content/clippedtigers.qml" + PROPERTIES QT_RESOURCE_ALIAS "clippedtigers.qml" +) +set_source_files_properties("content/interactive.qml" + PROPERTIES QT_RESOURCE_ALIAS "interactive.qml" +) +set_source_files_properties("content/item10.qml" + PROPERTIES QT_RESOURCE_ALIAS "item10.qml" +) +set_source_files_properties("content/item11.qml" + PROPERTIES QT_RESOURCE_ALIAS "item11.qml" +) +set_source_files_properties("content/item12.qml" + PROPERTIES QT_RESOURCE_ALIAS "item12.qml" +) +set_source_files_properties("content/item13.qml" + PROPERTIES QT_RESOURCE_ALIAS "item13.qml" +) +set_source_files_properties("content/item14.qml" + PROPERTIES QT_RESOURCE_ALIAS "item14.qml" +) +set_source_files_properties("content/item15.qml" + PROPERTIES QT_RESOURCE_ALIAS "item15.qml" +) +set_source_files_properties("content/item17.qml" + PROPERTIES QT_RESOURCE_ALIAS "item17.qml" +) +set_source_files_properties("content/item18.qml" + PROPERTIES QT_RESOURCE_ALIAS "item18.qml" +) +set_source_files_properties("content/item2.qml" + PROPERTIES QT_RESOURCE_ALIAS "item2.qml" +) +set_source_files_properties("content/item3.qml" + PROPERTIES QT_RESOURCE_ALIAS "item3.qml" +) +set_source_files_properties("content/item4.qml" + PROPERTIES QT_RESOURCE_ALIAS "item4.qml" +) +set_source_files_properties("content/item5.qml" + PROPERTIES QT_RESOURCE_ALIAS "item5.qml" +) +set_source_files_properties("content/item6.qml" + PROPERTIES QT_RESOURCE_ALIAS "item6.qml" +) +set_source_files_properties("content/item7.qml" + PROPERTIES QT_RESOURCE_ALIAS "item7.qml" +) +set_source_files_properties("content/item8.qml" + PROPERTIES QT_RESOURCE_ALIAS "item8.qml" +) +set_source_files_properties("content/item9.qml" + PROPERTIES QT_RESOURCE_ALIAS "item9.qml" +) +set_source_files_properties("content/main.qml" + PROPERTIES QT_RESOURCE_ALIAS "main.qml" +) +set_source_files_properties("content/sampling.qml" + PROPERTIES QT_RESOURCE_ALIAS "sampling.qml" +) +set_source_files_properties("content/shapegallery.qml" + PROPERTIES QT_RESOURCE_ALIAS "shapegallery.qml" +) +set_source_files_properties("content/tapableTriangle.qml" + PROPERTIES QT_RESOURCE_ALIAS "tapableTriangle.qml" +) +set_source_files_properties("content/tiger.qml" + PROPERTIES QT_RESOURCE_ALIAS "tiger.qml" +) +set(shapes_resource_files + "../shared/LauncherList.qml" + "../shared/SimpleLauncherDelegate.qml" + "../shared/Slider.qml" + "../shared/images/back.png" + "../shared/images/next.png" + "../shared/images/slider_handle.png" + "content/clippedtigers.qml" + "content/interactive.qml" + "content/item10.qml" + "content/item11.qml" + "content/item12.qml" + "content/item13.qml" + "content/item14.qml" + "content/item15.qml" + "content/item17.qml" + "content/item18.qml" + "content/item2.qml" + "content/item3.qml" + "content/item4.qml" + "content/item5.qml" + "content/item6.qml" + "content/item7.qml" + "content/item8.qml" + "content/item9.qml" + "content/main.qml" + "content/sampling.qml" + "content/shapegallery.qml" + "content/tapableTriangle.qml" + "content/tiger.qml" +) + +qt6_add_resources(shapes "shapes" + PREFIX + "/shapes" + FILES + ${shapes_resource_files} +) + +install(TARGETS shapes + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/shared/SimpleLauncherDelegate.qml b/examples/quick/shared/SimpleLauncherDelegate.qml index dd29b8b821..097954cb89 100644 --- a/examples/quick/shared/SimpleLauncherDelegate.qml +++ b/examples/quick/shared/SimpleLauncherDelegate.qml @@ -51,13 +51,13 @@ import QtQuick 2.12 Rectangle { id: container + required property string name + required property string description + property Item exampleItem width: ListView.view.width height: button.implicitHeight + 22 - required property string name - required property string description - signal clicked() gradient: Gradient { diff --git a/examples/quick/tableview/CMakeLists.txt b/examples/quick/tableview/CMakeLists.txt new file mode 100644 index 0000000000..6875e412e9 --- /dev/null +++ b/examples/quick/tableview/CMakeLists.txt @@ -0,0 +1,4 @@ +# Generated from tableview.pro. + +add_subdirectory(gameoflife) +add_subdirectory(pixelator) diff --git a/examples/quick/tableview/gameoflife/CMakeLists.txt b/examples/quick/tableview/gameoflife/CMakeLists.txt new file mode 100644 index 0000000000..b08b057575 --- /dev/null +++ b/examples/quick/tableview/gameoflife/CMakeLists.txt @@ -0,0 +1,56 @@ +# Generated from gameoflife.pro. + +cmake_minimum_required(VERSION 3.14) +project(gameoflife LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/tableview/gameoflife") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(gameoflife + gameoflifemodel.cpp gameoflifemodel.h + main.cpp +) +target_link_libraries(gameoflife PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(qmake_immediate_resource_files + "gosperglidergun.cells" + "main.qml" +) + +qt6_add_resources(gameoflife "qmake_immediate" + PREFIX + "/" + FILES + ${qmake_immediate_resource_files} +) + +install(TARGETS gameoflife + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(gameoflife PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI GameOfLifeModel +) + +qt6_qml_type_registration(gameoflife) diff --git a/examples/quick/tableview/pixelator/CMakeLists.txt b/examples/quick/tableview/pixelator/CMakeLists.txt new file mode 100644 index 0000000000..23e730772a --- /dev/null +++ b/examples/quick/tableview/pixelator/CMakeLists.txt @@ -0,0 +1,56 @@ +# Generated from pixelator.pro. + +cmake_minimum_required(VERSION 3.14) +project(qml_pixelator LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/tableview/pixelator") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(qml_pixelator + imagemodel.cpp imagemodel.h + main.cpp +) +target_link_libraries(qml_pixelator PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(qmake_immediate_resource_files + "main.qml" + "qt.png" +) + +qt6_add_resources(qml_pixelator "qmake_immediate" + PREFIX + "/" + FILES + ${qmake_immediate_resource_files} +) + +install(TARGETS qml_pixelator + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties(qml_pixelator PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION 1.0 + QT_QML_MODULE_URI ImageModel +) + +qt6_qml_type_registration(qml_pixelator) diff --git a/examples/quick/tableview/pixelator/pixelator.pro b/examples/quick/tableview/pixelator/pixelator.pro index f27303b56b..188f55ebc3 100644 --- a/examples/quick/tableview/pixelator/pixelator.pro +++ b/examples/quick/tableview/pixelator/pixelator.pro @@ -1,5 +1,6 @@ TEMPLATE = app +TARGET = qml_pixelator QT += quick qml HEADERS += imagemodel.h SOURCES += main.cpp \ diff --git a/examples/quick/text/CMakeLists.txt b/examples/quick/text/CMakeLists.txt new file mode 100644 index 0000000000..7b6b9c2101 --- /dev/null +++ b/examples/quick/text/CMakeLists.txt @@ -0,0 +1,136 @@ +# Generated from text.pro. + +cmake_minimum_required(VERSION 3.14) +project(text LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/text") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(text + main.cpp +) +target_link_libraries(text PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(text_resource_files + "fonts/availableFonts.qml" + "fonts/banner.qml" + "fonts/content/fonts/tarzeau_ocr_a.ttf" + "fonts/fonts.qml" + "fonts/hello.qml" + "imgtag/TextWithImage.qml" + "imgtag/images/face-sad.png" + "imgtag/images/face-smile-big.png" + "imgtag/images/face-smile.png" + "imgtag/images/heart200.png" + "imgtag/images/qtlogo.png" + "imgtag/images/starfish_2.png" + "imgtag/imgtag.qml" + "styledtext-layout.qml" + "text.qml" + "textselection/pics/endHandle.png" + "textselection/pics/endHandle.sci" + "textselection/pics/startHandle.png" + "textselection/pics/startHandle.sci" + "textselection/textselection.qml" +) + +qt6_add_resources(text "text" + PREFIX + "/text" + FILES + ${text_resource_files} +) +set_source_files_properties("../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(text "shared" + PREFIX + "/shared" + BASE + "../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS text + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/text/doc/src/text.qdoc b/examples/quick/text/doc/src/text.qdoc index d8bd8d349a..6378e3efe6 100644 --- a/examples/quick/text/doc/src/text.qdoc +++ b/examples/quick/text/doc/src/text.qdoc @@ -49,9 +49,6 @@ Simply by name, using the font.family property directly: \snippet text/fonts/fonts.qml name - or using a \l FontLoader type: - \snippet text/fonts/fonts.qml fontloader - or using a FontLoader and specifying a local font file: \snippet text/fonts/fonts.qml fontloaderlocal diff --git a/examples/quick/text/fonts/fonts.qml b/examples/quick/text/fonts/fonts.qml index 4478db0135..aeb17c48e2 100644 --- a/examples/quick/text/fonts/fonts.qml +++ b/examples/quick/text/fonts/fonts.qml @@ -57,9 +57,6 @@ Rectangle { width: 320; height: 480 color: "steelblue" -//! [fontloader] - FontLoader { id: fixedFont; name: "Courier" } -//! [fontloader] //! [fontloaderlocal] FontLoader { id: localFont; source: "content/fonts/tarzeau_ocr_a.ttf" } //! [fontloaderlocal] @@ -95,14 +92,14 @@ Rectangle { width: parent.width horizontalAlignment: Text.AlignRight wrapMode: Text.WordWrap - font { family: fixedFont.name; pixelSize: 20; weight: Font.Bold; capitalization: Font.AllLowercase } + font { family: "Courier"; pixelSize: 20; weight: Font.Bold; capitalization: Font.AllLowercase } } Text { text: root.myText color: "lightsteelblue" width: parent.width wrapMode: Text.WordWrap - font { family: fixedFont.name; pixelSize: 20; italic: true; capitalization: Font.SmallCaps } + font { family: "Courier"; pixelSize: 20; italic: true; capitalization: Font.SmallCaps } } Text { text: root.myText diff --git a/examples/quick/textureprovider/CMakeLists.txt b/examples/quick/textureprovider/CMakeLists.txt new file mode 100644 index 0000000000..d43f6a1898 --- /dev/null +++ b/examples/quick/textureprovider/CMakeLists.txt @@ -0,0 +1,50 @@ +# Generated from textureprovider.pro. + +cmake_minimum_required(VERSION 3.14) +project(textureprovider LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/textureprovider") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(textureprovider + etcprovider.cpp etcprovider.h + main.cpp +) +target_link_libraries(textureprovider PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(textureprovider_resource_files + "Label.qml" + "images/qt-logo.jpg" + "images/qt-logo.pkm" + "textureprovider.qml" +) + +qt6_add_resources(textureprovider "textureprovider" + PREFIX + "/textureprovider" + FILES + ${textureprovider_resource_files} +) + +install(TARGETS textureprovider + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/threading/CMakeLists.txt b/examples/quick/threading/CMakeLists.txt new file mode 100644 index 0000000000..7a024a37eb --- /dev/null +++ b/examples/quick/threading/CMakeLists.txt @@ -0,0 +1,122 @@ +# Generated from threading.pro. + +cmake_minimum_required(VERSION 3.14) +project(threading LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/threading") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(threading + main.cpp +) +target_link_libraries(threading PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(threading_resource_files + "threadedlistmodel/dataloader.mjs" + "threadedlistmodel/timedisplay.qml" + "threading.qml" + "workerscript/Spinner.qml" + "workerscript/workerscript.mjs" + "workerscript/workerscript.qml" +) + +qt6_add_resources(threading "threading" + PREFIX + "/threading" + FILES + ${threading_resource_files} +) +set_source_files_properties("../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(threading "shared" + PREFIX + "/shared" + BASE + "../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS threading + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/touchinteraction/CMakeLists.txt b/examples/quick/touchinteraction/CMakeLists.txt new file mode 100644 index 0000000000..cbaf7cc2f3 --- /dev/null +++ b/examples/quick/touchinteraction/CMakeLists.txt @@ -0,0 +1,139 @@ +# Generated from touchinteraction.pro. + +cmake_minimum_required(VERSION 3.14) +project(touchinteraction LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/touchinteraction") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(touchinteraction + main.cpp +) +target_link_libraries(touchinteraction PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(touchinteraction_resource_files + "flickable/basic-flickable.qml" + "flickable/content/Panel.qml" + "flickable/content/cork.jpg" + "flickable/content/note-yellow.png" + "flickable/content/tack.png" + "flickable/corkboards.qml" + "multipointtouch/bearwhack.qml" + "multipointtouch/content/AugmentedTouchPoint.qml" + "multipointtouch/content/Bear0.png" + "multipointtouch/content/Bear1.png" + "multipointtouch/content/Bear2.png" + "multipointtouch/content/Bear3.png" + "multipointtouch/content/BearB.png" + "multipointtouch/content/BearWhackParticleSystem.qml" + "multipointtouch/content/ParticleFlame.qml" + "multipointtouch/content/blur-circle.png" + "multipointtouch/content/blur-circle3.png" + "multipointtouch/content/heart-blur.png" + "multipointtouch/content/title.png" + "multipointtouch/multiflame.qml" + "pincharea/flickresize.qml" + "pincharea/qt-logo.jpg" + "touchinteraction.qml" +) + +qt6_add_resources(touchinteraction "touchinteraction" + PREFIX + "/touchinteraction" + FILES + ${touchinteraction_resource_files} +) +set_source_files_properties("../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(touchinteraction "shared" + PREFIX + "/shared" + BASE + "../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS touchinteraction + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/tutorials/CMakeLists.txt b/examples/quick/tutorials/CMakeLists.txt new file mode 100644 index 0000000000..87d2caf01f --- /dev/null +++ b/examples/quick/tutorials/CMakeLists.txt @@ -0,0 +1,2 @@ +# Generated from tutorials.pro. + diff --git a/examples/quick/views/CMakeLists.txt b/examples/quick/views/CMakeLists.txt new file mode 100644 index 0000000000..a53c977ab9 --- /dev/null +++ b/examples/quick/views/CMakeLists.txt @@ -0,0 +1,162 @@ +# Generated from views.pro. + +cmake_minimum_required(VERSION 3.14) +project(views LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/views") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(views + main.cpp +) +target_link_libraries(views PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(views_resource_files + "delegatemodel/dragselection.qml" + "delegatemodel/slideshow.qml" + "gridview/gridview-example.qml" + "gridview/pics/AddressBook_48.png" + "gridview/pics/AudioPlayer_48.png" + "gridview/pics/Camera_48.png" + "gridview/pics/DateBook_48.png" + "gridview/pics/EMail_48.png" + "gridview/pics/TodoList_48.png" + "gridview/pics/VideoPlayer_48.png" + "listview/content/PetsModel.qml" + "listview/content/PressAndHoldButton.qml" + "listview/content/RecipesModel.qml" + "listview/content/SmallText.qml" + "listview/content/TextButton.qml" + "listview/content/ToggleButton.qml" + "listview/content/pics/arrow-down.png" + "listview/content/pics/arrow-up.png" + "listview/content/pics/fruit-salad.jpg" + "listview/content/pics/hamburger.jpg" + "listview/content/pics/lemonade.jpg" + "listview/content/pics/list-delete.png" + "listview/content/pics/minus-sign.png" + "listview/content/pics/moreDown.png" + "listview/content/pics/moreUp.png" + "listview/content/pics/pancakes.jpg" + "listview/content/pics/plus-sign.png" + "listview/content/pics/vegetable-soup.jpg" + "listview/displaymargin.qml" + "listview/dynamiclist.qml" + "listview/expandingdelegates.qml" + "listview/highlight.qml" + "listview/highlightranges.qml" + "listview/sections.qml" + "objectmodel/objectmodel.qml" + "package/Delegate.qml" + "package/view.qml" + "pathview/pathview-example.qml" + "pathview/pics/AddressBook_48.png" + "pathview/pics/AudioPlayer_48.png" + "pathview/pics/Camera_48.png" + "pathview/pics/DateBook_48.png" + "pathview/pics/EMail_48.png" + "pathview/pics/TodoList_48.png" + "pathview/pics/VideoPlayer_48.png" + "views.qml" +) + +qt6_add_resources(views "views" + PREFIX + "/views" + FILES + ${views_resource_files} +) +set_source_files_properties("../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(views "shared" + PREFIX + "/shared" + BASE + "../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS views + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/window/AllScreens.qml b/examples/quick/window/AllScreens.qml index ac0e1cb821..0cec36c0ab 100644 --- a/examples/quick/window/AllScreens.qml +++ b/examples/quick/window/AllScreens.qml @@ -72,11 +72,10 @@ Column { required property string name required property int virtualX required property int virtualY - required property int width - required property int height + required property var modelData // avoid shadowing Label.width and height lineHeight: 1.5 - text: name + "\n" + virtualX + ", " + virtualY + " " + width + "x" + height + text: name + "\n" + virtualX + ", " + virtualY + " " + modelData.width + "x" + modelData.height } } } diff --git a/examples/quick/window/CMakeLists.txt b/examples/quick/window/CMakeLists.txt new file mode 100644 index 0000000000..80857c72d2 --- /dev/null +++ b/examples/quick/window/CMakeLists.txt @@ -0,0 +1,120 @@ +# Generated from window.pro. + +cmake_minimum_required(VERSION 3.14) +project(window LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/quick/window") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(window + main.cpp +) +target_link_libraries(window PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + + +# Resources: +set(window_resource_files + "AllScreens.qml" + "CurrentScreen.qml" + "Splash.qml" + "window.qml" +) + +qt6_add_resources(window "window" + PREFIX + "/window" + FILES + ${window_resource_files} +) +set_source_files_properties("../shared/Button.qml" + PROPERTIES QT_RESOURCE_ALIAS "Button.qml" +) +set_source_files_properties("../shared/CheckBox.qml" + PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" +) +set_source_files_properties("../shared/FlickrRssModel.qml" + PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" +) +set_source_files_properties("../shared/Label.qml" + PROPERTIES QT_RESOURCE_ALIAS "Label.qml" +) +set_source_files_properties("../shared/LauncherList.qml" + PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" +) +set_source_files_properties("../shared/SimpleLauncherDelegate.qml" + PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" +) +set_source_files_properties("../shared/Slider.qml" + PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" +) +set_source_files_properties("../shared/TabSet.qml" + PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" +) +set_source_files_properties("../shared/TextField.qml" + PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" +) +set_source_files_properties("../shared/images/back.png" + PROPERTIES QT_RESOURCE_ALIAS "images/back.png" +) +set_source_files_properties("../shared/images/checkmark.png" + PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" +) +set_source_files_properties("../shared/images/next.png" + PROPERTIES QT_RESOURCE_ALIAS "images/next.png" +) +set_source_files_properties("../shared/images/qt-logo.png" + PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" +) +set_source_files_properties("../shared/images/slider_handle.png" + PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" +) +set_source_files_properties("../shared/images/tab.png" + PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" +) +set(shared_resource_files + "Button.qml" + "CheckBox.qml" + "FlickrRssModel.qml" + "Label.qml" + "LauncherList.qml" + "SimpleLauncherDelegate.qml" + "Slider.qml" + "TabSet.qml" + "TextField.qml" + "images/back.png" + "images/checkmark.png" + "images/next.png" + "images/qt-logo.png" + "images/slider_handle.png" + "images/tab.png" +) + +qt6_add_resources(window "shared" + PREFIX + "/shared" + BASE + "../shared" + FILES + ${shared_resource_files} +) + +install(TARGETS window + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) |