Split up a few single-liners to help debug crash issue

This commit is contained in:
Rasmus Karlsson 2020-09-13 11:08:43 +02:00
parent 1baa2b266d
commit 7eabba959b

View file

@ -144,7 +144,11 @@ public:
Row &rowItem = this->rows_[row]; Row &rowItem = this->rows_[row];
rowItem.items[column]->setData(value, role); assert(this->columnCount_ == rowItem.items.size());
auto &cell = rowItem.items[column];
cell->setData(value, role);
if (rowItem.isCustomRow) if (rowItem.isCustomRow)
{ {
@ -211,7 +215,11 @@ public:
assert(row >= 0 && row < this->rows_.size() && column >= 0 && assert(row >= 0 && row < this->rows_.size() && column >= 0 &&
column < this->columnCount_); column < this->columnCount_);
return this->rows_[row].items[column]->flags(); const auto &rowItem = this->rows_[row];
assert(this->columnCount_ == rowItem.items.size());
return rowItem.items[column]->flags();
} }
QStandardItem *getItem(int row, int column) QStandardItem *getItem(int row, int column)
@ -219,7 +227,11 @@ public:
assert(row >= 0 && row < this->rows_.size() && column >= 0 && assert(row >= 0 && row < this->rows_.size() && column >= 0 &&
column < this->columnCount_); column < this->columnCount_);
return rows_[row].items[column]; const auto &rowItem = this->rows_[row];
assert(this->columnCount_ == rowItem.items.size());
return rowItem.items[column];
} }
void deleteRow(int row) void deleteRow(int row)
@ -395,7 +407,7 @@ private:
SignalVector<TVectorItem> *vector_; SignalVector<TVectorItem> *vector_;
std::vector<Row> rows_; std::vector<Row> rows_;
int columnCount_; const int columnCount_;
// returns the related index of the SignalVector // returns the related index of the SignalVector
int getVectorIndexFromModelIndex(int index) int getVectorIndexFromModelIndex(int index)