[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-workspace] systemsettings/icons: Scroll first match into view
From:       Ben Cooksley <bcooksley () kde ! org>
Date:       2012-11-30 20:59:58
Message-ID: 20121130205958.DE833A6091 () git ! kde ! org
[Download RAW message or body]

Git commit 3eb3c667b1a1412f4f688eb9ff407caa139ab23d by Ben Cooksley, on behalf of Christoph Feck.
Committed on 14/11/2012 at 14:35.
Pushed by bcooksley into branch 'master'.

Scroll first match into view

BUG: 291408
FIXED-IN: 4.9.4
REVIEW: 107284
(cherry picked from commit bf40c5919b4442ac179e8deee894eb9de46a1ab4)

M  +12   -0    systemsettings/icons/IconMode.cpp

http://commits.kde.org/kde-workspace/3eb3c667b1a1412f4f688eb9ff407caa139ab23d

diff --git a/systemsettings/icons/IconMode.cpp b/systemsettings/icons/IconMode.cpp
index 4aac248..37cfc4b 100644
--- a/systemsettings/icons/IconMode.cpp
+++ b/systemsettings/icons/IconMode.cpp
@@ -125,6 +125,18 @@ void IconMode::initEvent()
 void IconMode::searchChanged( const QString& text )
 {
     d->proxyModel->setFilterRegExp( text );
+    if ( d->categoryView ) {
+        QAbstractItemModel *model = d->categoryView->model();
+        const int column = d->categoryView->modelColumn();
+        const QModelIndex root = d->categoryView->rootIndex();
+        for ( int i = 0; i < model->rowCount(); ++i ) {
+            const QModelIndex index = model->index( i, column, root );
+            if ( model->flags( index ) & Qt::ItemIsEnabled ) {
+                d->categoryView->scrollTo( index );
+                break;
+            }
+        }
+    }
 }
 
 void IconMode::changeModule( const QModelIndex& activeModule )
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic