Constructing a text highlight annotation with no text inside is pointless, don't do it.

BUG: 160502

svn path=/trunk/KDE/kdegraphics/okular/; revision=794917
remotes/origin/KDE/4.1
Pino Toscano 18 years ago
parent ffee5881d7
commit e1cf55dcea
  1. 24
      ui/pageviewannotator.cpp

@ -460,19 +460,23 @@ class TextSelectorEngine : public AnnotatorEngine
{ {
QPoint start( (int)( lastPoint.x * item()->width() ), (int)( lastPoint.y * item()->height() ) ); QPoint start( (int)( lastPoint.x * item()->width() ), (int)( lastPoint.y * item()->height() ) );
QPoint end( (int)( nX * item()->width() ), (int)( nY * item()->height() ) ); QPoint end( (int)( nX * item()->width() ), (int)( nY * item()->height() ) );
delete selection;
selection = 0;
Okular::RegularAreaRect * newselection = m_pageView->textSelectionForItem( item(), start, end ); Okular::RegularAreaRect * newselection = m_pageView->textSelectionForItem( item(), start, end );
QList<QRect> geom = newselection->geometry( (int)xScale, (int)yScale ); if ( !newselection->isEmpty() )
QRect newrect;
foreach( const QRect& r, geom )
{ {
if ( newrect.isNull() ) QList<QRect> geom = newselection->geometry( (int)xScale, (int)yScale );
newrect = r; QRect newrect;
else Q_FOREACH ( const QRect& r, geom )
newrect |= r; {
if ( newrect.isNull() )
newrect = r;
else
newrect |= r;
}
rect |= newrect;
selection = newselection;
} }
rect |= newrect;
delete selection;
selection = newselection;
} }
} }
else if ( type == Release && selection ) else if ( type == Release && selection )

Loading…
Cancel
Save