summaryrefslogtreecommitdiff
path: root/src/plugins/help
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/help')
-rw-r--r--src/plugins/help/litehtmlhelpviewer.cpp12
-rw-r--r--src/plugins/help/litehtmlhelpviewer.h3
2 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/help/litehtmlhelpviewer.cpp b/src/plugins/help/litehtmlhelpviewer.cpp
index f966c018f9..a9fca1a92b 100644
--- a/src/plugins/help/litehtmlhelpviewer.cpp
+++ b/src/plugins/help/litehtmlhelpviewer.cpp
@@ -16,6 +16,7 @@
#include <QGuiApplication>
#include <QScrollBar>
#include <QTimer>
+#include <QToolTip>
#include <QVBoxLayout>
#include <QWheelEvent>
@@ -100,6 +101,11 @@ LiteHtmlHelpViewer::LiteHtmlHelpViewer(QWidget *parent)
&QLiteHtmlWidget::contextMenuRequested,
this,
&LiteHtmlHelpViewer::showContextMenu);
+ connect(m_viewer, &QLiteHtmlWidget::linkHighlighted, this, [this](const QUrl &url) {
+ m_highlightedLink = url;
+ if (!url.isValid())
+ QToolTip::hideText();
+ });
auto layout = new QVBoxLayout;
setLayout(layout);
layout->setContentsMargins(0, 0, 0, 0);
@@ -284,6 +290,12 @@ bool LiteHtmlHelpViewer::eventFilter(QObject *src, QEvent *e)
goForward(1);
return true;
}
+ } else if (e->type() == QEvent::ToolTip) {
+ auto he = static_cast<QHelpEvent *>(e);
+ if (m_highlightedLink.isValid())
+ QToolTip::showText(he->globalPos(),
+ m_highlightedLink.toDisplayString(),
+ m_viewer->viewport());
}
return HelpViewer::eventFilter(src, e);
}
diff --git a/src/plugins/help/litehtmlhelpviewer.h b/src/plugins/help/litehtmlhelpviewer.h
index 5067f0a432..efd8245a01 100644
--- a/src/plugins/help/litehtmlhelpviewer.h
+++ b/src/plugins/help/litehtmlhelpviewer.h
@@ -4,11 +4,11 @@
#pragma once
#include "helpviewer.h"
-#include "openpagesmanager.h"
#include <qlitehtmlwidget.h>
#include <QTextBrowser>
+#include <QUrl>
#include <optional>
@@ -68,6 +68,7 @@ private:
QLiteHtmlWidget *m_viewer;
std::vector<HistoryItem> m_backItems;
std::vector<HistoryItem> m_forwardItems;
+ QUrl m_highlightedLink;
};
} // namespace Internal