Skip to content

Commit 6aae0de

Browse files
authored
Merge pull request #38905 from mantidproject/fix_register_qthelp
Pass DOCS_QTHELP to compiler to control registering MantidHelpWindow
2 parents f4b1d44 + 0413b2a commit 6aae0de

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

qt/widgets/common/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,11 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
636636
list(APPEND TARGET_LIBRARIES "-framework CoreFoundation")
637637
endif()
638638

639+
# Add option to the compiler to register MantidHelpWindow
640+
if(DOCS_QTHELP)
641+
add_definitions(-DDOCS_QTHELP)
642+
endif()
643+
639644
# Target Additional components for this module
640645
find_package(
641646
Qt5 ${QT_MIN_VERSION}

qt/widgets/common/src/InterfaceManager.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,34 +240,40 @@ MantidHelpInterface *InterfaceManager::createHelpWindow() const {
240240

241241
void InterfaceManager::showHelpPage(const QString &url) {
242242
auto window = createHelpWindow();
243-
window->showPage(url);
243+
if (window)
244+
window->showPage(url);
244245
}
245246

246247
void InterfaceManager::showAlgorithmHelp(const QString &name, const int version) {
247248
auto window = createHelpWindow();
248-
window->showAlgorithm(name, version);
249+
if (window)
250+
window->showAlgorithm(name, version);
249251
}
250252

251253
void InterfaceManager::showConceptHelp(const QString &name) {
252254
auto window = createHelpWindow();
253-
window->showConcept(name);
255+
if (window)
256+
window->showConcept(name);
254257
}
255258

256259
void InterfaceManager::showFitFunctionHelp(const QString &name) {
257260
auto window = createHelpWindow();
258-
window->showFitFunction(name);
261+
if (window)
262+
window->showFitFunction(name);
259263
}
260264

261265
void InterfaceManager::showCustomInterfaceHelp(const QString &name, const QString &area, const QString &section) {
262266
auto window = createHelpWindow();
263-
window->showCustomInterface(name, area, section);
267+
if (window)
268+
window->showCustomInterface(name, area, section);
264269
}
265270

266271
void InterfaceManager::showWebPage(const QString &url) { MantidDesktopServices::openUrl(url); }
267272

268273
void InterfaceManager::closeHelpWindow() {
269274
if (MantidHelpWindow::helpWindowExists()) {
270275
auto window = createHelpWindow();
271-
window->shutdown();
276+
if (window)
277+
window->shutdown();
272278
}
273279
}

0 commit comments

Comments
 (0)