if (d->proxyModel)
{
- QObject::disconnect(d->proxyModel,
- SIGNAL(layoutAboutToBeChanged()),
- this, SLOT(slotLayoutAboutToBeChanged()));
-
QObject::disconnect(d->proxyModel,
SIGNAL(layoutChanged()),
this, SLOT(slotLayoutChanged()));
QObject::disconnect(d->proxyModel,
SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(slotLayoutChanged()));
+
+ QObject::disconnect(d->proxyModel,
+ SIGNAL(rowsRemoved(QModelIndex,int,int)),
+ this, SLOT(rowsRemoved(QModelIndex,int,int)));
}
QListView::setModel(model);
d->modelSortColumn = d->proxyModel->sortColumn();
d->modelSortOrder = d->proxyModel->sortOrder();
- QObject::connect(d->proxyModel,
- SIGNAL(layoutAboutToBeChanged()),
- this, SLOT(slotLayoutAboutToBeChanged()));
-
QObject::connect(d->proxyModel,
SIGNAL(layoutChanged()),
this, SLOT(slotLayoutChanged()));
QObject::connect(d->proxyModel,
SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(slotLayoutChanged()));
+
+ QObject::connect(d->proxyModel,
+ SIGNAL(rowsRemoved(QModelIndex,int,int)),
+ this, SLOT(rowsRemoved(QModelIndex,int,int)));
+
+ if (d->proxyModel->rowCount())
+ {
+ rowsInsertedArtifficial(QModelIndex(), 0, d->proxyModel->rowCount() - 1);
+ }
}
}
if (!categoryDrawer && d->proxyModel)
{
- QObject::disconnect(d->proxyModel,
- SIGNAL(layoutAboutToBeChanged()),
- this, SLOT(slotLayoutAboutToBeChanged()));
-
QObject::disconnect(d->proxyModel,
SIGNAL(layoutChanged()),
this, SLOT(slotLayoutChanged()));
QObject::disconnect(d->proxyModel,
SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(slotLayoutChanged()));
+
+ QObject::disconnect(d->proxyModel,
+ SIGNAL(rowsRemoved(QModelIndex,int,int)),
+ this, SLOT(rowsRemoved(QModelIndex,int,int)));
}
else if (categoryDrawer && d->proxyModel)
{
- QObject::connect(d->proxyModel,
- SIGNAL(layoutAboutToBeChanged()),
- this, SLOT(slotLayoutAboutToBeChanged()));
-
QObject::connect(d->proxyModel,
SIGNAL(layoutChanged()),
this, SLOT(slotLayoutChanged()));
QObject::connect(d->proxyModel,
SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(slotLayoutChanged()));
+
+ QObject::connect(d->proxyModel,
+ SIGNAL(rowsRemoved(QModelIndex,int,int)),
+ this, SLOT(rowsRemoved(QModelIndex,int,int)));
}
d->categoryDrawer = categoryDrawer;
}
void KCategorizedView::rowsInsertedArtifficial(const QModelIndex &parent,
- int start,
- int end)
+ int start,
+ int end)
{
Q_UNUSED(parent);
}
void KCategorizedView::rowsRemoved(const QModelIndex &parent,
- int start,
- int end)
+ int start,
+ int end)
{
if ((viewMode() == KCategorizedView::IconMode) && d->proxyModel &&
d->categoryDrawer && d->proxyModel->isCategorizedModel())
{
// Force the view to update all elements
- rowsInsertedArtifficial(parent, start, end);
+ rowsInsertedArtifficial(QModelIndex(), 0, d->proxyModel->rowCount() - 1);
}
}
QAbstractItemView::updateGeometries();
}
-void KCategorizedView::slotLayoutAboutToBeChanged()
-{
- if ((viewMode() == KCategorizedView::IconMode) && d->proxyModel &&
- d->categoryDrawer && d->proxyModel->isCategorizedModel())
- {
- d->modelSortRole = d->proxyModel->sortRole();
- d->modelSortColumn = d->proxyModel->sortColumn();
- d->modelSortOrder = d->proxyModel->sortOrder();
- }
-}
-
void KCategorizedView::slotLayoutChanged()
{
if ((viewMode() == KCategorizedView::IconMode) && d->proxyModel &&