|
From: Tapio V. <aa...@us...> - 2011-01-07 12:42:51
|
Module: editor
Branch: master
Commit: c683dce0d1bfa152b555a4ff6cb0bf3b034d1be7
Author: Tapio Vierros <tap...@gm...>
Date: Fri Jan 7 13:29:25 2011 +0200
Insta-tooltips for notes.
---
notelabel.cc | 7 +++++++
notelabel.hh | 1 +
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/notelabel.cc b/notelabel.cc
index 5839880..a47ee73 100644
--- a/notelabel.cc
+++ b/notelabel.cc
@@ -11,7 +11,9 @@ NoteLabel::NoteLabel(const QString &text, QWidget *parent, const QPoint &positio
createPixmap();
if (!position.isNull())
move(position);
+
show();
+ setMouseTracking(true);
setAttribute(Qt::WA_DeleteOnClose);
}
@@ -77,3 +79,8 @@ void NoteLabel::resizeEvent(QResizeEvent *event)
{
createPixmap(event->size());
}
+
+void NoteLabel::mouseMoveEvent(QMouseEvent *event)
+{
+ QToolTip::showText(event->globalPos(), getText(), this);
+}
diff --git a/notelabel.hh b/notelabel.hh
index ad48457..5147685 100644
--- a/notelabel.hh
+++ b/notelabel.hh
@@ -15,6 +15,7 @@ public:
void disableFloating() { m_floating = false; }
void resizeEvent(QResizeEvent *event);
+ void mouseMoveEvent(QMouseEvent *event);
bool operator<(const NoteLabel &rhs) const { return x() < rhs.x(); }
|