Aarón Bueno Villares
2016-11-22 21:50:59 UTC
Trying to understand what a raw index is supposed to be (what is it used
for, or what is the logic behind "saving the index")... I found these
pieces of code:
bool WModelIndex::isRawIndex() const
{
return row_ == -42 && column_ == -42;
}
void WModelIndex::encodeAsRawIndex()
{
if (model_) {
if (isRawIndex()) {
LOG_ERROR("encodeAsRawIndex(): cannot encode a raw index to raw
again");
return;
}
internalId_ = reinterpret_cast< ::uint64_t >(model_->toRawIndex(*this));
row_ = column_ = -42;
}
}
Why is that? Is it because the number 42 is the number of life? Just to
choose a negative number or what? I was surprise to see that there.
for, or what is the logic behind "saving the index")... I found these
pieces of code:
bool WModelIndex::isRawIndex() const
{
return row_ == -42 && column_ == -42;
}
void WModelIndex::encodeAsRawIndex()
{
if (model_) {
if (isRawIndex()) {
LOG_ERROR("encodeAsRawIndex(): cannot encode a raw index to raw
again");
return;
}
internalId_ = reinterpret_cast< ::uint64_t >(model_->toRawIndex(*this));
row_ = column_ = -42;
}
}
Why is that? Is it because the number 42 is the number of life? Just to
choose a negative number or what? I was surprise to see that there.