]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/TocModel.cpp
Mac compile fix.
[lyx.git] / src / frontends / qt4 / TocModel.cpp
index f432d3c1f3c5a517bddde08d37cdc823adc04867..cd6cd7058e235dd1e9a9cb95ba5e6d8e0fe9e65b 100644 (file)
@@ -41,7 +41,10 @@ TocItem const & TocModel::tocItem(QModelIndex const & index) const
 
 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,
@@ -52,14 +55,6 @@ QModelIndex TocModel::modelIndex(DocIterator const & dit) const
 }
 
 
-void TocModel::clear()
-{
-       QStandardItemModel::clear();
-       removeRows(0, rowCount());
-       removeColumns(0, columnCount());
-}
-
-
 TocModel::TocModel(Toc const & toc): toc_(toc)
 {
        if (toc_.empty())
@@ -71,7 +66,7 @@ TocModel::TocModel(Toc const & toc): toc_(toc)
        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());
@@ -94,7 +89,7 @@ TocModel::TocModel(Toc const & toc): toc_(toc)
 }
 
 
-void TocModel::populate(size_t & index, QModelIndex const & parent)
+void TocModel::populate(unsigned int & index, QModelIndex const & parent)
 {
        int curdepth = toc_[index].depth() + 1;