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);