Sort db objects in Database Structure tab by their name

This commit is contained in:
Martin Kleusberg
2014-02-14 16:12:09 +01:00
parent 2552249cf8
commit 393a58be73

View File

@@ -144,8 +144,13 @@ void DbStructureModel::reloadData(DBBrowserDB* db)
itemTriggers->setText(0, tr("Triggers (%1)").arg(db->objMap.values("trigger").count()));
typeToParentItem.insert("trigger", itemTriggers);
// Add the actual table objects
// Get all database objects and sort them by their name
QMultiMap<QString, DBBrowserObject> dbobjs;
for(objectMap::ConstIterator it=db->objMap.begin(); it != db->objMap.end(); ++it)
dbobjs.insert((*it).getname(), (*it));
// Add the actual table objects
for(QMultiMap<QString, DBBrowserObject>::ConstIterator it=dbobjs.begin(); it != dbobjs.end(); ++it)
{
// Object node
QTreeWidgetItem *tableItem = new QTreeWidgetItem(typeToParentItem.value((*it).gettype()));