Commit 0c1d5a89 authored by Ilkka Ollakka's avatar Ilkka Ollakka

Qt4: pictureflow, if target futher than 20, jump closer and scroll last 20 items

parent d811e20b
...@@ -403,8 +403,15 @@ QRect PicFlowView::visualRect(const QModelIndex &index ) const ...@@ -403,8 +403,15 @@ QRect PicFlowView::visualRect(const QModelIndex &index ) const
void PicFlowView::scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint) void PicFlowView::scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint)
{ {
int currentIndex = picFlow->centerIndex(); int currentIndex = picFlow->centerIndex();
if( qAbs( currentIndex - index.row()) > 100 ) if( qAbs( currentIndex - index.row()) > 20 )
picFlow->setCenterIndex( index.row()); {
/* offset is offset from target index toward currentIndex */
int offset = -19;
if( index.row() > currentIndex )
offset = 19;
picFlow->setCenterIndex( index.row() + offset );
picFlow->showSlide( index.row() );
}
else else
picFlow->showSlide( index.row() ); picFlow->showSlide( index.row() );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment