Skip to content

Commit 629b994

Browse files
committed
minimal Qt6 + C++20 port
1 parent 0964cce commit 629b994

5 files changed

Lines changed: 40 additions & 17 deletions

File tree

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,17 @@ CMakeLists.txt.user*
396396

397397
# VS Code settings
398398
/.vscode
399+
/.cache
400+
401+
# Visual Studio work directory
402+
/.vs/
403+
# Visual Studio build directory
404+
/out/
399405

400406
# CMake build directory
401407
/build
402408

403409
# appimage executables
404410
*.AppImage
411+
412+
/CMakeUserPresets.json

CMakeLists.txt

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,9 @@ endif()
7272
add_subdirectory("libuncso2")
7373

7474
find_package(
75-
Qt5
75+
Qt6
7676
COMPONENTS Widgets
7777
REQUIRED)
78-
if(WIN32)
79-
find_package(Qt5 COMPONENTS WinExtras REQUIRED)
80-
endif()
8178

8279
# Auto generate Qt files
8380
set(CMAKE_AUTOMOC ON)
@@ -175,7 +172,7 @@ source_group("Resources Files" FILES ${UNCSO2_RESOURCES})
175172
source_group("Resources Files\\Breeze" FILES ${UNCSO2_RESOURCES_BREEZE})
176173
source_group("Resources Files\\Layouts" FILES ${UNCSO2_RESOURCES_LAYOUTS})
177174

178-
qt5_add_binary_resources(icons-breeze ${UNCSO2_RESOURCES_BREEZE})
175+
qt_add_binary_resources(icons-breeze ${UNCSO2_RESOURCES_BREEZE})
179176

180177
file(
181178
GLOB
@@ -189,10 +186,10 @@ file(
189186
${UNCSO2_RESOURCES_LAYOUTS}
190187
${UNCSO2_RESOURCES_WIN32})
191188

192-
qt5_add_resources(UNCSO2_ALL_SOURCES ${UNCSO2_RESOURCES})
189+
qt_add_resources(UNCSO2_ALL_SOURCES ${UNCSO2_RESOURCES})
193190

194-
# force c++17 standard
195-
set(CMAKE_CXX_STANDARD 17)
191+
# force c++20 standard
192+
set(CMAKE_CXX_STANDARD 20)
196193
set(CMAKE_CXX_STANDARD_REQUIRED ON)
197194

198195
#
@@ -211,7 +208,7 @@ add_dependencies(uc2 icons-breeze)
211208
# Enable all warnings
212209
#
213210
if(MSVC)
214-
target_compile_options(uc2 PRIVATE /W4 /WX)
211+
target_compile_options(uc2 PRIVATE /DWIN32 /D_WINDOWS /W4 /WX /EHsc)
215212
else()
216213
target_compile_options(uc2 PRIVATE -Wall -Wextra -Wconversion -pedantic)
217214
# target_compile_options(uc2 PRIVATE -g)
@@ -256,9 +253,5 @@ endif()
256253
target_include_directories(uc2 PRIVATE ${PKG_INCLUDE_DIR})
257254
target_link_libraries(uc2 uncso2)
258255

259-
# link Qt5
260-
target_include_directories(uc2 PRIVATE ${Qt5Widgets_INCLUDE_DIRS})
261-
target_link_libraries(uc2 Qt5::Widgets)
262-
if(WIN32)
263-
target_link_libraries(uc2 Qt5::WinExtras)
264-
endif()
256+
# link Qt6
257+
target_link_libraries(uc2 Qt::Widgets)

CMakePresets.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"version": 3,
3+
"configurePresets": [
4+
{
5+
"hidden": true,
6+
"name": "Qt",
7+
"cacheVariables": {
8+
"CMAKE_PREFIX_PATH": "$env{QTDIR}"
9+
},
10+
"vendor": {
11+
"qt-project.org/Qt": {
12+
"checksum": "wVa86FgEkvdCTVp1/nxvrkaemJc="
13+
}
14+
}
15+
}
16+
],
17+
"vendor": {
18+
"qt-project.org/Presets": {
19+
"checksum": "67SmY24ZeVbebyKD0fGfIzb/bGI="
20+
}
21+
}
22+
}

sources/layouts/mainwindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ void CMainWindow::CreateRecentFilesMenu()
206206
void CMainWindow::UpdateRecentFileActions()
207207
{
208208
const int numRecentFiles =
209-
std::min( this->m_RecentFileNames.size(), MAINWIN_RECENT_ITEMS_NUM );
209+
std::min<int>( this->m_RecentFileNames.size(), MAINWIN_RECENT_ITEMS_NUM );
210210

211211
if ( numRecentFiles == 0 )
212212
{

sources/pkgfilemodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ Qt::ItemFlags PkgFileModel::flags( const QModelIndex& index ) const
252252
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | defaultFlags;
253253
}
254254

255-
return NULL;
255+
return Qt::NoItemFlags;
256256
}
257257

258258
std::vector<std::pair<ArchiveBaseNode*, int>> PkgFileModel::GrabOldNodes(

0 commit comments

Comments
 (0)