From 0b9cdb4fcd6689156150d0553ca152270fbff686 Mon Sep 17 00:00:00 2001 From: deepin-ci-robot Date: Mon, 13 Oct 2025 07:40:57 +0000 Subject: [PATCH] sync: from linuxdeepin/dtkdeclarative Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: https://github.com/linuxdeepin/dtkdeclarative/pull/537 --- CMakeLists.txt | 11 +++++++++-- chameleon/CMakeLists.txt | 10 ++++++++++ examples/exhibition/CMakeLists.txt | 4 ++-- qt6/src/qml/settings/CMakeLists.txt | 6 ++++++ src/targets.cmake | 7 +++++++ tests/ut_dqmlglobalobject.cpp | 10 +++++----- 6 files changed, 39 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 918e2f1d..74ce0cdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,8 +58,15 @@ set(MKSPECS_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/qt${QT_VERSION_MAJOR}/mkspecs/m set(QML_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/qt${QT_VERSION_MAJOR}/qml" CACHE STRING "Qml plugin install directory") set(USE_QQuickStylePluginPrivate OFF) -find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core) -find_package(Qt${QT_VERSION_MAJOR}QuickControls2) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core QuickControls2) + +if (${QT_VERSION_MAJOR} STREQUAL "6") + if (${Qt6QuickControls2_VERSION} VERSION_GREATER_EQUAL "6.10.0") + set(QT_NO_PRIVATE_MODULE_WARNING ON) + find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS CorePrivate QuickControls2Private) + endif() +endif() + if(EnableQt5) if(TARGET Qt::QuickControls2 AND TARGET Qt::QuickControls2Private) set(USE_QQuickStylePluginPrivate ON) diff --git a/chameleon/CMakeLists.txt b/chameleon/CMakeLists.txt index 9fd3f1af..e2ca6e1c 100644 --- a/chameleon/CMakeLists.txt +++ b/chameleon/CMakeLists.txt @@ -10,6 +10,16 @@ if(EnableQt5) find_package(Qt${QT_VERSION_MAJOR}QuickCompiler) endif() +if("${QT_VERSION_MAJOR}" STREQUAL "6") + if(${Qt6Qml_VERSION} VERSION_GREATER_EQUAL "6.10.0") + set(QT_NO_PRIVATE_MODULE_WARNING ON) + find_package( + Qt6 + COMPONENTS QmlPrivate QuickPrivate QuickControls2Private + REQUIRED) + endif() +endif() + set(QML_FILES ApplicationWindow.qml BusyIndicator.qml diff --git a/examples/exhibition/CMakeLists.txt b/examples/exhibition/CMakeLists.txt index 7a53a384..778db851 100644 --- a/examples/exhibition/CMakeLists.txt +++ b/examples/exhibition/CMakeLists.txt @@ -13,7 +13,7 @@ if (EnableQt6) set(QML_RCS ${CMAKE_CURRENT_LIST_DIR}/qml-qt6.qrc) endif() add_executable(${BIN_NAME} - ${CMAKE_CURRENT_LIST_DIR}/main.cpp + ${CMAKE_CURRENT_LIST_DIR}/main.cpp ${CMAKE_CURRENT_LIST_DIR}/assets.qrc ${QML_RCS} ) @@ -21,7 +21,7 @@ add_executable(${BIN_NAME} target_compile_options(${BIN_NAME} PRIVATE "-fpic") target_link_libraries(${BIN_NAME} PRIVATE - Qt${QT_VERSION_MAJOR}::Quick + Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::QuickControls2 Dtk${DTK_VERSION_MAJOR}::Core Dtk${DTK_VERSION_MAJOR}::Gui diff --git a/qt6/src/qml/settings/CMakeLists.txt b/qt6/src/qml/settings/CMakeLists.txt index b412e328..1bd9a398 100644 --- a/qt6/src/qml/settings/CMakeLists.txt +++ b/qt6/src/qml/settings/CMakeLists.txt @@ -24,6 +24,12 @@ qt_add_qml_module(dtkdeclarativesettingsplugin dtk_extend_target(dtkdeclarativesettingsplugin EnableCov ${ENABLE_COV}) +if("${QT_VERSION_MAJOR}" STREQUAL "6") + if (${Qt6Core_VERSION} VERSION_GREATER_EQUAL "6.10.0") + find_package(Qt6 REQUIRED COMPONENTS CorePrivate QuickPrivate QmlPrivate) + endif() +endif() + target_link_libraries(dtkdeclarativesettingsplugin PRIVATE Qt${QT_VERSION_MAJOR}::Core diff --git a/src/targets.cmake b/src/targets.cmake index 7f9b1581..3b32bd02 100644 --- a/src/targets.cmake +++ b/src/targets.cmake @@ -9,6 +9,13 @@ endif() find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick DBus QuickControls2 LinguistTools) +if ("${QT_VERSION_MAJOR}" STREQUAL "6") + if (${Qt6Quick_VERSION} VERSION_GREATER_EQUAL "6.10.0") + set(QT_NO_PRIVATE_MODULE_WARNING ON) + find_package(Qt6 REQUIRED COMPONENTS QuickPrivate QuickControls2Private) + endif() +endif() + find_package(Dtk${DTK_VERSION_MAJOR}Core REQUIRED) find_package(Dtk${DTK_VERSION_MAJOR}Gui REQUIRED) find_package(PkgConfig REQUIRED) diff --git a/tests/ut_dqmlglobalobject.cpp b/tests/ut_dqmlglobalobject.cpp index 08508856..5ff38874 100644 --- a/tests/ut_dqmlglobalobject.cpp +++ b/tests/ut_dqmlglobalobject.cpp @@ -214,13 +214,13 @@ TEST(ut_DColor, construct) pt.setBrush(QPalette::HighlightedText, Qt::blue); ASSERT_EQ(color1.toColor(pt), Qt::blue); - DColor color2(QColor(Qt::red)); + DColor color2{QColor(Qt::red)}; ASSERT_EQ(color2.color(), Qt::red); } TEST(ut_DColor, common) { - DColor color(QColor(Qt::red)); + DColor color{QColor(Qt::red)}; DColor color2(color.hue(1).opacity(1).saturation(1).lightness(1)); EXPECT_NE(color.data.hue, color2.data.hue); @@ -231,9 +231,9 @@ TEST(ut_DColor, common) TEST(ut_DColor, operatorEQ) { - DColor color1(QColor(Qt::red)); - DColor color2(QColor(Qt::blue)); - DColor color3(QColor(Qt::blue)); + DColor color1{QColor(Qt::red)}; + DColor color2{QColor(Qt::blue)}; + DColor color3{QColor(Qt::blue)}; EXPECT_NE(color1, color2); EXPECT_EQ(color2, color3); }