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

List:       kde-core-devel
Subject:    Horizontal automatic scrolling treeview - what can we do with this?
From:       Harald Hvaal <haraldhv () stud ! ntnu ! no>
Date:       2008-04-04 0:39:19
Message-ID: 47F578B7.2030707 () stud ! ntnu ! no
[Download RAW message or body]

Hello everybody

I've been playing around with a subclassed treeview that has no 
horizontal scrolling, but instead scrolls automatically according to the 
topmost visible item in the tree. The result can be seen here:

http://folk.ntnu.no/haraldhv/simplescroll.ogg

The code really just boils down to some settings and a timer doing 
something like this:

        void timertick()
        {
            QModelIndex i = indexAt(QPoint(20,10));

            if (i.isValid())
            {
                scrolltowards = visualRect(i).left() - 20 + 
horizontalScrollBar()->value();
            }

            int diff = scrolltowards - horizontalScrollBar()->value();
            if (diff > 5)
                
horizontalScrollBar()->setValue(horizontalScrollBar()->value() + 4);
            else if (diff < -5)
                
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - 4);

        }

If there was a KTreeView it could easily be added to this, but since 
there are none, I'm unsure of where it could fit. Also, the animation 
could probably be done in a more correct way by using some kde animation 
functionality(?).


What do you people see this go into?

Harald
metellius@freenode
[prev in list] [next in list] [prev in thread] [next in thread] 

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