mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
refs #935, showHelp function, so other widgets can invoke help
This commit is contained in:
committed by
Mathew Sutcliffe
parent
7907dff967
commit
07db0732ed
@@ -518,21 +518,25 @@ namespace BlackGui
|
||||
|
||||
void CGuiApplication::addMenuHelp(QMenu &menu)
|
||||
{
|
||||
QWidget *w = mainApplicationWindow();
|
||||
const QWidget *w = mainApplicationWindow();
|
||||
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");
|
||||
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_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
|
||||
{
|
||||
return this->m_styleSheetUtility;
|
||||
|
||||
@@ -133,6 +133,9 @@ namespace BlackGui
|
||||
//! Help operations
|
||||
void addMenuHelp(QMenu &menu);
|
||||
|
||||
//! Show help page (online help)
|
||||
void showHelp();
|
||||
|
||||
//! Style sheet handling
|
||||
const CStyleSheetUtility &getStyleSheetUtility() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user