[helm] explore how to do this

wilder-helm
Jacopo De Simoi 6 years ago
parent 944be4d93d
commit f88b9be6bb
  1. 33
      ui/pageview.cpp

@ -1824,6 +1824,16 @@ void PageView::paintEvent(QPaintEvent *pe)
pixmapPainter.drawRect( contentsRect ); pixmapPainter.drawRect( contentsRect );
} }
// 5) Layer 3: links
qDebug() << "here";
for ( PageViewItem * i : qAsConst( d->visibleItems ) )
{
const QRect & r = i->croppedGeometry();
qDebug() << r;
pixmapPainter.setPen(Qt::green );
pixmapPainter.drawRect( r );
}
// finish painting and draw contents // finish painting and draw contents
pixmapPainter.end(); pixmapPainter.end();
screenPainter.drawPixmap( contentsRect.left(), contentsRect.top(), doubleBuffer ); screenPainter.drawPixmap( contentsRect.left(), contentsRect.top(), doubleBuffer );
@ -1859,6 +1869,27 @@ void PageView::paintEvent(QPaintEvent *pe)
// 3b) Layer 1: give mouseAnnotation painting control // 3b) Layer 1: give mouseAnnotation painting control
d->mouseAnnotation->routePaint( &screenPainter, contentsRect ); d->mouseAnnotation->routePaint( &screenPainter, contentsRect );
qDebug() << "there";
for ( PageViewItem * i : qAsConst( d->visibleItems ) )
{
const QLinkedList< const Okular::ObjectRect *> orects = i->page()->objectRects( Okular::ObjectRect::Action );
if ( !orects.isEmpty() )
{
foreach ( const Okular::ObjectRect * orect, orects ) {
QRect boundingRect = orect->boundingRect(i->page()->width(),i->page()->height());
QRect uncropped = i->uncroppedGeometry();
int pageHeight = i->page()->height();
int pageWidth = i->page()->width();
QRect actualRect;
actualRect.setTop(uncropped.top()+uncropped.height()*boundingRect.top()/pageHeight);
actualRect.setBottom(uncropped.top()+uncropped.height()*boundingRect.bottom()/pageHeight);
actualRect.setLeft(uncropped.left()+uncropped.width()*boundingRect.left()/pageWidth);
actualRect.setRight(uncropped.left()+uncropped.width()*boundingRect.right()/pageWidth);
screenPainter.setPen( Qt::green );
screenPainter.drawRect( actualRect );
}
}
}
// 4) Layer 2: overlays // 4) Layer 2: overlays
if ( Okular::Settings::debugDrawBoundaries() ) if ( Okular::Settings::debugDrawBoundaries() )
{ {
@ -3816,7 +3847,7 @@ void PageView::selectionStart( const QPoint & pos, const QColor & color, bool /*
void PageView::scrollPosIntoView( const QPoint & pos ) void PageView::scrollPosIntoView( const QPoint & pos )
{ {
// this number slows the speed of the page by its value, chosen not to be too fast or too slow, the actual speed is determined from the mouse position, not critical // this number slows the speed of the page by its value, chosen not to be too fast or too slow, the actual speed is determined from the mouse position, not critical
const int damping=6; const int damping=6;
if (pos.x() < horizontalScrollBar()->value()) d->dragScrollVector.setX((pos.x() - horizontalScrollBar()->value())/damping); if (pos.x() < horizontalScrollBar()->value()) d->dragScrollVector.setX((pos.x() - horizontalScrollBar()->value())/damping);
else if (horizontalScrollBar()->value() + viewport()->width() < pos.x()) d->dragScrollVector.setX((pos.x() - horizontalScrollBar()->value() - viewport()->width())/damping); else if (horizontalScrollBar()->value() + viewport()->width() < pos.x()) d->dragScrollVector.setX((pos.x() - horizontalScrollBar()->value() - viewport()->width())/damping);

Loading…
Cancel
Save