Code simplification.

TocTypeModel is not needed outside TocModel.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33707 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2010-03-10 21:00:34 +00:00
parent e50264577c
commit 2a3f27a80c
2 changed files with 30 additions and 46 deletions

View File

@ -33,34 +33,37 @@ using namespace std;
namespace lyx {
namespace frontend {
///////////////////////////////////////////////////////////////////////////////
//
// TocTypeModel
//
///////////////////////////////////////////////////////////////////////////////
TocTypeModel::TocTypeModel(QObject * parent)
: QStandardItemModel(parent)
{}
void TocTypeModel::reset()
/// A QStandardItemModel that gives access to the reset method.
/// This is needed in order to fix http://www.lyx.org/trac/ticket/3740
class TocTypeModel : public QStandardItemModel
{
QStandardItemModel::reset();
}
#if QT_VERSION >= 0x040600
void TocTypeModel::beginResetModel() {
QStandardItemModel::beginResetModel();
}
void TocTypeModel::endResetModel()
{
QStandardItemModel::endResetModel();
}
#endif
public:
///
TocTypeModel(QObject * parent) : QStandardItemModel(parent)
{}
///
void reset()
{
QStandardItemModel::reset();
}
///
void beginResetModel()
{
#if QT_VERSION >= 0x040600
QStandardItemModel::beginResetModel();
#endif
}
///
void endResetModel()
{
#if QT_VERSION >= 0x040600
QStandardItemModel::endResetModel();
#else
reset();
#endif
}
};
///////////////////////////////////////////////////////////////////////////////
@ -350,9 +353,7 @@ void TocModels::reset(BufferView const * bv)
}
names_->blockSignals(true);
#if QT_VERSION >= 0x040600
names_->beginResetModel();
#endif
names_->insertColumns(0, 1);
TocList const & tocs = bv_->buffer().masterBuffer()->tocBackend().tocs();
TocList::const_iterator it = tocs.begin();
@ -375,11 +376,7 @@ void TocModels::reset(BufferView const * bv)
names_->setData(index, type, Qt::UserRole);
}
names_->blockSignals(false);
#if QT_VERSION >= 0x040600
names_->endResetModel();
#else
names_->reset();
#endif
}

View File

@ -29,20 +29,7 @@ class TocItem;
namespace frontend {
/// A QStandardItemModel that gives access to the reset method.
/// This is needed in order to fix http://www.lyx.org/trac/ticket/3740
class TocTypeModel : public QStandardItemModel
{
public:
///
TocTypeModel(QObject * parent);
///
void reset();
#if QT_VERSION >= 0x040600
void beginResetModel();
void endResetModel();
#endif
};
class TocTypeModel;
/// A class that adapt the TocBackend of a Buffer into standard Qt models for
/// GUI visualisation.