┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Fernández López <[email protected]>2007-10-13 02:15:01 +0000
committerRafael Fernández López <[email protected]>2007-10-13 02:15:01 +0000
commite907e75abf2167417d2fa45c668df35b6dfdd094 (patch)
tree7412a2224ff4c3ef8f28ab3ac3e0b230c182143c
parentd0e7eabcaa259eeef14fa9c29b36cfefc46f8143 (diff)
With latest code at slotLayoutChanged is not more necessary
slotLayoutAboutToBeChanged. Reacts as it should when removing items svn path=/trunk/KDE/kdebase/apps/; revision=724693
-rw-r--r--src/kcategorizedview.cpp58
-rw-r--r--src/kcategorizedview.h1
2 files changed, 26 insertions, 33 deletions
diff --git a/src/kcategorizedview.cpp b/src/kcategorizedview.cpp
index bb014b31e..d0d51ef2f 100644
--- a/src/kcategorizedview.cpp
+++ b/src/kcategorizedview.cpp
@@ -477,16 +477,16 @@ void KCategorizedView::setModel(QAbstractItemModel *model)
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);
@@ -500,16 +500,21 @@ void KCategorizedView::setModel(QAbstractItemModel *model)
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);
+ }
}
}
@@ -552,30 +557,30 @@ void KCategorizedView::setCategoryDrawer(KCategoryDrawer *categoryDrawer)
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;
@@ -1225,8 +1230,8 @@ void KCategorizedView::rowsInserted(const QModelIndex &parent,
}
void KCategorizedView::rowsInsertedArtifficial(const QModelIndex &parent,
- int start,
- int end)
+ int start,
+ int end)
{
Q_UNUSED(parent);
@@ -1299,14 +1304,14 @@ void KCategorizedView::rowsInsertedArtifficial(const QModelIndex &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);
}
}
@@ -1324,17 +1329,6 @@ void KCategorizedView::updateGeometries()
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 &&
diff --git a/src/kcategorizedview.h b/src/kcategorizedview.h
index d5afb666c..8544392d9 100644
--- a/src/kcategorizedview.h
+++ b/src/kcategorizedview.h
@@ -103,7 +103,6 @@ protected Q_SLOTS:
virtual void updateGeometries();
- virtual void slotLayoutAboutToBeChanged();
virtual void slotLayoutChanged();