|
From: Tapio V. <aa...@us...> - 2011-02-24 09:16:50
|
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 24 11:16:02 2011 +0200
NoteLabel tip handling tweaks.
---
notelabel.cc | 14 ++++++++------
notelabel.hh | 2 ++
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/notelabel.cc b/notelabel.cc
index 7292613..cc5f79e 100644
--- a/notelabel.cc
+++ b/notelabel.cc
@@ -75,8 +75,7 @@ void NoteLabel::createPixmap()
}
setPixmap(QPixmap::fromImage(image));
-
- setStatusTip(tr("Lyric: ") + lyric());
+ updateTips();
}
void NoteLabel::setSelected(bool state) {
@@ -89,10 +88,9 @@ void NoteLabel::setSelected(bool state) {
}
}
-void NoteLabel::resizeEvent(QResizeEvent *)
-{
- createPixmap();
-}
+void NoteLabel::resizeEvent(QResizeEvent *) { createPixmap(); }
+
+void NoteLabel::moveEvent(QMoveEvent *) { updateTips(); }
void NoteLabel::mouseMoveEvent(QMouseEvent *event)
{
@@ -164,6 +162,10 @@ void NoteLabel::updateLabel()
resize(ngw->s2px(m_note.length()), height());
move(ngw->s2px(m_note.begin), ngw->n2px(m_note.note) - height() / 2);
}
+}
+
+void NoteLabel::updateTips()
+{
setToolTip(description(true));
setStatusTip(description(false));
setWhatsThis(description(true));
diff --git a/notelabel.hh b/notelabel.hh
index ff86e7d..7f4a139 100644
--- a/notelabel.hh
+++ b/notelabel.hh
@@ -26,6 +26,7 @@ public:
Note& note() { return m_note; }
Note note() const { return m_note; }
void updateLabel();
+ void updateTips();
bool isFloating() const { return m_floating; }
void setFloating(bool state) { m_floating = state; createPixmap(); }
@@ -43,6 +44,7 @@ public:
protected:
void resizeEvent(QResizeEvent *event);
+ void moveEvent(QMoveEvent *event);
void mouseMoveEvent(QMouseEvent *event);
private:
|