From 2bc736a4f757d99e31da5a43df7a05e9c821075e Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Mon, 26 Oct 2020 12:04:16 +0100 Subject: [PATCH] Git: Do not refresh branch view when hidden Change-Id: Ia2e327b6396657255f9b40b792d794a647fc5745 Reviewed-by: Orgad Shaneh --- src/plugins/git/branchview.cpp | 10 ++++++++++ src/plugins/git/branchview.h | 3 +++ 2 files changed, 13 insertions(+) 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();