Commit ee1fd5ef authored by Albert Astals Cid's avatar Albert Astals Cid

Fix my cursor fix (i hope :D)

svn path=/branches/kpdf_experiments/kdegraphics/kpdf/; revision=374890
parent 30649cfb
......@@ -10,7 +10,6 @@ Legend:
Urgent fixes in HEAD:
-> REGRESSION: find-as-you-type somewhat broken here
-> REGRESSIONS: mouse cursor on drag (, add small ones here)
-> FIX 1/2: sync Memory Management (in Document) with the Generator (exp. undoing requests) (may Segfault!)
-> FIX 2/2: check for removing 'canUnloadPixmap' from observers in place of requesting
a list of visible pixmaps
......@@ -93,6 +92,7 @@ More items (first items will enter 'In progress list' first):
-> move some document related features from part to the document (see find, goto dialog, ...)
Done (newest feature comes firts):
-> FIX: Fix my update cursor FIX :-D
-> ADD: Make kpdf aware of Find and GoToPage actions
-> FIX: Update cursor correctly when a link moves to a page and the cursor is over a link on that page
-> ADD: Asyncronous PDF Generator implementation (for the user: faster UI, preloading, etc..)
......
......@@ -311,10 +311,17 @@ void PageView::notifyPixmapChanged( int pageNumber )
QRect expandedRect = (*iIt)->geometry();
expandedRect.addCoords( -1, -1, 3, 3 );
updateContents( expandedRect );
// that is here because of that
// you clicked on a link that brought you to another page
// the page was not on the cache so the updateCursor from pageSetCurrent does not work
updateCursor( viewportToContents( mapFromGlobal( QCursor::pos() ) ) );
// if we where "zoom-dragging" do not overwrite the "zoom-drag" cursor
if (cursor().shape() != Qt::SizeVerCursor)
{
// that is here because of that
// you clicked on a link that brought you to another page
// the page was not on the cache so the updateCursor from pageSetCurrent does not work
updateCursor( viewportToContents( mapFromGlobal( QCursor::pos() ) ) );
}
break;
}
}
......@@ -613,7 +620,8 @@ void PageView::contentsMouseReleaseEvent( QMouseEvent * e )
if ( (e->state() & MidButton) && d->mouseMidStartY > 0 )
{
d->mouseMidStartY = -1;
setCursor( arrowCursor );
// while drag-zooming we could have gone over a link
updateCursor( e->pos() );
return;
}
......@@ -622,6 +630,14 @@ void PageView::contentsMouseReleaseEvent( QMouseEvent * e )
switch ( d->mouseMode )
{
case MouseNormal:{ // do Follow Link or Display RMB
// return the cursor to its normal state after dragging
if (cursor().shape() == Qt::SizeAllCursor) updateCursor( e->pos() );
// avoid the situation in where you click on a "row" that has a link but you are not over it
// drag a bit and move the mouse left to place it over the link while dragging
// release the button and BOOM you get the link followed
if (d->mouseStartPos != e->globalPos()) return;
PageViewItem * pageItem = pickItemOnPoint( e->x(), e->y() );
if ( leftButton && pageItem )
{
......@@ -645,8 +661,7 @@ void PageView::contentsMouseReleaseEvent( QMouseEvent * e )
else
{
// mouse not moved since press, so we have a click. select the page.
if ( e->globalPos() == d->mouseStartPos )
d->document->setCurrentPage( pageItem->pageNumber() );
d->document->setCurrentPage( pageItem->pageNumber() );
}
}
else if ( rightButton )
......@@ -1124,19 +1139,19 @@ void PageView::updateCursor( const QPoint &p )
pageY = p.y() - pageItem->geometry().top();
// check if over a KPDFPageRect
bool onRect = pageItem->page()->hasLink( pageX, pageY );
if ( onRect != d->mouseOnRect )
setCursor( (d->mouseOnRect = onRect) ? pointingHandCursor : arrowCursor );
bool onLink = pageItem->page()->hasLink( pageX, pageY );
d->mouseOnRect = onLink;
if ( onLink )
setCursor( pointingHandCursor );
else
setCursor( arrowCursor );
}
else
{
// if there's no page over the cursor and we were showing the pointingHandCursor
// go back to the normal one
if ( d->mouseOnRect )
{
d->mouseOnRect = false;
setCursor( arrowCursor );
}
d->mouseOnRect = false;
setCursor( arrowCursor );
}
}
......
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