From 1582048a224c9968135edc62b1a15c5d8d9aaa05 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 1 Dec 2018 02:22:26 +0100 Subject: [PATCH] Fix building without Qt Widgets GUI support --- CMakeLists.txt | 12 +++++++++++- quickgui/controller.h | 4 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 166facb..b1756dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,8 +163,18 @@ use_qt_utilities() find_package(passwordfile 3.1.0 REQUIRED) use_password_file() -# require Qt AndroidExtras and Kirigami2 +# add further Qt/KF modules required by the if(ANDROID AND QUICK_GUI) + if(NOT WIDGETS_GUI) + option(ENABLE_UNDO_SUPPORT_FOR_QUICK_GUI "enables with undo/redo support for the Qt Quick GUI (requires Qt Widgets)" ON) + if(ENABLE_UNDO_SUPPORT_FOR_QUICK_GUI) + list(APPEND ADDITIONAL_QT_MODULES Widgets) + set_property( + SOURCE quickgui/controller.cpp + APPEND PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME}_ENABLE_UNDO_SUPPORT_FOR_QUICK_GUI + ) + endif() + endif() list(APPEND ADDITIONAL_QT_MODULES AndroidExtras) list(APPEND ADDITIONAL_KF_MODULES Kirigami2) endif() diff --git a/quickgui/controller.h b/quickgui/controller.h index 5e63d8c..f26d77a 100644 --- a/quickgui/controller.h +++ b/quickgui/controller.h @@ -12,9 +12,11 @@ QT_FORWARD_DECLARE_CLASS(QSettings) -#ifdef PASSWORD_MANAGER_GUI_QTWIDGETS +#if defined(PASSWORD_MANAGER_GUI_QTWIDGETS) || defined(PASSWORD_MANAGER_ENABLE_UNDO_SUPPORT_FOR_QUICK_GUI) #define PASSWORD_MANAGER_UNDO_SUPPORT #include +#else +QT_FORWARD_DECLARE_CLASS(QUndoStack) #endif namespace QtGui {