QModelIndex TocModel::modelIndex(DocIterator const & dit) const
{
- size_t const toc_index = toc_.item(dit) - toc_.begin();
+ if (toc_.empty())
+ return QModelIndex();
+
+ unsigned int const toc_index = toc_.item(dit) - toc_.begin();
QModelIndexList list = match(index(0, 0), Qt::UserRole,
QVariant(toc_index), 1,
}
-void TocModel::clear()
-{
- QStandardItemModel::clear();
- removeRows(0, rowCount());
- removeColumns(0, columnCount());
-}
-
-
TocModel::TocModel(Toc const & toc): toc_(toc)
{
if (toc_.empty())
mindepth_ = INT_MAX;
size_t end = toc.size();
- for (size_t index = 0; index != end; ++index) {
+ for (unsigned int index = 0; index != end; ++index) {
TocItem const & item = toc_[index];
maxdepth_ = max(maxdepth_, item.depth());
mindepth_ = min(mindepth_, item.depth());
}
-void TocModel::populate(size_t & index, QModelIndex const & parent)
+void TocModel::populate(unsigned int & index, QModelIndex const & parent)
{
int curdepth = toc_[index].depth() + 1;