on xenial help sign in
Reset instead of qFatal when removing things from the middle

This can be optimized but let's see how this behaves, at least we won't qFatal anymore :D

commit8da320290dbba00058f907f42056f6183c3c16ec authorAlbert Astals Cid <albert.astals@canonical.com> dateWed 14 Oct 2015, 10:56 (11 years ago) parent08f6f81
3 files changed+9−3
plugins/Dash/horizontaljournal.cpp+3−1 plugins/Dash/organicgrid.cpp+3−1 plugins/Dash/verticaljournal.cpp+3−1
plugins/Dash/horizontaljournal.cpp+3−1
@@ -199,7 +199,9 @@ void HorizontalJournal::processModelRemoves(const QVector<QQmlChangeSet::Change>
199199 m_lastInRowIndexPosition.remove(indexToRemove);
200200 } else {
201201 if (indexToRemove < lastIndex) {
202− qFatal("HorizontalJournal only supports removal from the end of the model");
202+ qDebug() << "HorizontalJournal only supports removal from the end of the model, resetting instead";
203+ cleanupExistingItems();
204+ break;
203205 } else {
204206 setImplicitHeightDirty();
205207 }
plugins/Dash/organicgrid.cpp+3−1
@@ -250,7 +250,9 @@ void OrganicGrid::processModelRemoves(const QVector<QQmlChangeSet::Change> &remo
250250 releaseItem(m_visibleItems.takeLast());
251251 } else {
252252 if (indexToRemove < lastIndex) {
253− qFatal("OrganicGrid only supports removal from the end of the model");
253+ qDebug() << "OrganicGrid only supports removal from the end of the model, resetting instead";
254+ cleanupExistingItems();
255+ break;
254256 }
255257 }
256258 }
plugins/Dash/verticaljournal.cpp+3−1
@@ -265,7 +265,9 @@ void VerticalJournal::processModelRemoves(const QVector<QQmlChangeSet::Change> &
265265 }
266266 if (!found) {
267267 if (indexToRemove < lastCreatedIndex) {
268− qFatal("VerticalJournal only supports removal from the end of the model");
268+ qDebug() << "VerticalJournal only supports removal from the end of the model, resetting instead";
269+ cleanupExistingItems();
270+ break;
269271 } else {
270272 setImplicitHeightDirty();
271273 }