Fix the problem that can be reproduced by:

- Scroll the applets view
- Search whatever
That will make the view completely unusable by hiding all titles and comments about applets.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=844943
This commit is contained in:
Rafael Fernández López 2008-08-11 01:41:29 +00:00
parent 134297d9d2
commit fa6480a137
4 changed files with 13 additions and 0 deletions

View File

@ -111,6 +111,7 @@ void KCategorizedItemsView::setItemModel(QStandardItemModel * model)
{
if (!m_modelFilterItems) {
m_modelFilterItems = new DefaultItemFilterProxyModel(this);
connect(m_modelFilterItems, SIGNAL(searchTermChanged(QString)), this, SLOT(slotSearchTermChanged(QString)));
}
m_modelItems = model;
@ -166,6 +167,11 @@ void KCategorizedItemsView::itemDoubleClicked(const QModelIndex& index)
emit doubleClicked(index);
}
void KCategorizedItemsView::slotSearchTermChanged( const QString& term )
{
updateColumnsWidth();
}
void KCategorizedItemsView::updateColumnsWidth(bool force)
{
m_viewWidth = itemsView->viewport()->width();

View File

@ -71,6 +71,7 @@ protected slots:
private slots:
void itemActivated( const QModelIndex& index );
void itemDoubleClicked( const QModelIndex& index );
void slotSearchTermChanged( const QString& term );
Q_SIGNALS:
void activated ( const QModelIndex & index );

View File

@ -138,6 +138,7 @@ void DefaultItemFilterProxyModel::setSearch(const QString & pattern)
{
m_searchPattern = pattern;
invalidateFilter();
emit searchTermChanged(pattern);
}
void DefaultItemFilterProxyModel::setFilter(const Filter & filter)

View File

@ -106,6 +106,8 @@ public:
*/
class DefaultItemFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
DefaultItemFilterProxyModel(QObject * parent = 0);
@ -123,6 +125,9 @@ public:
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
Q_SIGNALS:
void searchTermChanged(const QString &term);
private:
class InnerProxyModel : public QAbstractItemModel