From 6a662cbb2717f8c11e4b5e77e7d6a6320a0fce85 Mon Sep 17 00:00:00 2001 From: Guillaume Munch Date: Mon, 30 May 2016 22:11:00 +0100 Subject: [PATCH] TocModel: clean-up --- src/frontends/qt4/GuiView.cpp | 2 ++ src/frontends/qt4/TocModel.cpp | 21 +++++++-------------- src/frontends/qt4/TocModel.h | 4 ---- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 6bfcdcb032..c1c74d5497 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -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. diff --git a/src/frontends/qt4/TocModel.cpp b/src/frontends/qt4/TocModel.cpp index 7654983f09..9fb94813d2 100644 --- a/src/frontends/qt4/TocModel.cpp +++ b/src/frontends/qt4/TocModel.cpp @@ -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(); } }; diff --git a/src/frontends/qt4/TocModel.h b/src/frontends/qt4/TocModel.h index c959aba556..f0f9efa319 100644 --- a/src/frontends/qt4/TocModel.h +++ b/src/frontends/qt4/TocModel.h @@ -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::const_iterator const_iterator; typedef QHash::iterator iterator;