|
From: Tapio V. <aa...@us...> - 2011-02-22 13:01:07
|
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 22 14:11:06 2011 +0200
Show time and note of mouse cursor position at status bar.
---
editorapp.cc | 6 ++++++
editorapp.hh | 1 +
notegraphwidget.cc | 2 ++
notegraphwidget.hh | 1 +
4 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index 366a290..1a6a054 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -133,6 +133,7 @@ void EditorApp::setupNoteGraph()
// Signals/slots
connect(noteGraph, SIGNAL(operationDone(const Operation&)), this, SLOT(operationDone(const Operation&)));
connect(noteGraph, SIGNAL(updateNoteInfo(NoteLabel*)), this, SLOT(updateNoteInfo(NoteLabel*)));
+ connect(noteGraph, SIGNAL(statusBarMessage(QString)), this, SLOT(statusBarMessage(QString)));
connect(statusbarButton, SIGNAL(clicked()), noteGraph, SLOT(abortPitch()));
connect(ui.noteGraphScroller->horizontalScrollBar(), SIGNAL(valueChanged(int)), noteGraph, SLOT(updatePitch()));
connect(ui.noteGraphScroller->verticalScrollBar(), SIGNAL(valueChanged(int)), noteGraph, SLOT(updatePitch()));
@@ -162,6 +163,11 @@ void EditorApp::operationDone(const Operation &op)
redoStack.clear();
}
+void EditorApp::statusBarMessage(const QString& message)
+{
+ statusBar()->showMessage(message);
+}
+
void EditorApp::doOpStack()
{
BusyDialog busy(this);
diff --git a/editorapp.hh b/editorapp.hh
index 34a063e..99f528e 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -60,6 +60,7 @@ public slots:
void metaDataChanged();
void audioTick(qint64 time);
void playerStateChanged(Phonon::State newstate, Phonon::State olstate);
+ void statusBarMessage(const QString& message);
// Automatic slots
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 039419c..737dc52 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -43,6 +43,7 @@ NoteGraphWidget::NoteGraphWidget(QWidget *parent)
setFocusPolicy(Qt::StrongFocus);
setAcceptDrops(true);
+ setMouseTracking(true);
setWhatsThis(tr("Note graph that displays the song notes and allows you to manipulate them."));
// Context menu
@@ -503,6 +504,7 @@ void NoteGraphWidget::mouseMoveEvent(QMouseEvent *event)
}
}
+ emit statusBarMessage(QString("Time: %1 s, note: %2").arg(px2s(event->x())).arg(round(px2n(event->y()))));
emit updateNoteInfo(selectedNote());
}
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index a36d690..e587d3a 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -72,6 +72,7 @@ public:
signals:
void updateNoteInfo(NoteLabel*);
void operationDone(const Operation&);
+ void statusBarMessage(QString);
public slots:
void selectNextSyllable(bool backwards = false, bool addToSelection = false);
|