Help: Avoid double lookup for help tooltips

Save the HelpItem directly in the tooltip instead of the help ID which
would need to be looked up again.

Change-Id: I107e82e89d9ea26cad9d6532ad4c687d1ac8f1ec
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2019-01-29 11:43:43 +01:00
parent 4e8c2c4b13
commit 32429e11c9
9 changed files with 67 additions and 57 deletions

View File

@@ -647,12 +647,15 @@ static QUrl findBestLink(const QMap<QString, QUrl> &links)
void HelpPluginPrivate::requestContextHelp()
{
// Find out what to show
QString contextHelpId = Utils::ToolTip::contextHelpId();
const QVariant tipHelpValue = Utils::ToolTip::contextHelp();
const HelpItem tipHelp = tipHelpValue.canConvert<HelpItem>()
? tipHelpValue.value<HelpItem>()
: HelpItem(tipHelpValue.toString());
IContext *context = ICore::currentContextObject();
if (contextHelpId.isEmpty() && context)
if (!tipHelp.isValid() && context)
context->contextHelp([this](const HelpItem &item) { showContextHelp(item); });
else
showContextHelp(contextHelpId);
showContextHelp(tipHelp);
}
void HelpPluginPrivate::showContextHelp(const HelpItem &contextHelp)