forked from qt-creator/qt-creator
Git: Fix checking out a branch after adding it
Fallout from a9ac438ad8
.
Change-Id: I07b36dd1bc5e9fb63f7d4552d9cb6ccd7ea2e22d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
3bf3d7cc33
commit
e38c8724e4
@@ -314,14 +314,16 @@ bool BranchView::add()
|
|||||||
branchAddDialog.setTrackedBranchName(isTag ? QString() : trackedBranch, !isLocal);
|
branchAddDialog.setTrackedBranchName(isTag ? QString() : trackedBranch, !isLocal);
|
||||||
|
|
||||||
if (branchAddDialog.exec() == QDialog::Accepted) {
|
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())
|
if (!idx.isValid())
|
||||||
return false;
|
return false;
|
||||||
|
QModelIndex mappedIdx = m_filterModel->mapFromSource(idx);
|
||||||
QTC_ASSERT(m_branchView, return false);
|
QTC_ASSERT(m_branchView, return false);
|
||||||
m_branchView->selectionModel()->select(idx, QItemSelectionModel::Clear
|
m_branchView->selectionModel()->select(mappedIdx, QItemSelectionModel::Clear
|
||||||
| QItemSelectionModel::Select
|
| QItemSelectionModel::Select
|
||||||
| QItemSelectionModel::Current);
|
| QItemSelectionModel::Current);
|
||||||
m_branchView->scrollTo(idx);
|
m_branchView->scrollTo(mappedIdx);
|
||||||
if (QMessageBox::question(this, tr("Checkout"), tr("Checkout branch?"),
|
if (QMessageBox::question(this, tr("Checkout"), tr("Checkout branch?"),
|
||||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||||
return checkout();
|
return checkout();
|
||||||
|
Reference in New Issue
Block a user