From f93bc413e9325750c8d41a465090058386518cfc Mon Sep 17 00:00:00 2001 From: Mike Skec Date: Sun, 3 Jan 2021 11:06:13 +1100 Subject: Added 'busy' cursor while current tab is loading --- src/widgets/kristalltextbrowser.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/widgets/kristalltextbrowser.cpp') diff --git a/src/widgets/kristalltextbrowser.cpp b/src/widgets/kristalltextbrowser.cpp index c813b05..f94485e 100644 --- a/src/widgets/kristalltextbrowser.cpp +++ b/src/widgets/kristalltextbrowser.cpp @@ -28,7 +28,27 @@ void KristallTextBrowser::mouseReleaseEvent(QMouseEvent *event) } } +void KristallTextBrowser::mouseMoveEvent(QMouseEvent *event) +{ + QTextBrowser::mouseMoveEvent(event); + + // This slight hack allows us to set the "default" cursor, + // (i.e when not hovering over links) We need to do this + // because QTextBrowser for some reason resets viewport cursor + // to ArrowCursor after we hover over links + const QCursor& cur = this->viewport()->cursor(); + if (cur != this->wanted_cursor && cur != Qt::PointingHandCursor) + { + this->viewport()->setCursor(wanted_cursor); + } +} + void KristallTextBrowser::on_anchorClicked(const QUrl &url) { emit this->anchorClicked(url, this->signal_new_tab); } + +void KristallTextBrowser::setDefaultCursor(const QCursor &cur) +{ + this->wanted_cursor = cur; +} -- cgit v1.2.3