diff options
| author | Mike Skec <skec@protonmail.ch> | 2021-01-03 11:06:13 +1100 |
|---|---|---|
| committer | Felix Queißner <felix@ib-queissner.de> | 2021-01-04 11:06:26 +0100 |
| commit | f93bc413e9325750c8d41a465090058386518cfc (patch) | |
| tree | 51fc2647c171df9ad9b8039a6c454c1cd70e2035 /src/widgets/kristalltextbrowser.cpp | |
| parent | 7fe5c148ff4083c3938f145a53f00f643985659b (diff) | |
| download | kristall-f93bc413e9325750c8d41a465090058386518cfc.tar.gz | |
Added 'busy' cursor while current tab is loading
Diffstat (limited to 'src/widgets/kristalltextbrowser.cpp')
| -rw-r--r-- | src/widgets/kristalltextbrowser.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
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; +} |
