From 1f400782f7aa999fdd81bf25b315eb24c28530ff Mon Sep 17 00:00:00 2001 From: Mike Skec Date: Wed, 6 Jan 2021 19:54:27 +1100 Subject: Fix busy cursor bugs fixes A: busy cursor not resetting when changing workspaces. and B: busy cursor not resetting after page finishes loading, and cursor is left stationary. --- src/widgets/kristalltextbrowser.cpp | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'src/widgets/kristalltextbrowser.cpp') diff --git a/src/widgets/kristalltextbrowser.cpp b/src/widgets/kristalltextbrowser.cpp index b92bf0f..8f5b86a 100644 --- a/src/widgets/kristalltextbrowser.cpp +++ b/src/widgets/kristalltextbrowser.cpp @@ -28,10 +28,32 @@ void KristallTextBrowser::mouseReleaseEvent(QMouseEvent *event) } } +void KristallTextBrowser::on_anchorClicked(const QUrl &url) +{ + emit this->anchorClicked(url, this->signal_new_tab); +} + + void KristallTextBrowser::mouseMoveEvent(QMouseEvent *event) { QTextBrowser::mouseMoveEvent(event); + this->updateCursor(); +} + +void KristallTextBrowser::setDefaultCursor(const QCursor &cur) +{ + this->wanted_cursor = cur; + this->updateCursor(); +} + +void KristallTextBrowser::focusInEvent(QFocusEvent *event) +{ + QTextBrowser::focusInEvent(event); + this->updateCursor(); +} +void KristallTextBrowser::updateCursor() +{ // 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 @@ -43,13 +65,3 @@ void KristallTextBrowser::mouseMoveEvent(QMouseEvent *event) 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