From 04a4e3b3741aef610bbfd5d0bc39442948712aa6 Mon Sep 17 00:00:00 2001 From: eelke Date: Sun, 10 Apr 2022 06:53:02 +0200 Subject: [PATCH] fiix bug, rowMapping werd niet gecleared + formatting --- pglab/crud/CrudModel.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pglab/crud/CrudModel.cpp b/pglab/crud/CrudModel.cpp index 007e471..188711f 100644 --- a/pglab/crud/CrudModel.cpp +++ b/pglab/crud/CrudModel.cpp @@ -181,7 +181,8 @@ QVariant CrudModel::data(const QModelIndex &index, int role) const if (role == Qt::EditRole || role == Qt::DisplayRole) { auto value = getLatestData(index); - if (value) { + if (value) + { if (role == Qt::EditRole) return QString::fromUtf8(value->c_str()); else @@ -213,7 +214,7 @@ void CrudModel::loadData() { QString table_name = m_table->fullyQualifiedQuotedObjectName(); std::string q = "SELECT * FROM "; - q += std::string(table_name.toUtf8().data()); + q += table_name.toStdString(); m_dbConn.send(q, [this] (Expected> res, qint64) { if (res.valid()) @@ -240,6 +241,7 @@ void CrudModel::loadIntoModel(std::shared_ptr data) void CrudModel::initRowMapping() { size_t cnt = m_roData->rows(); + m_rowMapping.clear(); m_rowMapping.reserve(cnt + 1); for (int i = 0; i < cnt; ++i) m_rowMapping.emplace_back(i);