Todo: Fix goToNext/Prev behavior

* Select whole row
* Jump to related location

Change-Id: I5b63345eea9a0d51949f206c67fb6ae52f09bb27
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Orgad Shaneh
2013-12-03 11:01:46 +02:00
committed by Orgad Shaneh
parent 25389fcc25
commit 6f6e09211c
2 changed files with 9 additions and 2 deletions

View File

@@ -123,12 +123,18 @@ bool TodoOutputPane::canPrevious() const
void TodoOutputPane::goToNext() void TodoOutputPane::goToNext()
{ {
m_todoTreeView->selectionModel()->select(nextModelIndex(), QItemSelectionModel::SelectCurrent); const QModelIndex nextIndex = nextModelIndex();
m_todoTreeView->selectionModel()->setCurrentIndex(nextIndex, QItemSelectionModel::SelectCurrent
| QItemSelectionModel::Rows);
todoTreeViewClicked(nextIndex);
} }
void TodoOutputPane::goToPrev() void TodoOutputPane::goToPrev()
{ {
m_todoTreeView->selectionModel()->select(previousModelIndex(), QItemSelectionModel::SelectCurrent); const QModelIndex prevIndex = previousModelIndex();
m_todoTreeView->selectionModel()->setCurrentIndex(prevIndex, QItemSelectionModel::SelectCurrent
| QItemSelectionModel::Rows);
todoTreeViewClicked(prevIndex);
} }
void TodoOutputPane::setScanningScope(ScanningScope scanningScope) void TodoOutputPane::setScanningScope(ScanningScope scanningScope)

View File

@@ -48,6 +48,7 @@ TodoOutputTreeView::TodoOutputTreeView(QWidget *parent) :
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);
setSortingEnabled(true); setSortingEnabled(true);
setAttribute(Qt::WA_MacShowFocusRect, false); setAttribute(Qt::WA_MacShowFocusRect, false);
setSelectionBehavior(QTreeView::SelectRows);
header()->setResizeMode(QHeaderView::Interactive); header()->setResizeMode(QHeaderView::Interactive);
header()->setStretchLastSection(true); header()->setStretchLastSection(true);