forked from qt-creator/qt-creator
Help: Avoid looking up invalid help ID over and over again
Make the help link cache remember that it tried before. Change-Id: Id9d07a7b86c4fa856b7fa3a5e17cd5d4115861ff Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -144,7 +144,7 @@ QString HelpItem::extractContent(bool extended) const
|
||||
|
||||
QMap<QString, QUrl> HelpItem::links() const
|
||||
{
|
||||
if (m_helpLinks.isEmpty())
|
||||
if (!m_helpLinks)
|
||||
m_helpLinks = Core::HelpManager::linksForIdentifier(m_helpId);
|
||||
return m_helpLinks;
|
||||
return *m_helpLinks;
|
||||
}
|
||||
|
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "core_global.h"
|
||||
|
||||
#include <utils/optional.h>
|
||||
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
@@ -77,7 +79,7 @@ private:
|
||||
QString m_helpId;
|
||||
QString m_docMark;
|
||||
Category m_category = Unknown;
|
||||
mutable QMap<QString, QUrl> m_helpLinks; // cached help links
|
||||
mutable Utils::optional<QMap<QString, QUrl>> m_helpLinks; // cached help links
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
Reference in New Issue
Block a user