fiix bug, rowMapping werd niet gecleared
+ formatting
This commit is contained in:
parent
aea49688d8
commit
04a4e3b374
1 changed files with 4 additions and 2 deletions
|
|
@ -181,7 +181,8 @@ QVariant CrudModel::data(const QModelIndex &index, int role) const
|
||||||
if (role == Qt::EditRole || role == Qt::DisplayRole)
|
if (role == Qt::EditRole || role == Qt::DisplayRole)
|
||||||
{
|
{
|
||||||
auto value = getLatestData(index);
|
auto value = getLatestData(index);
|
||||||
if (value) {
|
if (value)
|
||||||
|
{
|
||||||
if (role == Qt::EditRole)
|
if (role == Qt::EditRole)
|
||||||
return QString::fromUtf8(value->c_str());
|
return QString::fromUtf8(value->c_str());
|
||||||
else
|
else
|
||||||
|
|
@ -213,7 +214,7 @@ void CrudModel::loadData()
|
||||||
{
|
{
|
||||||
QString table_name = m_table->fullyQualifiedQuotedObjectName();
|
QString table_name = m_table->fullyQualifiedQuotedObjectName();
|
||||||
std::string q = "SELECT * FROM ";
|
std::string q = "SELECT * FROM ";
|
||||||
q += std::string(table_name.toUtf8().data());
|
q += table_name.toStdString();
|
||||||
m_dbConn.send(q, [this] (Expected<std::shared_ptr<Pgsql::Result>> res, qint64)
|
m_dbConn.send(q, [this] (Expected<std::shared_ptr<Pgsql::Result>> res, qint64)
|
||||||
{
|
{
|
||||||
if (res.valid())
|
if (res.valid())
|
||||||
|
|
@ -240,6 +241,7 @@ void CrudModel::loadIntoModel(std::shared_ptr<Pgsql::Result> data)
|
||||||
void CrudModel::initRowMapping()
|
void CrudModel::initRowMapping()
|
||||||
{
|
{
|
||||||
size_t cnt = m_roData->rows();
|
size_t cnt = m_roData->rows();
|
||||||
|
m_rowMapping.clear();
|
||||||
m_rowMapping.reserve(cnt + 1);
|
m_rowMapping.reserve(cnt + 1);
|
||||||
for (int i = 0; i < cnt; ++i)
|
for (int i = 0; i < cnt; ++i)
|
||||||
m_rowMapping.emplace_back(i);
|
m_rowMapping.emplace_back(i);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue