Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

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

Show tooltip for annotations without handle too

Summary: BUG: 384147

Reviewers: rkflx

Reviewed By: rkflx

Subscribers: ngraham, rkflx, tobiasdeiminger, #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D7874
parent 1364d0e9
......@@ -232,26 +232,21 @@ void MouseAnnotation::routeKeyPressEvent( const QKeyEvent * e )
void MouseAnnotation::routeTooltipEvent( const QHelpEvent * helpEvent )
{
/* qDebug() << "MouseAnnotation::routeTooltipEvent, event " << helpEvent; */
const QPoint eventPos = m_pageView->contentAreaPoint( helpEvent->pos() );
if ( m_mouseOverAnnotation.isValid() &&
m_mouseOverAnnotation.annotation->subType() != Okular::Annotation::AWidget )
{
const ResizeHandle handle = getHandleAt( eventPos - m_mouseOverAnnotation.pageViewItem->uncroppedGeometry().topLeft(), m_mouseOverAnnotation );
if ( handle != RH_None )
{
/* get boundingRect in uncropped page coordinates */
QRect boundingRect = Okular::AnnotationUtils::annotationGeometry(
m_mouseOverAnnotation.annotation, m_mouseOverAnnotation.pageViewItem->uncroppedWidth(),
m_mouseOverAnnotation.pageViewItem->uncroppedHeight() );
/* uncropped page to content area */
boundingRect.translate( m_mouseOverAnnotation.pageViewItem->uncroppedGeometry().topLeft() );
/* content area to viewport */
boundingRect.translate( -m_pageView->contentAreaPosition() );
QString tip = GuiUtils::prettyToolTip( m_mouseOverAnnotation.annotation );
QToolTip::showText( helpEvent->globalPos(), tip, m_pageView->viewport(), boundingRect );
}
/* get boundingRect in uncropped page coordinates */
QRect boundingRect = Okular::AnnotationUtils::annotationGeometry(
m_mouseOverAnnotation.annotation, m_mouseOverAnnotation.pageViewItem->uncroppedWidth(),
m_mouseOverAnnotation.pageViewItem->uncroppedHeight() );
/* uncropped page to content area */
boundingRect.translate( m_mouseOverAnnotation.pageViewItem->uncroppedGeometry().topLeft() );
/* content area to viewport */
boundingRect.translate( -m_pageView->contentAreaPosition() );
const QString tip = GuiUtils::prettyToolTip( m_mouseOverAnnotation.annotation );
QToolTip::showText( helpEvent->globalPos(), tip, m_pageView->viewport(), boundingRect );
}
}
......
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