Clear the tree widget in the Structure tab when after closing a DB

Clear the tree widget in the 'Database Structure' tab of the main window
after closing a database.
See issue #44.
This commit is contained in:
Martin Kleusberg
2014-04-22 22:08:27 +02:00
parent f451beef0d
commit a7110ea0fc
3 changed files with 18 additions and 6 deletions

View File

@@ -125,6 +125,13 @@ void DbStructureModel::reloadData(DBBrowserDB* db)
rootItem->removeChild(rootItem->child(0));
}
// Return here if no DB is opened
if(!db->isOpen())
{
endResetModel();
return;
}
// Create the nodes for tables, indices, views and triggers
QMap<QString, QTreeWidgetItem*> typeToParentItem;
QTreeWidgetItem* itemTables = new QTreeWidgetItem(rootItem);