Skip to content


Show attached databases in the UI
Browse files Browse the repository at this point in the history
Commits 532fcd3,
44eb2d4, and
ea1659e along with some smaller ones
prepared our code for properly handling schemata other than "main".
While working for any schema, they only exposed this funtionality for
the "temp" schema. But with these preparations in place it's easy to add
all known schemata to the UI and enable (almost) all features we have
for them. This is done by this commit, adding all attached databases to
the UI.
  • Loading branch information
MKleusberg committed Sep 4, 2017
1 parent ea1659e commit a5ca756
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/DbStructureModel.cpp
Expand Up @@ -148,12 +148,13 @@ void DbStructureModel::reloadData()
browsablesRootItem->setIcon(ColumnName, QIcon(QString(":/icons/view")));
browsablesRootItem->setText(ColumnName, tr("Browsables"));

// Make sure to always load the main schema first
QTreeWidgetItem* itemAll = new QTreeWidgetItem(rootItem);
itemAll->setIcon(ColumnName, QIcon(QString(":/icons/database")));
itemAll->setText(ColumnName, tr("All"));
buildTree(itemAll, "main");

// Add the temporary database as a node if it isn't empty
// Add the temporary database as a node if it isn't empty. Make sure it's always second if it exists.
QTreeWidgetItem* itemTemp = new QTreeWidgetItem(itemAll);
Expand All @@ -162,6 +163,19 @@ void DbStructureModel::reloadData()
buildTree(itemTemp, "temp");

// Now load all the other schemata last
for(auto it=m_db.schemata.constBegin();it!=m_db.schemata.constEnd();++it)
// Don't load the main and temp schema again
if(it.key() != "main" && it.key() != "temp")
QTreeWidgetItem* itemSchema = new QTreeWidgetItem(itemAll);
itemSchema->setIcon(ColumnName, QIcon(QString(":/icons/database")));
itemSchema->setText(ColumnName, it.key());
buildTree(itemSchema, it.key());

// Refresh the view
Expand Down

0 comments on commit a5ca756

Please sign in to comment.