aboutsummaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kristalltextbrowser.cpp32
-rw-r--r--src/widgets/kristalltextbrowser.hpp5
2 files changed, 27 insertions, 10 deletions
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;
-}
diff --git a/src/widgets/kristalltextbrowser.hpp b/src/widgets/kristalltextbrowser.hpp
index cf0101a..f5b4f95 100644
--- a/src/widgets/kristalltextbrowser.hpp
+++ b/src/widgets/kristalltextbrowser.hpp
@@ -14,6 +14,8 @@ public:
void mouseMoveEvent(QMouseEvent * event) override;
+ void focusInEvent(QFocusEvent * event) override;
+
void setDefaultCursor(QCursor const & shape);
signals:
@@ -23,6 +25,9 @@ private: // slots
void on_anchorClicked(QUrl const & url);
private:
+ void updateCursor();
+
+private:
bool signal_new_tab = false;
QCursor wanted_cursor;
};