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)
{
if (visible) {
if (m_wasVisibleBefore)
if (visible == m_wasVisibleBefore)
return;
if (visible) {
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()