[Okular-devel] Re: About 265002 (Unreachable code in okular/ui/pageview.cpp (related to drag scroll))

Albert Astals Cid aacid at kde.org
Tue Feb 1 21:20:38 CET 2011


A Dimarts, 1 de febrer de 2011, Денис Песоцкий va escriure:
> There is also hardcoded margin. Here is better code (added margin and
> removed stupid check):

Again, please control your language.

> 
>                 else if ( !d->mouseGrabPos.isNull() )
>                 {
>                     setCursor( Qt::SizeAllCursor );
> 
>                     QPoint mousePos = e->globalPos();
>                     QPoint delta = d->mouseGrabPos - mousePos;
> 
>                     const QRect mouseContainer =
> KGlobalSettings::desktopGeometry( this );
>                     static const int margin = 5;
>                     // wrap mouse from top to bottom
>                     if ( mousePos.y() < mouseContainer.top() + margin &&
>                          verticalScrollBar()->value() <
> verticalScrollBar()->maximum() - 2*margin )
>                     {
>                         mousePos.setY( mouseContainer.bottom() - margin );
>                         QCursor::setPos( mousePos );
>                     }
>                     // wrap mouse from bottom to top
>                     else if ( mousePos.y() > mouseContainer.bottom() -
> margin && verticalScrollBar()->value() > 2*margin ) {
>                         mousePos.setY( mouseContainer.top() + margin );
>                         QCursor::setPos( mousePos );
>                     }
>                     // remember last position
>                     d->mouseGrabPos = mousePos;
> 
>                     // scroll page by position increment
> 
> horizontalScrollBar()->setValue(horizontalScrollBar()->value() +
> delta.x());
> 
> verticalScrollBar()->setValue(verticalScrollBar()->value() +
> delta.y());
>                 }
>             }

As said in the other mail, check the svn logs and make sure your fix does not 
break what the other code was supposed to fix.

Albert

> _______________________________________________
> Okular-devel mailing list
> Okular-devel at kde.org
> https://mail.kde.org/mailman/listinfo/okular-devel


More information about the Okular-devel mailing list