+
+/// 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();
+ ///
+ BufferView const * bv_;
+ ///
+ QHash<QString, TocModel *> models_;
+ ///
+ TocTypeModel * names_;
+ ///
+ QSortFilterProxyModel * names_sorted_;
+};
+