cosmetics and doxygen.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26634 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-09-30 07:38:34 +00:00
parent 5cfe7daadb
commit 6bd9b43ce5
2 changed files with 15 additions and 3 deletions

View File

@ -36,7 +36,7 @@ namespace frontend {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
// TocModels // TocTypeModel
// //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -52,6 +52,12 @@ void TocTypeModel::reset()
} }
///////////////////////////////////////////////////////////////////////////////
//
// TocModel
//
///////////////////////////////////////////////////////////////////////////////
TocModel::TocModel(QObject * parent) TocModel::TocModel(QObject * parent)
: model_(new TocTypeModel(parent)), : model_(new TocTypeModel(parent)),
sorted_model_(new QSortFilterProxyModel(parent)), sorted_model_(new QSortFilterProxyModel(parent)),
@ -95,6 +101,7 @@ void TocModel::sort(bool sort_it)
sorted_model_->sort(0); sorted_model_->sort(0);
} }
TocItem const & TocModel::tocItem(QModelIndex const & index) const TocItem const & TocModel::tocItem(QModelIndex const & index) const
{ {
return (*toc_)[model()->data(index, Qt::UserRole).toUInt()]; return (*toc_)[model()->data(index, Qt::UserRole).toUInt()];
@ -199,7 +206,7 @@ void TocModel::populate(unsigned int & index, QModelIndex const & parent)
int TocModel::modelDepth() const int TocModel::modelDepth() const
{ {
int const d = maxdepth_ - mindepth_; int const d = maxdepth_ - mindepth_;
LASSERT(d >= 0 && d <= 100, /* */); LASSERT(d >= 0 && d <= 100, return 0);
return d; return d;
} }

View File

@ -29,6 +29,8 @@ class TocItem;
namespace frontend { namespace frontend {
/// A QStandardItemModel that gives access to the reset method.
/// This is needed in order to fix http://bugzilla.lyx.org/show_bug.cgi?id=3740
class TocTypeModel : public QStandardItemModel class TocTypeModel : public QStandardItemModel
{ {
public: public:
@ -38,7 +40,9 @@ public:
void reset(); void reset();
}; };
/// A class that adapt the TocBackend of a Buffer into standard Qt models for
/// GUI visualisation.
/// There is one TocModel per list in the TocBackend.
class TocModel class TocModel
{ {
public: public:
@ -83,6 +87,7 @@ private:
}; };
/// A container for the different TocModels.
class TocModels : public QObject class TocModels : public QObject
{ {
Q_OBJECT Q_OBJECT