diff --git a/pglab/ConnectionListModel.cpp b/pglab/ConnectionListModel.cpp index bad449b..e3bff93 100644 --- a/pglab/ConnectionListModel.cpp +++ b/pglab/ConnectionListModel.cpp @@ -725,7 +725,17 @@ std::variant ConnectionTreeModel::addGroup(QString group_name) auto err = q.lastError(); return { err }; } - return q.lastInsertId().toInt(); + auto cg = std::make_shared(); + cg->conngroup_id = q.lastInsertId().toInt(); + cg->name = group_name; + + int row = m_groups.size(); + beginInsertRows({}, row, row); + SCOPE_EXIT { endInsertRows(); }; + m_groups.push_back(cg); + return row; +} + std::optional ConnectionTreeModel::removeGroup(int row) { beginRemoveRows({}, row, row);