mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
TocModel: clean-up
This commit is contained in:
parent
6aceb3558a
commit
6a662cbb27
@ -1664,6 +1664,8 @@ void GuiView::updateTocItem(string const & type, DocIterator const & dit)
|
||||
|
||||
void GuiView::structureChanged()
|
||||
{
|
||||
// FIXME: This is slightly expensive, though less than the tocBackend update
|
||||
// (#9880). This also resets the view in the Toc Widget (#6675).
|
||||
d.toc_models_.reset(documentBufferView());
|
||||
// Navigator needs more than a simple update in this case. It needs to be
|
||||
// rebuilt.
|
||||
|
@ -38,6 +38,8 @@ namespace frontend {
|
||||
|
||||
/// A QStandardItemModel that gives access to the reset methods.
|
||||
/// This is needed in order to fix http://www.lyx.org/trac/ticket/3740
|
||||
// FIXME: Better appropriately subclass QStandardItemModel and implement
|
||||
// the toc-specific reset methods there.
|
||||
class TocTypeModel : public QStandardItemModel
|
||||
{
|
||||
public:
|
||||
@ -47,27 +49,18 @@ public:
|
||||
///
|
||||
void reset()
|
||||
{
|
||||
#if (QT_VERSION < 0x050000)
|
||||
QStandardItemModel::reset();
|
||||
#else
|
||||
QStandardItemModel::beginResetModel();
|
||||
QStandardItemModel::endResetModel();
|
||||
#endif
|
||||
}
|
||||
///
|
||||
void beginResetModel()
|
||||
{
|
||||
#if QT_VERSION >= 0x040600
|
||||
QStandardItemModel::beginResetModel();
|
||||
#endif
|
||||
{
|
||||
QStandardItemModel::beginResetModel();
|
||||
}
|
||||
///
|
||||
void endResetModel()
|
||||
{
|
||||
#if QT_VERSION >= 0x040600
|
||||
QStandardItemModel::endResetModel();
|
||||
#else
|
||||
QStandardItemModel::reset();
|
||||
#endif
|
||||
{
|
||||
QStandardItemModel::endResetModel();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -136,10 +136,6 @@ public:
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user