From f88b9be6bbec36050046d483b29c485ae0cb89cb Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Wed, 6 Nov 2019 14:44:53 -0500 Subject: [PATCH] [helm] explore how to do this --- ui/pageview.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/ui/pageview.cpp b/ui/pageview.cpp index e8e3be440..f3230aa1a 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -1824,6 +1824,16 @@ void PageView::paintEvent(QPaintEvent *pe) 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 pixmapPainter.end(); screenPainter.drawPixmap( contentsRect.left(), contentsRect.top(), doubleBuffer ); @@ -1859,6 +1869,27 @@ void PageView::paintEvent(QPaintEvent *pe) // 3b) Layer 1: give mouseAnnotation painting control 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 if ( Okular::Settings::debugDrawBoundaries() ) { @@ -3816,7 +3847,7 @@ void PageView::selectionStart( const QPoint & pos, const QColor & color, bool /* 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 - const int damping=6; + const int damping=6; 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);