- void populate(TocIterator & it,
- TocIterator const & end,
- QModelIndex const & parent);\r
+ void populate(unsigned int & index, QModelIndex const & parent);
+ ///
+ TocTypeModel * model_;
+ ///
+ QSortFilterProxyModel * sorted_model_;
+ ///
+ bool is_sorted_;
+ ///
+ Toc const * toc_;
+ ///
+ int maxdepth_;
+ ///
+ int mindepth_;
+};
+
+
+/// A container for the different TocModels.
+class TocModels : public QObject
+{
+ Q_OBJECT
+public:
+ ///
+ TocModels();
+ ///
+ void reset(BufferView const * bv);
+ ///
+ int depth(QString const & type);
+ ///
+ QAbstractItemModel * model(QString const & type);
+ ///
+ QAbstractItemModel * nameModel();
+ ///
+ QModelIndex currentIndex(QString const & type) const;
+ ///
+ void goTo(QString const & type, QModelIndex const & index) const;
+ ///
+ void init(Buffer const & buffer);
+ ///
+ void updateBackend() const;
+ ///
+ void updateItem(QString const & type, DocIterator const & dit);
+ ///
+ void sort(QString const & type, bool sort_it);
+ ///
+ bool isSorted(QString const & type) const;
+ /// the item that is currently selected
+ TocItem const currentItem(QString const & type,
+ QModelIndex const & index) const;
+
+Q_SIGNALS:
+ /// Signal that the internal toc_models_ has been reset.
+ void modelReset();
+
+private:
+ typedef QHash<QString, TocModel *>::const_iterator const_iterator;
+ typedef QHash<QString, TocModel *>::iterator iterator;
+ ///
+ void clear();