diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/SelectFunctionDialog.h b/qt/widgets/common/inc/MantidQtWidgets/Common/SelectFunctionDialog.h index 0290530cab114857e1d466334569945743f33e28..372ae7939d40afaa3c50400641917b804de69507 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/SelectFunctionDialog.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/SelectFunctionDialog.h @@ -27,7 +27,8 @@ namespace MantidWidgets { /** * Select a function type out of a list of available ones. */ -class EXPORT_OPT_MANTIDQT_COMMON SelectFunctionDialog : public API::MantidDialog { +class EXPORT_OPT_MANTIDQT_COMMON SelectFunctionDialog + : public API::MantidDialog { Q_OBJECT public: diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/pqHelpWindow.h b/qt/widgets/common/inc/MantidQtWidgets/Common/pqHelpWindow.h index 8710581c22c1d8baf9f748ea4b86b8b52153feca..2c6725cb1cf516257ff9f8170946776f57609cde 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/pqHelpWindow.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/pqHelpWindow.h @@ -97,6 +97,9 @@ public slots: /// Prints the current open page virtual void printPage(); + /// Check if the url is an existing page + bool isExistingPage(const QUrl& url); + signals: /// fired to relay warning messages from the help system. void helpWarnings(const QString & /*_t1*/); diff --git a/qt/widgets/common/src/FitPropertyBrowser.cpp b/qt/widgets/common/src/FitPropertyBrowser.cpp index 4c50a0663106e5a62cb3b11982ec994bef9baf1a..a3d4445581200184155f6a40f90327da633cae54 100644 --- a/qt/widgets/common/src/FitPropertyBrowser.cpp +++ b/qt/widgets/common/src/FitPropertyBrowser.cpp @@ -3387,7 +3387,7 @@ QStringList FitPropertyBrowser::getParameterNames() const { void FitPropertyBrowser::functionHelp() { PropertyHandler *handler = currentHandler(); if (handler) { - MantidQt::API::HelpWindow::showFitFunction(this->nativeParentWidget(), + MantidQt::API::HelpWindow::showFitFunction(nullptr, handler->ifun()->name()); } } diff --git a/qt/widgets/common/src/MantidHelpWindow.cpp b/qt/widgets/common/src/MantidHelpWindow.cpp index 2d70f7a2d91786c396693724d67d9ebee39e0349..2c451a8a13cb4c446f06d48162f862395a234dcd 100644 --- a/qt/widgets/common/src/MantidHelpWindow.cpp +++ b/qt/widgets/common/src/MantidHelpWindow.cpp @@ -289,11 +289,12 @@ void MantidHelpWindow::showConcept(const QString &name) { void MantidHelpWindow::showFitFunction(const std::string &name) { if (bool(g_helpWindow)) { QString url(BASE_URL); - url += "fitfunctions/"; - if (name.empty()) + url += "fitting/fitfunctions/"; + auto functionUrl = url + QString(name.c_str()) + ".html"; + if (name.empty() || !g_helpWindow->isExistingPage(functionUrl)) url += "index.html"; else - url += QString(name.c_str()) + ".html"; + url = functionUrl; this->showHelp(url); } else // qt-assistant disabled diff --git a/qt/widgets/common/src/SelectFunctionDialog.cpp b/qt/widgets/common/src/SelectFunctionDialog.cpp index 785a8d61a354cf449dd4d07f66a069cb35794a86..c3da14b461815608a27dc82e21e5190ed77e0562 100644 --- a/qt/widgets/common/src/SelectFunctionDialog.cpp +++ b/qt/widgets/common/src/SelectFunctionDialog.cpp @@ -233,10 +233,9 @@ void SelectFunctionDialog::rejectFunction() { void SelectFunctionDialog::helpClicked() const { auto function = getFunction(); if (!function.isEmpty()) { - MantidQt::API::HelpWindow::showFitFunction(this->nativeParentWidget(), - function.toStdString()); + MantidQt::API::HelpWindow::showFitFunction(nullptr, function.toStdString()); } else { // No function selected open fit function index - MantidQt::API::HelpWindow::showFitFunction(this->nativeParentWidget(), ""); + MantidQt::API::HelpWindow::showFitFunction(nullptr, ""); } } diff --git a/qt/widgets/common/src/pqHelpWindow.cxx b/qt/widgets/common/src/pqHelpWindow.cxx index 4a059fd33cfd63aaa47d098a1928f70b383a74f7..b462a60656f66f9b65433118a8b2de6fdbead190 100644 --- a/qt/widgets/common/src/pqHelpWindow.cxx +++ b/qt/widgets/common/src/pqHelpWindow.cxx @@ -428,3 +428,8 @@ void pqHelpWindow::showHomePage(const QString &namespace_name) { } errorMissingPage(QUrl("Could not locate index.html")); } + +//----------------------------------------------------------------------------- +bool pqHelpWindow::isExistingPage(const QUrl& url) { + return this->m_helpEngine->findFile(url).isValid(); +}