Simplify TestResultsPane::visibilityChanged

Change-Id: Ie278384bb0fe899989a01a0ad89455b11059787f
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
Robert Loehning
2015-05-29 13:45:35 +02:00
parent 21afdf227a
commit f092ad0a2e

View File

@@ -185,23 +185,20 @@ void TestResultsPane::clearContents()
void TestResultsPane::visibilityChanged(bool visible) void TestResultsPane::visibilityChanged(bool visible)
{ {
if (visible == m_wasVisibleBefore)
return;
if (visible) { if (visible) {
if (m_wasVisibleBefore)
return;
connect(TestTreeModel::instance(), &TestTreeModel::testTreeModelChanged, connect(TestTreeModel::instance(), &TestTreeModel::testTreeModelChanged,
this, &TestResultsPane::onTestTreeModelChanged); this, &TestResultsPane::onTestTreeModelChanged);
// make sure run/run all are in correct state // make sure run/run all are in correct state
onTestTreeModelChanged(); onTestTreeModelChanged();
m_wasVisibleBefore = true;
TestTreeModel::instance()->enableParsing(); TestTreeModel::instance()->enableParsing();
} else { } else {
if (!m_wasVisibleBefore)
return;
disconnect(TestTreeModel::instance(), &TestTreeModel::testTreeModelChanged, disconnect(TestTreeModel::instance(), &TestTreeModel::testTreeModelChanged,
this, &TestResultsPane::onTestTreeModelChanged); this, &TestResultsPane::onTestTreeModelChanged);
m_wasVisibleBefore = false;
TestTreeModel::instance()->disableParsing(); TestTreeModel::instance()->disableParsing();
} }
m_wasVisibleBefore = visible;
} }
void TestResultsPane::setFocus() void TestResultsPane::setFocus()