summaryrefslogtreecommitdiff
path: root/src/plugins/help
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2022-11-07 12:59:28 +0100
committerEike Ziller <eike.ziller@qt.io>2022-11-07 12:59:28 +0100
commit63c1bc572a24a7ab38a616554f330eb4c5e8647d (patch)
tree81540efce5bb3eb6d69322f64dbe14d7554e0b5d /src/plugins/help
parentd891e18edc7864bdbff7cc0595c18add82c8c3f6 (diff)
parent176df5827e647c8bdd90d99755d2eeeea2fa4b5b (diff)
downloadqt-creator-63c1bc572a24a7ab38a616554f330eb4c5e8647d.tar.gz
Merge remote-tracking branch 'origin/9.0'
Change-Id: Ie24672b00aae6c0afa5931d87e6e1c24fb841161
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