forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -78,7 +78,6 @@ class TaskView : public Utils::ListView
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TaskView(QWidget *parent = nullptr);
|
TaskView(QWidget *parent = nullptr);
|
||||||
void setCurrentAndScrollTo(const QModelIndex &index);
|
|
||||||
~TaskView() override;
|
~TaskView() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -213,12 +212,6 @@ TaskView::TaskView(QWidget *parent)
|
|||||||
verticalScrollBar()->setSingleStep(vStepSize);
|
verticalScrollBar()->setSingleStep(vStepSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskView::setCurrentAndScrollTo(const QModelIndex &index)
|
|
||||||
{
|
|
||||||
scrollTo(index);
|
|
||||||
setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
TaskView::~TaskView() = default;
|
TaskView::~TaskView() = default;
|
||||||
|
|
||||||
void TaskView::resizeEvent(QResizeEvent *e)
|
void TaskView::resizeEvent(QResizeEvent *e)
|
||||||
@@ -482,6 +475,7 @@ void TaskWindow::currentChanged(const QModelIndex &index)
|
|||||||
ITaskHandler *h = d->handler(action);
|
ITaskHandler *h = d->handler(action);
|
||||||
action->setEnabled((task.isNull() || !h) ? false : h->canHandle(task));
|
action->setEnabled((task.isNull() || !h) ? false : h->canHandle(task));
|
||||||
}
|
}
|
||||||
|
d->m_listview->scrollTo(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskWindow::saveSettings()
|
void TaskWindow::saveSettings()
|
||||||
@@ -563,7 +557,7 @@ void TaskWindow::showTask(unsigned int id)
|
|||||||
int sourceRow = d->m_model->rowForId(id);
|
int sourceRow = d->m_model->rowForId(id);
|
||||||
QModelIndex sourceIdx = d->m_model->index(sourceRow, 0);
|
QModelIndex sourceIdx = d->m_model->index(sourceRow, 0);
|
||||||
QModelIndex filterIdx = d->m_filter->mapFromSource(sourceIdx);
|
QModelIndex filterIdx = d->m_filter->mapFromSource(sourceIdx);
|
||||||
d->m_listview->setCurrentAndScrollTo(filterIdx);
|
d->m_listview->setCurrentIndex(filterIdx);
|
||||||
popup(Core::IOutputPane::ModeSwitch);
|
popup(Core::IOutputPane::ModeSwitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -692,7 +686,7 @@ void TaskWindow::setFocus()
|
|||||||
if (d->m_filter->rowCount()) {
|
if (d->m_filter->rowCount()) {
|
||||||
d->m_listview->setFocus();
|
d->m_listview->setFocus();
|
||||||
if (d->m_listview->currentIndex() == QModelIndex())
|
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 {
|
} else {
|
||||||
currentIndex = d->m_filter->index(0, 0);
|
currentIndex = d->m_filter->index(0, 0);
|
||||||
}
|
}
|
||||||
d->m_listview->setCurrentAndScrollTo(currentIndex);
|
d->m_listview->setCurrentIndex(currentIndex);
|
||||||
triggerDefaultHandler(currentIndex);
|
triggerDefaultHandler(currentIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -748,7 +742,7 @@ void TaskWindow::goToPrev()
|
|||||||
} else {
|
} else {
|
||||||
currentIndex = d->m_filter->index(0, 0);
|
currentIndex = d->m_filter->index(0, 0);
|
||||||
}
|
}
|
||||||
d->m_listview->setCurrentAndScrollTo(currentIndex);
|
d->m_listview->setCurrentIndex(currentIndex);
|
||||||
triggerDefaultHandler(currentIndex);
|
triggerDefaultHandler(currentIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user