diff --git a/ui/annotationmodel.cpp b/ui/annotationmodel.cpp index 37a48f9c1adab96159c800fbf15346049d514987..d6d234d754d581327621abdee258f6bc9e4c1f33 100644 --- a/ui/annotationmodel.cpp +++ b/ui/annotationmodel.cpp @@ -36,6 +36,20 @@ struct AnnItem int page; }; +static QLinkedList< Okular::Annotation* > filterOutWidgetAnnotations( const QLinkedList< Okular::Annotation* > &annotations ) +{ + QLinkedList< Okular::Annotation* > result; + + foreach ( Okular::Annotation *annotation, annotations ) + { + if ( annotation->subType() == Okular::Annotation::AWidget ) + continue; + + result.append( annotation ); + } + + return result; +} class AnnotationModelPrivate : public Okular::DocumentObserver { @@ -115,7 +129,7 @@ void AnnotationModelPrivate::notifyPageChanged( int page, int flags ) if ( !(flags & Okular::DocumentObserver::Annotations ) ) return; - QLinkedList< Okular::Annotation* > annots = document->page( page )->annotations(); + const QLinkedList< Okular::Annotation* > annots = filterOutWidgetAnnotations( document->page( page )->annotations() ); int annItemIndex = -1; AnnItem *annItem = findItem( page, &annItemIndex ); // case 1: the page has no more annotations @@ -231,7 +245,7 @@ void AnnotationModelPrivate::rebuildTree( const QVector< Okular::Page * > &pages emit q->layoutAboutToBeChanged(); for ( int i = 0; i < pages.count(); ++i ) { - QLinkedList< Okular::Annotation* > annots = pages.at( i )->annotations(); + const QLinkedList< Okular::Annotation* > annots = filterOutWidgetAnnotations( pages.at( i )->annotations() ); if ( annots.isEmpty() ) continue; diff --git a/ui/pageview.cpp b/ui/pageview.cpp index e5ec39b7152ad5ef241ada577124f591d01fb350..4e0256005257610be2003a02693576e53dae2b8a 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -2057,7 +2057,7 @@ void PageView::mousePressEvent( QMouseEvent * e ) foreach ( const Okular::ObjectRect * orect, orects ) { Okular::Annotation * ann = ( (Okular::AnnotationObjectRect *)orect )->annotation(); - if ( ann ) + if ( ann && (ann->subType() != Okular::Annotation::AWidget) ) popup.addAnnotation( ann, pageItem->pageNumber() ); }