From 91049b235a4e61e37ff03be7041ea437b75c91d8 Mon Sep 17 00:00:00 2001 From: eelke Date: Sun, 1 Sep 2019 06:48:11 +0200 Subject: [PATCH] Send InsertRows signals when adding a group. --- pglab/ConnectionListModel.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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);