Skip to content

Commit 7c7ca45

Browse files
authored
WIP: Qt6 transition (#11651)
Update KeePassXC to use Qt 6.
1 parent 703855b commit 7c7ca45

190 files changed

Lines changed: 1299 additions & 1018 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/codeql.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ jobs:
3737
run: |
3838
sudo apt update
3939
sudo apt install build-essential cmake g++
40-
sudo apt install qtbase5-dev qtbase5-private-dev qttools5-dev qttools5-dev-tools libqt5svg5-dev libargon2-dev libkeyutils-dev libminizip-dev libbotan-2-dev libqrencode-dev zlib1g-dev asciidoctor libreadline-dev libpcsclite-dev libusb-1.0-0-dev libxi-dev libxtst-dev libqt5x11extras5-dev
40+
sudo apt install qt6-base-dev qt6-base-private-dev qt6-tools-dev qt6-base-dev-tools qt6-svg-dev qt6-5compat-dev libargon2-dev libkeyutils-dev libminizip-dev libbotan-2-dev libqrencode-dev zlib1g-dev asciidoctor libreadline-dev libpcsclite-dev libusb-1.0-0-dev libxi-dev libxtst-dev
4141
4242
# Initializes the CodeQL tools for scanning.
4343
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@v3
44+
uses: github/codeql-action/init@v4
4545
with:
4646
languages: ${{ matrix.language }}
4747
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -62,9 +62,9 @@ jobs:
6262
# If this step fails, then you should remove it and run the build manually (see below)
6363
- if: matrix.language != 'cpp'
6464
name: Autobuild
65-
uses: github/codeql-action/autobuild@v3
65+
uses: github/codeql-action/autobuild@v4
6666

6767
- name: Perform CodeQL Analysis
68-
uses: github/codeql-action/analyze@v3
68+
uses: github/codeql-action/analyze@v4
6969
with:
7070
category: "/language:${{matrix.language}}"

CMakeLists.txt

Lines changed: 37 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2024 KeePassXC Team <team@keepassxc.org>
1+
# Copyright (C) 2026 KeePassXC Team <team@keepassxc.org>
22
# Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
33
#
44
# This program is free software: you can redistribute it and/or modify
@@ -251,12 +251,14 @@ add_gcc_compiler_flags("-Wall -Wextra -Wundef -Wpointer-arith -Wno-long-long")
251251
add_gcc_compiler_flags("-Wformat=2 -Wmissing-format-attribute")
252252
add_gcc_compiler_flags("-fvisibility=hidden")
253253
add_gcc_compiler_cxxflags("-fvisibility-inlines-hidden")
254+
# Qt6 marks these as errors with newer compilers. Treat them as warnings for now.
255+
check_add_gcc_compiler_cxxflag("-Wno-error=sfinae-incomplete" SFINAE_INCOMPLETE_FLAG)
254256

255257
if(CMAKE_BUILD_TYPE_LOWER STREQUAL "debug")
256258
check_add_gcc_compiler_flag("-Wshadow-compatible-local")
257259
check_add_gcc_compiler_flag("-Wshadow-local")
258260
add_gcc_compiler_flags("-Werror")
259-
# C++20 marks enum arithmetic as deprecated, but we use it in Botan and Qt5
261+
# C++20 marks enum arithmetic as deprecated, but we use it in Botan and Qt6
260262
add_gcc_compiler_cxxflags("-Wno-deprecated-enum-enum-conversion -Wno-error=deprecated ")
261263
endif()
262264

@@ -268,16 +270,19 @@ add_gcc_compiler_cxxflags("-Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virt
268270
add_gcc_compiler_cflags("-Wchar-subscripts -Wwrite-strings")
269271

270272
if(WITH_ASAN)
271-
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR APPLE))
272-
message(FATAL_ERROR "WITH_ASAN is only supported on Linux / macOS at the moment.")
273-
endif()
274-
275-
add_gcc_compiler_flags("-fsanitize=address -DWITH_ASAN")
273+
if(MSVC)
274+
if(NOT CMAKE_COMPILER_IS_CLANG_MSVC)
275+
add_compile_options(/fsanitize=address)
276+
else()
277+
message(WARNING "Address Sanitizer is not supported with clang-cl on MSVC, skipping ASAN flags")
278+
endif()
279+
else()
280+
add_gcc_compiler_flags("-fsanitize=address -DWITH_ASAN")
276281

277-
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
278-
add_gcc_compiler_flags("-fsanitize=leak -DWITH_LSAN")
282+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
283+
add_gcc_compiler_flags("-fsanitize=leak -DWITH_LSAN")
284+
endif()
279285
endif()
280-
281286
endif()
282287

283288
if(CMAKE_BUILD_TYPE_LOWER MATCHES "(release|relwithdebinfo|minsizerel)")
@@ -330,9 +335,9 @@ if(WIN32)
330335
message(FATAL_ERROR "Only Microsoft Visual Studio 2019 and newer are supported!")
331336
endif()
332337
add_compile_options(/permissive- /utf-8)
333-
# Clang-cl does not support /MP, /Zf, or /fsanitize=address
338+
# Clang-cl does not support /MP or /Zf
334339
if (NOT CMAKE_COMPILER_IS_CLANG_MSVC)
335-
add_compile_options(/MP /Zf /fsanitize=address)
340+
add_compile_options(/MP /Zf)
336341
endif()
337342

338343
# Enable high entropy ASLR on release builds
@@ -407,32 +412,20 @@ endif()
407412
# Find Qt
408413
set(QT_COMPONENTS Core Network Concurrent Gui Svg Widgets Test LinguistTools)
409414
if(UNIX AND NOT APPLE)
410-
if(WITH_X11)
411-
list(APPEND QT_COMPONENTS X11Extras)
412-
endif()
413-
find_package(Qt5 COMPONENTS ${QT_COMPONENTS} DBus REQUIRED)
415+
find_package(Qt6 COMPONENTS ${QT_COMPONENTS} DBus REQUIRED)
414416
elseif(APPLE)
415-
find_package(Qt5 COMPONENTS ${QT_COMPONENTS} REQUIRED HINTS
416-
/usr/local/opt/qt@5/lib/cmake
417-
/usr/local/Cellar/qt@5/*/lib/cmake
418-
/opt/homebrew/opt/qt@5/lib/cmake
419-
ENV PATH)
420-
find_package(Qt5 COMPONENTS MacExtras HINTS
421-
/usr/local/opt/qt@5/lib/cmake
422-
/usr/local/Cellar/qt@5/*/lib/cmake
423-
/opt/homebrew/opt/qt@5/lib/cmake
417+
find_package(Qt6 COMPONENTS ${QT_COMPONENTS} REQUIRED HINTS
418+
/usr/local/opt/qt/lib/cmake
419+
/usr/local/Cellar/qt/*/lib/cmake
420+
/opt/homebrew/opt/qt/lib/cmake
424421
ENV PATH)
425422
else()
426-
find_package(Qt5 COMPONENTS ${QT_COMPONENTS} REQUIRED)
423+
find_package(Qt6 COMPONENTS ${QT_COMPONENTS} REQUIRED)
427424
endif()
428425

429426
# Minimum Qt version check
430-
if(Qt5Core_VERSION VERSION_LESS "5.12.0")
431-
message(FATAL_ERROR "Qt version 5.12.0 or higher is required")
432-
endif()
433-
# C++20 is not supported before Qt 5.15.0
434-
if(Qt5Core_VERSION VERSION_LESS "5.15.0")
435-
set(CMAKE_CXX_STANDARD 17)
427+
if(Qt6Core_VERSION VERSION_LESS "6.2.4")
428+
message(FATAL_ERROR "Qt version 6.2.4 or higher is required")
436429
endif()
437430

438431
# Process moc automatically
@@ -447,43 +440,34 @@ if(NOT CMAKE_BUILD_TYPE_LOWER STREQUAL "debug")
447440
add_definitions(-DQT_NO_DEBUG_OUTPUT)
448441
endif()
449442

450-
get_filename_component(Qt5_PREFIX ${Qt5_DIR}/../../.. REALPATH)
443+
get_filename_component(Qt6_PREFIX ${Qt6_DIR}/../../.. REALPATH)
451444

452445
if(APPLE)
453-
# Add includes under Qt5 Prefix in case Qt6 is also installed
454-
include_directories(SYSTEM ${Qt5_PREFIX}/include)
455-
456446
set(CMAKE_MACOSX_RPATH TRUE)
457-
find_program(MACDEPLOYQT_EXE macdeployqt HINTS ${Qt5_PREFIX}/bin ${Qt5_PREFIX}/tools/qt5/bin ENV PATH)
447+
find_program(MACDEPLOYQT_EXE macdeployqt HINTS ${Qt6_PREFIX}/bin ${Qt6_PREFIX}/tools/qt/bin ENV PATH)
458448
if(NOT MACDEPLOYQT_EXE)
459449
message(FATAL_ERROR "macdeployqt is required to build on macOS")
460450
endif()
461451
message(STATUS "Using macdeployqt: ${MACDEPLOYQT_EXE}")
462452
set(MACDEPLOYQT_EXTRA_BINARIES "")
463453
elseif(WIN32)
464-
find_program(WINDEPLOYQT_EXE windeployqt HINTS ${Qt5_PREFIX}/bin ${Qt5_PREFIX}/tools/qt5/bin ENV PATH)
454+
find_program(WINDEPLOYQT_EXE windeployqt HINTS ${Qt6_PREFIX}/bin ${Qt6_PREFIX}/tools/qt/bin ENV PATH)
465455
if(NOT WINDEPLOYQT_EXE)
466456
message(FATAL_ERROR "windeployqt is required to build on Windows")
467457
endif()
468458
message(STATUS "Using windeployqt: ${WINDEPLOYQT_EXE}")
469459
endif()
470460

471461
# Find Botan
472-
# TODO: Increase minimum to 2.19.1 and drop Argon2 package
473462
find_package(Botan REQUIRED)
474463
if(BOTAN_VERSION VERSION_GREATER_EQUAL "3.0.0")
475464
set(WITH_BOTAN3 TRUE)
476-
elseif(BOTAN_VERSION VERSION_LESS "2.12.0")
465+
elseif(BOTAN_VERSION VERSION_LESS "2.19.1")
477466
# Check for minimum Botan version
478-
message(FATAL_ERROR "Botan 2.12.0 or higher is required")
467+
message(FATAL_ERROR "Botan 2.19.1 or higher is required")
479468
endif()
480469
include_directories(SYSTEM ${BOTAN_INCLUDE_DIR})
481470

482-
# Find Argon2 -- Botan 2.18 and below does not support threaded Argon2
483-
find_library(ARGON2_LIBRARIES NAMES argon2)
484-
find_path(ARGON2_INCLUDE_DIR NAMES argon2.h PATH_SUFFIXES local/include)
485-
include_directories(SYSTEM ${ARGON2_INCLUDE_DIR})
486-
487471
# Find zlib
488472
find_package(ZLIB REQUIRED)
489473
if(ZLIB_VERSION_STRING VERSION_LESS "1.2.0")
@@ -493,6 +477,7 @@ include_directories(SYSTEM ${ZLIB_INCLUDE_DIR})
493477

494478
# Find Minizip
495479
find_package(Minizip REQUIRED)
480+
include_directories(SYSTEM ${MINIZIP_INCLUDE_DIR})
496481

497482
# Find PCSC and LibUSB for hardware key support
498483
find_package(PCSC REQUIRED)
@@ -511,9 +496,14 @@ endif()
511496

512497
# Find zxcvbn or use the bundled version
513498
find_library(ZXCVBN_LIBRARIES zxcvbn)
514-
if(NOT ZXCVBN_LIBRARIES)
499+
find_path(ZXCVBN_INCLUDE_DIR zxcvbn.h PATH_SUFFIXES zxcvbn)
500+
if(NOT ZXCVBN_LIBRARIES OR NOT ZXCVBN_INCLUDE_DIR)
501+
message(STATUS "Using internal built zxcvbn library")
515502
add_subdirectory(src/thirdparty/zxcvbn)
516503
set(ZXCVBN_LIBRARIES zxcvbn)
504+
else()
505+
message(STATUS "Using system zxcvbn: ${ZXCVBN_LIBRARIES}")
506+
include_directories(SYSTEM ${ZXCVBN_INCLUDE_DIR})
517507
endif()
518508

519509
# Add KeePassXC sources and tests

INSTALL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Note: These steps place the compiled KeePassXC binary inside the `./build/src/`
6565

6666
If you installed Qt@5 via Homebrew and CMake fails to find your Qt installation, you can specify it manually by adding the following parameter:
6767

68-
`-DCMAKE_PREFIX_PATH=$(brew --prefix qt@5)/lib/cmake`
68+
`-DCMAKE_PREFIX_PATH=$(brew --prefix qt)/lib/cmake`
6969

7070
When building with ASAN support on macOS, you need to use `export ASAN_OPTIONS=detect_leaks=0` before running the tests (LSAN is no supported on macOS).
7171

@@ -103,7 +103,7 @@ KeePassXC comes with a variety of build options that can turn on/off features. E
103103
```
104104

105105
Note: Even though you can build the application with all TCP/IP networking code disabled, we still require and link against
106-
Qt5's network library to use local named pipes on all operating systems.
106+
Qt6's network library to use local named pipes on all operating systems.
107107

108108
## Installation
109109

share/translations/CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
1+
# Copyright (C) 2025 KeePassXC Team <team@keepassxc.org>
22
# Copyright (C) 2014 Felix Geyer <debfx@fobos.de>
33
#
44
# This program is free software: you can redistribute it and/or modify
@@ -20,15 +20,14 @@ list(REMOVE_ITEM TRANSLATION_FILES keepassxc_en.ts)
2020
list(REMOVE_ITEM TRANSLATION_FILES ${TRANSLATION_EN_ABS})
2121
message(STATUS "Including translations...\n")
2222

23-
qt5_add_translation(QM_FILES ${TRANSLATION_FILES})
23+
qt6_add_translation(QM_FILES ${TRANSLATION_FILES})
2424

2525
if(WIN32)
26-
file(GLOB QTBASE_TRANSLATIONS ${Qt5_PREFIX}/share/qt5/translations/qtbase_*.qm)
26+
file(GLOB QTBASE_TRANSLATIONS ${Qt6_PREFIX}/share/qt/translations/qtbase_*.qm)
2727
elseif(APPLE OR KEEPASSXC_DIST_APPIMAGE)
2828
file(GLOB QTBASE_TRANSLATIONS
2929
/usr/share/qt/translations/qtbase_*.qm
30-
/usr/share/qt5/translations/qtbase_*.qm
31-
${Qt5_PREFIX}/translations/qtbase_*.qm)
30+
${Qt6_PREFIX}/translations/qtbase_*.qm)
3231
endif()
3332
set(QM_FILES ${QM_FILES} ${QTBASE_TRANSLATIONS})
3433

share/translations/keepassxc_en.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9308,55 +9308,55 @@ This option is deprecated, use --set-key-file instead.</source>
93089308
<translation type="unfinished"></translation>
93099309
</message>
93109310
<message>
9311-
<source>Format to use when exporting. Available choices are &apos;xml&apos;, &apos;csv&apos; or &apos;html&apos;. Defaults to &apos;xml&apos;.</source>
9311+
<source>Passkey</source>
93129312
<translation type="unfinished"></translation>
93139313
</message>
93149314
<message>
9315-
<source>Passkey</source>
9315+
<source>Reset Shortcuts</source>
93169316
<translation type="unfinished"></translation>
93179317
</message>
93189318
<message>
9319-
<source>malformed string, possible unescaped delimiter</source>
9319+
<source>Double click an action to change its shortcut</source>
93209320
<translation type="unfinished"></translation>
93219321
</message>
93229322
<message>
9323-
<source>missing closing delimiter</source>
9323+
<source>Filter...</source>
93249324
<translation type="unfinished"></translation>
93259325
</message>
93269326
<message>
9327-
<source>%1, row: %2, column: %3</source>
9327+
<source>Shortcut Conflict</source>
93289328
<translation type="unfinished"></translation>
93299329
</message>
93309330
<message>
9331-
<source>Encrypted files are not supported.</source>
9331+
<source>Shortcut %1 conflicts with &apos;%2&apos;. Overwrite shortcut?</source>
93329332
<translation type="unfinished"></translation>
93339333
</message>
93349334
<message>
9335-
<source>Proton Pass Import</source>
9335+
<source>Format to use when exporting. Available choices are &apos;xml&apos;, &apos;csv&apos; or &apos;html&apos;. Defaults to &apos;xml&apos;.</source>
93369336
<translation type="unfinished"></translation>
93379337
</message>
93389338
<message>
9339-
<source>Tags</source>
9339+
<source>malformed string, possible unescaped delimiter</source>
93409340
<translation type="unfinished"></translation>
93419341
</message>
93429342
<message>
9343-
<source>Reset Shortcuts</source>
9343+
<source>missing closing delimiter</source>
93449344
<translation type="unfinished"></translation>
93459345
</message>
93469346
<message>
9347-
<source>Double click an action to change its shortcut</source>
9347+
<source>%1, row: %2, column: %3</source>
93489348
<translation type="unfinished"></translation>
93499349
</message>
93509350
<message>
9351-
<source>Filter...</source>
9351+
<source>Encrypted files are not supported.</source>
93529352
<translation type="unfinished"></translation>
93539353
</message>
93549354
<message>
9355-
<source>Shortcut Conflict</source>
9355+
<source>Proton Pass Import</source>
93569356
<translation type="unfinished"></translation>
93579357
</message>
93589358
<message>
9359-
<source>Shortcut %1 conflicts with &apos;%2&apos;. Overwrite shortcut?</source>
9359+
<source>Tags</source>
93609360
<translation type="unfinished"></translation>
93619361
</message>
93629362
<message>

0 commit comments

Comments
 (0)