From f092ad0a2ef4e7c6b8230a5289c25725ff47bcdd Mon Sep 17 00:00:00 2001
From: Robert Loehning <robert.loehning@theqtcompany.com>
Date: Fri, 29 May 2015 13:45:35 +0200
Subject: [PATCH] Simplify TestResultsPane::visibilityChanged

Change-Id: Ie278384bb0fe899989a01a0ad89455b11059787f
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
---
 plugins/autotest/testresultspane.cpp | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/plugins/autotest/testresultspane.cpp b/plugins/autotest/testresultspane.cpp
index 3d9e874bdf5..0d6b9052b84 100644
--- a/plugins/autotest/testresultspane.cpp
+++ b/plugins/autotest/testresultspane.cpp
@@ -185,23 +185,20 @@ void TestResultsPane::clearContents()
 
 void TestResultsPane::visibilityChanged(bool visible)
 {
+    if (visible == m_wasVisibleBefore)
+        return;
     if (visible) {
-        if (m_wasVisibleBefore)
-            return;
         connect(TestTreeModel::instance(), &TestTreeModel::testTreeModelChanged,
                 this, &TestResultsPane::onTestTreeModelChanged);
         // make sure run/run all are in correct state
         onTestTreeModelChanged();
-        m_wasVisibleBefore = true;
         TestTreeModel::instance()->enableParsing();
     } else {
-        if (!m_wasVisibleBefore)
-            return;
         disconnect(TestTreeModel::instance(), &TestTreeModel::testTreeModelChanged,
                    this, &TestResultsPane::onTestTreeModelChanged);
-        m_wasVisibleBefore = false;
         TestTreeModel::instance()->disableParsing();
     }
+    m_wasVisibleBefore = visible;
 }
 
 void TestResultsPane::setFocus()
-- 
GitLab