Created
August 10, 2020 08:11
-
-
Save martyngigg/1b7348c8efa1d04f4dedef6ecfaa0077 to your computer and use it in GitHub Desktop.
QtHelp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git buildconfig/CMake/PyQtFindImpl.cmake buildconfig/CMake/PyQtFindImpl.cmake | |
index 3595f733df4..ca073c6b837 100644 | |
--- buildconfig/CMake/PyQtFindImpl.cmake | |
+++ buildconfig/CMake/PyQtFindImpl.cmake | |
@@ -45,7 +45,7 @@ function (find_pyqt major_version) | |
set (PYQT${major_version}_VERSION_TAG "${CMAKE_MATCH_1}" CACHE STRING "The Qt version tag used by PyQt${major_version}'s .sip files" FORCE) | |
string (REGEX MATCH ".*\npyqt_sip_dir:([^\n]+).*$" _dummy ${_pyqt_config}) | |
- set (PYQT${major_version}_SIP_DIR "${CMAKE_MATCH_1}" CACHE PATH "The base directory where PyQt${major_version}'s .sip files are installed" FORCE) | |
+ set (PYQT${major_version}_SIP_DIR "${CMAKE_MATCH_1}" CACHE PATH "The base directory where PyQt${major_version}'s .sip files are installed") | |
string (REGEX MATCH ".*\npyqt_sip_flags:([^\n]+).*$" _dummy ${_pyqt_config}) | |
set (PYQT${major_version}_SIP_FLAGS "${CMAKE_MATCH_1}" CACHE STRING "The SIP flags used to build PyQt${major_version}" FORCE) | |
diff --git qt/widgets/common/CMakeLists.txt qt/widgets/common/CMakeLists.txt | |
index 60a874c203e..3b4d31f4a8d 100644 | |
--- qt/widgets/common/CMakeLists.txt | |
+++ qt/widgets/common/CMakeLists.txt | |
@@ -66,7 +66,6 @@ set( | |
src/ParseKeyValueString.cpp | |
src/pixmaps.cpp | |
src/PluginLibraries.cpp | |
- src/pqHelpWindow.cxx | |
src/ProcessingAlgoWidget.cpp | |
src/ProgressableView.cpp | |
src/PropertyHandler.cpp | |
@@ -187,7 +186,6 @@ set( | |
inc/MantidQtWidgets/Common/FileFinderWidget.h | |
inc/MantidQtWidgets/Common/NotificationService.h | |
inc/MantidQtWidgets/Common/OptionsPropertyWidget.h | |
- inc/MantidQtWidgets/Common/pqHelpWindow.h | |
inc/MantidQtWidgets/Common/ProcessingAlgoWidget.h | |
inc/MantidQtWidgets/Common/PropertyHandler.h | |
inc/MantidQtWidgets/Common/PropertyWidget.h | |
@@ -844,29 +842,34 @@ if(ENABLE_WORKBENCH) | |
Qt5 | |
COMPONENTS | |
Concurrent | |
- Help | |
Network | |
PrintSupport | |
REQUIRED | |
) | |
- # Prefer WebEngineWidgets over WebkitWidgets | |
- unset(Qt5_FOUND) | |
- find_package(Qt5 COMPONENTS WebEngineWidgets QUIET) | |
- if(Qt5_FOUND) | |
- set(_webwidgets_tgt Qt5::WebEngineWidgets) | |
- else() | |
- find_package(Qt5 COMPONENTS WebKitWidgets QUIET) | |
+ option(ENABLE_QTHELP "If True then enable help via QtHelp module" ON) | |
+ set(QTHELP_DEF) | |
+ if(ENABLE_QTHELP) | |
+ # Prefer WebEngineWidgets over WebkitWidgets | |
+ unset(Qt5_FOUND) | |
+ find_package(Qt5 COMPONENTS Help WebEngineWidgets QUIET) | |
if(Qt5_FOUND) | |
- set(_webwidgets_tgt Qt5::WebKitWidgets) | |
- set(_webengine_def USE_QTWEBKIT) | |
+ set(_webwidgets_tgt Qt5::Help Qt5::WebEngineWidgets) | |
else() | |
- message( | |
- FATAL_ERROR | |
- "Unable to find suitable module for web widgets. Tried: WebEnginewidgets, WebKitWidgets" | |
- ) | |
+ find_package(Qt5 COMPONENTS Help WebKitWidgets QUIET) | |
+ if(Qt5_FOUND) | |
+ set(_webwidgets_tgt Qt5::Help Qt5::WebKitWidgets) | |
+ set(_webengine_def USE_QTWEBKIT) | |
+ else() | |
+ message( | |
+ FATAL_ERROR | |
+ "Unable to find suitable module for web widgets. Tried: WebEnginewidgets, WebKitWidgets" | |
+ ) | |
+ endif() | |
endif() | |
+ set(QTHELP_DEF "ENABLE_QTHELP ${_webengine_def}") | |
+ list(APPEND QT5_SRC_FILES src/pqHelpWindow.cxx) | |
+ list(APPEND QT5_MOC_FILES inc/MantidQtWidgets/Common/pqHelpWindow.h) | |
endif() | |
- | |
endif() | |
mtd_add_qt_library( | |
@@ -913,7 +916,7 @@ mtd_add_qt_library( | |
IN_MANTIDQT_COMMON | |
QSCINTILLA_DLL | |
QT5_DEFS | |
- ${_webengine_def} | |
+ ${QTHELP_DEF} | |
INCLUDE_DIRS | |
inc | |
SYSTEM_INCLUDE_DIRS | |
@@ -924,7 +927,6 @@ mtd_add_qt_library( | |
PythonInterfaceCore | |
QT5_LINK_LIBS | |
Qt5::Concurrent | |
- Qt5::Help | |
Qt5::Network | |
Qt5::PrintSupport | |
${_webwidgets_tgt} | |
diff --git qt/widgets/common/inc/MantidQtWidgets/Common/MantidHelpWindow.h qt/widgets/common/inc/MantidQtWidgets/Common/MantidHelpWindow.h | |
index d4f39094c92..408e49795ba 100644 | |
--- qt/widgets/common/inc/MantidQtWidgets/Common/MantidHelpWindow.h | |
+++ qt/widgets/common/inc/MantidQtWidgets/Common/MantidHelpWindow.h | |
@@ -11,6 +11,8 @@ | |
#include <QWidget> | |
#include <string> | |
+#if defined(ENABLE_QTHELP) | |
+ | |
// forward declaration | |
class QHelpEngine; | |
class QString; | |
@@ -73,4 +75,22 @@ public slots: | |
}; | |
} // namespace MantidWidgets | |
-} // namespace MantidQt | |
\ No newline at end of file | |
+} // namespace MantidQt | |
+ | |
+#else | |
+ | |
+namespace MantidQt { | |
+namespace MantidWidgets { | |
+ | |
+class EXPORT_OPT_MANTIDQT_COMMON MantidHelpWindow | |
+ : public API::MantidHelpInterface { | |
+ Q_OBJECT | |
+ | |
+public: | |
+ using MantidHelpInterface::MantidHelpInterface; | |
+ static bool helpWindowExists() { return false; } | |
+}; | |
+} // namespace MantidWidgets | |
+} // namespace MantidQt | |
+ | |
+#endif | |
diff --git qt/widgets/common/src/MantidHelpWindow.cpp qt/widgets/common/src/MantidHelpWindow.cpp | |
index 05b1195e8a1..23c4627bae6 100644 | |
--- qt/widgets/common/src/MantidHelpWindow.cpp | |
+++ qt/widgets/common/src/MantidHelpWindow.cpp | |
@@ -5,6 +5,9 @@ | |
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS | |
// SPDX - License - Identifier: GPL - 3.0 + | |
#include "MantidQtWidgets/Common/MantidHelpWindow.h" | |
+ | |
+#if defined(ENABLE_QTHELP) | |
+ | |
#include "MantidAPI/AlgorithmManager.h" | |
#include "MantidKernel/ConfigService.h" | |
#include "MantidKernel/Logger.h" | |
@@ -494,3 +497,7 @@ void MantidHelpWindow::warning(const QString &msg) { | |
} // namespace MantidWidgets | |
} // namespace MantidQt | |
+ | |
+#else | |
+ | |
+#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment