refs #935, showHelp function, so other widgets can invoke help

This commit is contained in:
Klaus Basan
2017-04-16 12:09:36 +02:00
committed by Mathew Sutcliffe
parent 7907dff967
commit 07db0732ed
2 changed files with 14 additions and 7 deletions

View File

@@ -518,21 +518,25 @@ namespace BlackGui
void CGuiApplication::addMenuHelp(QMenu &menu) void CGuiApplication::addMenuHelp(QMenu &menu)
{ {
QWidget *w = mainApplicationWindow(); const QWidget *w = mainApplicationWindow();
if (!w) { return; } if (!w) { return; }
const CGlobalSetup gs = this->getGlobalSetup();
const CUrl helpPage = gs.getHelpPageUrl();
if (helpPage.isEmpty()) { return; }
QAction *a = menu.addAction(w->style()->standardIcon(QStyle::SP_TitleBarContextHelpButton), "Online help"); QAction *a = menu.addAction(w->style()->standardIcon(QStyle::SP_TitleBarContextHelpButton), "Online help");
bool c = connect(a, &QAction::triggered, this, [helpPage]() const bool c = connect(a, &QAction::triggered, this, [this]()
{ {
QDesktopServices::openUrl(helpPage); this->showHelp();
}); });
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed"); Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
Q_UNUSED(c); Q_UNUSED(c);
} }
void CGuiApplication::showHelp()
{
const CGlobalSetup gs = this->getGlobalSetup();
const CUrl helpPage = gs.getHelpPageUrl();
if (helpPage.isEmpty()) { return; }
QDesktopServices::openUrl(helpPage);
}
const CStyleSheetUtility &CGuiApplication::getStyleSheetUtility() const const CStyleSheetUtility &CGuiApplication::getStyleSheetUtility() const
{ {
return this->m_styleSheetUtility; return this->m_styleSheetUtility;

View File

@@ -133,6 +133,9 @@ namespace BlackGui
//! Help operations //! Help operations
void addMenuHelp(QMenu &menu); void addMenuHelp(QMenu &menu);
//! Show help page (online help)
void showHelp();
//! Style sheet handling //! Style sheet handling
const CStyleSheetUtility &getStyleSheetUtility() const; const CStyleSheetUtility &getStyleSheetUtility() const;