Commit 9d1a440c authored by David Thompson's avatar David Thompson Committed by Kitware Robot

Merge topic 'fix-insert' into release

f78a55bf Fix method used to move phrases.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: T.J. Corona's avatarT.J. Corona <tj.corona@kitware.com>
Merge-request: !1589
parents d6982550 f78a55bf
......@@ -173,8 +173,11 @@ QModelIndex qtDescriptivePhraseModel::index(int row, int column, const QModelInd
//std::cout << "index(_" << ownerPhrase->phraseId() << "_, " << row << ") = " << subphrases[row]->phraseId() << ", " << subphrases[row]->title() << "\n";
view::DescriptivePhrasePtr entry = subphrases[row];
this->P->ptrs[entry->phraseId()] = entry;
return this->createIndex(row, column, entry->phraseId());
if (entry)
{
this->P->ptrs[entry->phraseId()] = entry;
return this->createIndex(row, column, entry->phraseId());
}
}
return QModelIndex();
......
......@@ -558,8 +558,8 @@ void PhraseModel::updateChildren(
moveRange[2] = static_cast<int>((mv - next.begin()) + (moveRange[1] - moveRange[0]) + 1);
this->trigger(src, PhraseModelEvent::ABOUT_TO_MOVE, idx, idx, moveRange);
// Copy batch to destination (which must be *after* source)
orig.insert(orig.begin() + moveRange[2], orig.begin() + moveRange[0],
orig.begin() + moveRange[1] + 1);
DescriptivePhrases moved(orig.begin() + moveRange[0], orig.begin() + moveRange[1] + 1);
orig.insert(orig.begin() + moveRange[2], moved.begin(), moved.end());
// Erase batch in its original location (we cannot use iterators in orig
// as they may have been invalidated by insertion).
orig.erase(orig.begin() + moveRange[0], orig.begin() + moveRange[1] + 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment