Skip to content

Commit ebe2e86

Browse files
committed
feat: support Qt 6.10
Signed-off-by: ComixHe <heyuming@deepin.org>
1 parent 0d09e8a commit ebe2e86

6 files changed

Lines changed: 39 additions & 9 deletions

File tree

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,15 @@ set(MKSPECS_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/qt${QT_VERSION_MAJOR}/mkspecs/m
5858
set(QML_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/qt${QT_VERSION_MAJOR}/qml" CACHE STRING "Qml plugin install directory")
5959

6060
set(USE_QQuickStylePluginPrivate OFF)
61-
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
62-
find_package(Qt${QT_VERSION_MAJOR}QuickControls2)
61+
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core QuickControls2)
62+
63+
if (${QT_VERSION_MAJOR} STREQUAL "6")
64+
if (${Qt6QuickControls2_VERSION} VERSION_GREATER_EQUAL "6.10.0")
65+
set(QT_NO_PRIVATE_MODULE_WARNING ON)
66+
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS CorePrivate QuickControls2Private)
67+
endif()
68+
endif()
69+
6370
if(EnableQt5)
6471
if(TARGET Qt::QuickControls2 AND TARGET Qt::QuickControls2Private)
6572
set(USE_QQuickStylePluginPrivate ON)

chameleon/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ if(EnableQt5)
1010
find_package(Qt${QT_VERSION_MAJOR}QuickCompiler)
1111
endif()
1212

13+
if("${QT_VERSION_MAJOR}" STREQUAL "6")
14+
if(${Qt6Qml_VERSION} VERSION_GREATER_EQUAL "6.10.0")
15+
set(QT_NO_PRIVATE_MODULE_WARNING ON)
16+
find_package(
17+
Qt6
18+
COMPONENTS QmlPrivate QuickPrivate QuickControls2Private
19+
REQUIRED)
20+
endif()
21+
endif()
22+
1323
set(QML_FILES
1424
ApplicationWindow.qml
1525
BusyIndicator.qml

examples/exhibition/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ if (EnableQt6)
1313
set(QML_RCS ${CMAKE_CURRENT_LIST_DIR}/qml-qt6.qrc)
1414
endif()
1515
add_executable(${BIN_NAME}
16-
${CMAKE_CURRENT_LIST_DIR}/main.cpp
16+
${CMAKE_CURRENT_LIST_DIR}/main.cpp
1717
${CMAKE_CURRENT_LIST_DIR}/assets.qrc
1818
${QML_RCS}
1919
)
2020

2121
target_compile_options(${BIN_NAME} PRIVATE "-fpic")
2222

2323
target_link_libraries(${BIN_NAME} PRIVATE
24-
Qt${QT_VERSION_MAJOR}::Quick
24+
Qt${QT_VERSION_MAJOR}::Quick
2525
Qt${QT_VERSION_MAJOR}::QuickControls2
2626
Dtk${DTK_VERSION_MAJOR}::Core
2727
Dtk${DTK_VERSION_MAJOR}::Gui

qt6/src/qml/settings/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ qt_add_qml_module(dtkdeclarativesettingsplugin
2424

2525
dtk_extend_target(dtkdeclarativesettingsplugin EnableCov ${ENABLE_COV})
2626

27+
if("${QT_VERSION_MAJOR}" STREQUAL "6")
28+
if (${Qt6Core_VERSION} VERSION_GREATER_EQUAL "6.10.0")
29+
find_package(Qt6 REQUIRED COMPONENTS CorePrivate QuickPrivate QmlPrivate)
30+
endif()
31+
endif()
32+
2733
target_link_libraries(dtkdeclarativesettingsplugin
2834
PRIVATE
2935
Qt${QT_VERSION_MAJOR}::Core

src/targets.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ endif()
99

1010
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick DBus QuickControls2 LinguistTools)
1111

12+
if ("${QT_VERSION_MAJOR}" STREQUAL "6")
13+
if (${Qt6Quick_VERSION} VERSION_GREATER_EQUAL "6.10.0")
14+
set(QT_NO_PRIVATE_MODULE_WARNING ON)
15+
find_package(Qt6 REQUIRED COMPONENTS QuickPrivate QuickControls2Private)
16+
endif()
17+
endif()
18+
1219
find_package(Dtk${DTK_VERSION_MAJOR}Core REQUIRED)
1320
find_package(Dtk${DTK_VERSION_MAJOR}Gui REQUIRED)
1421
find_package(PkgConfig REQUIRED)

tests/ut_dqmlglobalobject.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,13 @@ TEST(ut_DColor, construct)
214214
pt.setBrush(QPalette::HighlightedText, Qt::blue);
215215
ASSERT_EQ(color1.toColor(pt), Qt::blue);
216216

217-
DColor color2(QColor(Qt::red));
217+
DColor color2{QColor(Qt::red)};
218218
ASSERT_EQ(color2.color(), Qt::red);
219219
}
220220

221221
TEST(ut_DColor, common)
222222
{
223-
DColor color(QColor(Qt::red));
223+
DColor color{QColor(Qt::red)};
224224
DColor color2(color.hue(1).opacity(1).saturation(1).lightness(1));
225225

226226
EXPECT_NE(color.data.hue, color2.data.hue);
@@ -231,9 +231,9 @@ TEST(ut_DColor, common)
231231

232232
TEST(ut_DColor, operatorEQ)
233233
{
234-
DColor color1(QColor(Qt::red));
235-
DColor color2(QColor(Qt::blue));
236-
DColor color3(QColor(Qt::blue));
234+
DColor color1{QColor(Qt::red)};
235+
DColor color2{QColor(Qt::blue)};
236+
DColor color3{QColor(Qt::blue)};
237237
EXPECT_NE(color1, color2);
238238
EXPECT_EQ(color2, color3);
239239
}

0 commit comments

Comments
 (0)