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()
|
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());
|
d.toc_models_.reset(documentBufferView());
|
||||||
// Navigator needs more than a simple update in this case. It needs to be
|
// Navigator needs more than a simple update in this case. It needs to be
|
||||||
// rebuilt.
|
// rebuilt.
|
||||||
|
@ -38,6 +38,8 @@ namespace frontend {
|
|||||||
|
|
||||||
/// A QStandardItemModel that gives access to the reset methods.
|
/// A QStandardItemModel that gives access to the reset methods.
|
||||||
/// This is needed in order to fix http://www.lyx.org/trac/ticket/3740
|
/// 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
|
class TocTypeModel : public QStandardItemModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -47,27 +49,18 @@ public:
|
|||||||
///
|
///
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
#if (QT_VERSION < 0x050000)
|
QStandardItemModel::beginResetModel();
|
||||||
QStandardItemModel::reset();
|
|
||||||
#else
|
|
||||||
QStandardItemModel::endResetModel();
|
QStandardItemModel::endResetModel();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
void beginResetModel()
|
void beginResetModel()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x040600
|
QStandardItemModel::beginResetModel();
|
||||||
QStandardItemModel::beginResetModel();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
void endResetModel()
|
void endResetModel()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x040600
|
QStandardItemModel::endResetModel();
|
||||||
QStandardItemModel::endResetModel();
|
|
||||||
#else
|
|
||||||
QStandardItemModel::reset();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -136,10 +136,6 @@ public:
|
|||||||
TocItem const currentItem(QString const & type,
|
TocItem const currentItem(QString const & type,
|
||||||
QModelIndex const & index) const;
|
QModelIndex const & index) const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
/// Signal that the internal toc_models_ has been reset.
|
|
||||||
void modelReset();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef QHash<QString, TocModel *>::const_iterator const_iterator;
|
typedef QHash<QString, TocModel *>::const_iterator const_iterator;
|
||||||
typedef QHash<QString, TocModel *>::iterator iterator;
|
typedef QHash<QString, TocModel *>::iterator iterator;
|
||||||
|
Loading…
Reference in New Issue
Block a user