diff --git a/src/plugins/git/branchview.cpp b/src/plugins/git/branchview.cpp index 0328d5aefc7..b0c97935050 100644 --- a/src/plugins/git/branchview.cpp +++ b/src/plugins/git/branchview.cpp @@ -164,6 +164,11 @@ void BranchView::refresh(const QString &repository, bool force) m_addButton->setToolTip(tr("Add Branch...")); m_branchView->setEnabled(true); } + + // Do not refresh the model when the view is hidden + if (!isVisible()) + return; + QString errorMessage; if (!m_model->refresh(m_repository, &errorMessage)) VcsBase::VcsOutputWindow::appendError(errorMessage); @@ -174,6 +179,11 @@ void BranchView::refreshCurrentBranch() m_model->refreshCurrentBranch(); } +void BranchView::showEvent(QShowEvent *) +{ + refreshCurrentRepository(); +} + QToolButton *BranchView::addButton() const { return m_addButton; diff --git a/src/plugins/git/branchview.h b/src/plugins/git/branchview.h index faceea2ef57..a02bfa2567f 100644 --- a/src/plugins/git/branchview.h +++ b/src/plugins/git/branchview.h @@ -65,6 +65,9 @@ public: QAction *m_includeOldEntriesAction = nullptr; QAction *m_includeTagsAction = nullptr; +protected: + void showEvent(QShowEvent *) override; + private: void refreshCurrentRepository(); void resizeColumns();