|
From: Tapio V. <aa...@us...> - 2011-02-02 11:26:16
|
Module: editor
Branch: master
Commit: c8880e040753f261b5ffb508af9569b07784ae51
Author: Tapio Vierros <tap...@gm...>
Date: Wed Feb 2 13:25:42 2011 +0200
Move overgrowing function out of header.
---
notelabel.cc | 14 ++++++++++++++
notelabel.hh | 18 +++++++-----------
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/notelabel.cc b/notelabel.cc
index cc6f7e7..031a0a2 100644
--- a/notelabel.cc
+++ b/notelabel.cc
@@ -88,6 +88,20 @@ void NoteLabel::createPixmap(QSize size)
updateNote();
}
+void NoteLabel::setSelected(bool state) {
+ if (m_selected != state) {
+ m_selected = state; createPixmap(size());
+ if (!m_selected) {
+ if (nextSelected) nextSelected->prevSelected = prevSelected;
+ if (prevSelected) prevSelected->nextSelected = nextSelected;
+ nextSelected = NULL;
+ prevSelected = NULL;
+ startResizing(0); // Reset
+ startDragging(QPoint()); // Reset
+ }
+ }
+}
+
void NoteLabel::resizeEvent(QResizeEvent *event)
{
createPixmap(event->size());
diff --git a/notelabel.hh b/notelabel.hh
index efb0c1d..2036f97 100644
--- a/notelabel.hh
+++ b/notelabel.hh
@@ -18,18 +18,14 @@ public:
QString lyric() const { return m_note.syllable; }
void setLyric(const QString &text) { m_note.syllable = text; createPixmap(size()); }
+ /**
+ * This function handles note selecting and deselecting.
+ * Upon deselecting, clean-up is done and item is removed
+ * from the selection list.
+ * This function does not add new entry to selection list.
+ */
+ void setSelected(bool state = true);
bool isSelected() const { return m_selected; }
- void setSelected(bool state = true) {
- if (m_selected != state) {
- m_selected = state; createPixmap(size());
- if (!m_selected) {
- if (nextSelected) nextSelected->prevSelected = prevSelected;
- if (prevSelected) prevSelected->nextSelected = nextSelected;
- nextSelected = NULL;
- prevSelected = NULL;
- }
- }
- }
Note& note() { return m_note; }
Note note() const { return m_note; }
|