effects that I can see. That said, I believe there is still a crash you
could get. I'll explain in a moment.
Since we may run into this kind of thing again, let me explain why this
is necessary. The problem was that resetting the model was causing a
signal to be emitted that the current index had changed, which was
triggering an update of the Buffer, eventually. I'm not sure why this
did not happen in Qt 4.5, but in Qt 4.6, you have to call
beginResetModel() before doing anything, so that the combo box will
remember its previous setting. Then you can change the data; then you
can call endResetModel(). This will attempt to restore the previous
setting. Only if it cannot do so will currentIndexChanged() be emitted.
You can see, therefore, that if whatever the user did caused the current
setting to become invalid---e.g., she deleted the only footnote---then
the signal will be emitted and LyX will still crash. Still, that is a
fair bit better than presently.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33702
a592a061-630c-0410-9148-
cb99ea01b6c8
TocTypeModel::TocTypeModel(QObject * parent)
: QStandardItemModel(parent)
-{
-}
+{}
void TocTypeModel::reset()
QStandardItemModel::reset();
}
+#if QT_VERSION >= 0x040600
+void TocTypeModel::beginResetModel() {
+ QStandardItemModel::beginResetModel();
+}
+
+
+void TocTypeModel::endResetModel()
+{
+ QStandardItemModel::endResetModel();
+}
+#endif
+
+
///////////////////////////////////////////////////////////////////////////////
//
}
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();
names_->setData(index, type, Qt::UserRole);
}
names_->blockSignals(false);
+#if QT_VERSION >= 0x040600
+ names_->endResetModel();
+#else
names_->reset();
+#endif
}
TocTypeModel(QObject * parent);
///
void reset();
+#if QT_VERSION >= 0x040600
+ void beginResetModel();
+ void endResetModel();
+#endif
};
/// A class that adapt the TocBackend of a Buffer into standard Qt models for