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