Mercurial > hg > svgui
changeset 402:66e01a6c9554
* start play-tracking toggle in data editor dialog
author | Chris Cannam |
---|---|
date | Tue, 17 Jun 2008 16:24:50 +0000 |
parents | 96531861b2f3 |
children | dc32f6e7839b |
files | widgets/ModelDataTableDialog.cpp widgets/ModelDataTableDialog.h |
diffstat | 2 files changed, 19 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/widgets/ModelDataTableDialog.cpp Tue Jun 17 16:07:56 2008 +0000 +++ b/widgets/ModelDataTableDialog.cpp Tue Jun 17 16:24:50 2008 +0000 @@ -45,7 +45,15 @@ IconLoader il; - QAction *action = new QAction(il.load("datainsert"), tr("Insert New Item"), this); + QAction *action = new QAction(il.load("playfollow"), tr("Track Playback"), this); + action->setStatusTip(tr("Toggle tracking of playback position")); + action->setCheckable(true); + connect(action, SIGNAL(triggered()), this, SLOT(togglePlayTracking())); + toolbar->addAction(action); + + CommandHistory::getInstance()->registerToolbar(toolbar); + + action = new QAction(il.load("datainsert"), tr("Insert New Item"), this); action->setShortcut(tr("Insert")); action->setStatusTip(tr("Insert a new item")); connect(action, SIGNAL(triggered()), this, SLOT(insertRow())); @@ -63,8 +71,6 @@ connect(action, SIGNAL(triggered()), this, SLOT(editRow())); toolbar->addAction(action); - CommandHistory::getInstance()->registerToolbar(toolbar); - QFrame *mainFrame = new QFrame; setCentralWidget(mainFrame); @@ -157,6 +163,9 @@ int rh = m_tableView->height() / m_tableView->rowHeight(0); int topRow = row - rh/2; if (topRow < 0) topRow = 0; + //!!! should not do any of this if an item in the given row is + //already current; should not scroll if the current row is already + //visible m_tableView->scrollTo (m_table->getModelIndexForRow(topRow)); m_tableView->selectionModel()->setCurrentIndex @@ -216,6 +225,12 @@ } void +ModelDataTableDialog::togglePlayTracking() +{ + m_trackPlayback = !m_trackPlayback; +} + +void ModelDataTableDialog::currentChangedThroughResort(const QModelIndex &index) { std::cerr << "ModelDataTableDialog::currentChangedThroughResort: row = " << index.row() << std::endl;