diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2018-11-14 17:02:19 +0200 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2018-11-15 09:46:07 +0000 |
commit | e38c8724e468d283778ed538c3ecbb12607a05ed (patch) | |
tree | 898ffb4f620068bd678066309541bc03b4565886 /src/plugins/git/branchview.cpp | |
parent | 3bf3d7cc3382e84c31b7d12b06b3d0f9c0bea83b (diff) | |
download | qt-creator-e38c8724e468d283778ed538c3ecbb12607a05ed.tar.gz |
Git: Fix checking out a branch after adding it
Fallout from a9ac438ad8e8aa710810133802636aa82f6c821f.
Change-Id: I07b36dd1bc5e9fb63f7d4552d9cb6ccd7ea2e22d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/git/branchview.cpp')
-rw-r--r-- | src/plugins/git/branchview.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/git/branchview.cpp b/src/plugins/git/branchview.cpp index 4e17f31686..4cabc58077 100644 --- a/src/plugins/git/branchview.cpp +++ b/src/plugins/git/branchview.cpp @@ -314,14 +314,16 @@ bool BranchView::add() branchAddDialog.setTrackedBranchName(isTag ? QString() : trackedBranch, !isLocal); if (branchAddDialog.exec() == QDialog::Accepted) { - QModelIndex idx = m_model->addBranch(branchAddDialog.branchName(), branchAddDialog.track(), trackedIndex); + QModelIndex idx = m_model->addBranch(branchAddDialog.branchName(), branchAddDialog.track(), + trackedIndex); if (!idx.isValid()) return false; + QModelIndex mappedIdx = m_filterModel->mapFromSource(idx); QTC_ASSERT(m_branchView, return false); - m_branchView->selectionModel()->select(idx, QItemSelectionModel::Clear + m_branchView->selectionModel()->select(mappedIdx, QItemSelectionModel::Clear | QItemSelectionModel::Select | QItemSelectionModel::Current); - m_branchView->scrollTo(idx); + m_branchView->scrollTo(mappedIdx); if (QMessageBox::question(this, tr("Checkout"), tr("Checkout branch?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { return checkout(); |