summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2012-06-06 14:58:18 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2012-06-06 15:07:07 -0300
commite9e9764dd5a9696cdc45cac3a7fbeabca2b72611 (patch)
tree621a65a5f0aa85769750235b81f403047e0586d1
parent855d0368ebd844b6582c5ea0692cf6fdd8e4ee73 (diff)
TabsModel::remove should not emit a dataChanged signal, but it will anyways.
Calling "beginRemoveRows(...)" and "endRemoveRows()" methods should've been enough for the view to adapt to removal changes, instead of having to emit a "dataChanged(...)" signal as well. Nevertheless, The combined use of a QML Repeater item with RowsRangeFilter, our custom QSortFilterProxyModel, has showed unable to tackle the changes to the model, resulting in strange UI behavior. This may have something to do with QQuickRepeater::setModel() not connecting the model (our RowsRangeFilter) to the "destroyingItem(...)" signal, whose lines where commented out in qt5/qtdeclarative/src/quick/items/qquickrepeater.cpp since time immemorial (not shows on the git history). For now I just fixed the index of the last item in the range of altered items. Reviewed-by: Hugo Parente Lima
-rw-r--r--src/core/TabsModel.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/TabsModel.cpp b/src/core/TabsModel.cpp
index 27eea6b..3ecd026 100644
--- a/src/core/TabsModel.cpp
+++ b/src/core/TabsModel.cpp
@@ -82,6 +82,18 @@ void TabsModel::remove(int pos)
QPointer<QObject> item = m_list.takeAt(pos);
endRemoveRows();
delete item;
+ // FIXME: Calling "beginRemoveRows(...)" and "endRemoveRows()" methods should've been
+ // enough for the view to adapt to removal changes, instead of having to emit a
+ // "dataChanged(...)" signal as well. Nevertheless, The combined use of a QML Repeater
+ // item with RowsRangeFilter, our custom QSortFilterProxyModel, has showed unable to
+ // tackle the changes to the model, resulting in strange UI behavior.
+ // This may have something to do with QQuickRepeater::setModel() not connecting
+ // the model (our RowsRangeFilter) to the "destroyingItem(...)" signal, whose lines
+ // where commented out in qt5/qtdeclarative/src/quick/items/qquickrepeater.cpp
+ // since time immemorial (not shows on the git history).
+ // For now I just fixed the index of the last item in the range of altered items.
+ QModelIndex start = createIndex(pos, 0), end = createIndex(m_list.size() - 2, 0);
+ emit dataChanged(start, end);
if (currentWebViewIndex() < 0)
return;