diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2021-03-31 17:34:33 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2021-04-07 10:02:36 +0000 |
commit | de072785cdb53877b1b4c1f64ffffd992f4ec689 (patch) | |
tree | 39ca1fa9fb1ba8ce34151767dbc86d4d85aec398 /src/plugins/projectexplorer/taskwindow.cpp | |
parent | 821551827937f3e0764eff32a4235b3aaf07ee22 (diff) | |
download | qt-creator-de072785cdb53877b1b4c1f64ffffd992f4ec689.tar.gz |
ProjectExplorer: Make sure we always scroll to the new current item
... in the issues pane.
When fixing another issue, we accidentally lost auto-scrolling for cursor
key navigation.
Amends 74b773e68f.
Fixes: QTCREATORBUG-25432
Change-Id: I67f9a9b198276ce38a19862dc66000ced6a9a6fa
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/taskwindow.cpp')
-rw-r--r-- | src/plugins/projectexplorer/taskwindow.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index 6701ebbf84..26b147c0d3 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -78,7 +78,6 @@ class TaskView : public Utils::ListView { public: TaskView(QWidget *parent = nullptr); - void setCurrentAndScrollTo(const QModelIndex &index); ~TaskView() override; private: @@ -213,12 +212,6 @@ TaskView::TaskView(QWidget *parent) verticalScrollBar()->setSingleStep(vStepSize); } -void TaskView::setCurrentAndScrollTo(const QModelIndex &index) -{ - scrollTo(index); - setCurrentIndex(index); -} - TaskView::~TaskView() = default; void TaskView::resizeEvent(QResizeEvent *e) @@ -482,6 +475,7 @@ void TaskWindow::currentChanged(const QModelIndex &index) ITaskHandler *h = d->handler(action); action->setEnabled((task.isNull() || !h) ? false : h->canHandle(task)); } + d->m_listview->scrollTo(index); } void TaskWindow::saveSettings() @@ -563,7 +557,7 @@ void TaskWindow::showTask(unsigned int id) int sourceRow = d->m_model->rowForId(id); QModelIndex sourceIdx = d->m_model->index(sourceRow, 0); QModelIndex filterIdx = d->m_filter->mapFromSource(sourceIdx); - d->m_listview->setCurrentAndScrollTo(filterIdx); + d->m_listview->setCurrentIndex(filterIdx); popup(Core::IOutputPane::ModeSwitch); } @@ -692,7 +686,7 @@ void TaskWindow::setFocus() if (d->m_filter->rowCount()) { d->m_listview->setFocus(); if (d->m_listview->currentIndex() == QModelIndex()) - d->m_listview->setCurrentAndScrollTo(d->m_filter->index(0,0, QModelIndex())); + d->m_listview->setCurrentIndex(d->m_filter->index(0,0, QModelIndex())); } } @@ -725,7 +719,7 @@ void TaskWindow::goToNext() } else { currentIndex = d->m_filter->index(0, 0); } - d->m_listview->setCurrentAndScrollTo(currentIndex); + d->m_listview->setCurrentIndex(currentIndex); triggerDefaultHandler(currentIndex); } @@ -748,7 +742,7 @@ void TaskWindow::goToPrev() } else { currentIndex = d->m_filter->index(0, 0); } - d->m_listview->setCurrentAndScrollTo(currentIndex); + d->m_listview->setCurrentIndex(currentIndex); triggerDefaultHandler(currentIndex); } |