Annotation tooltips

This commit is contained in:
Jakub Melka
2020-04-12 18:12:42 +02:00
parent dc7dd8fe74
commit 6c746ba901
4 changed files with 299 additions and 58 deletions

View File

@ -19,6 +19,7 @@
#include "pdfdrawspacecontroller.h"
#include "pdfcompiler.h"
#include "pdfwidgettool.h"
#include "pdfannotation.h"
#include <QPainter>
#include <QGridLayout>
@ -232,6 +233,17 @@ void PDFDrawWidgetBase<BaseWidget>::keyPressEvent(QKeyEvent* event)
}
}
if (PDFWidgetAnnotationManager* annotationManager = getPDFWidget()->getDrawWidgetProxy()->getAnnotationManager())
{
annotationManager->keyPressEvent(this, event);
setToolTip(annotationManager->getTooltip());
if (event->isAccepted())
{
updateCursor();
return;
}
}
// Vertical navigation
QScrollBar* verticalScrollbar = m_widget->getVerticalScrollbar();
if (verticalScrollbar->isVisible())
@ -275,6 +287,17 @@ void PDFDrawWidgetBase<BaseWidget>::mousePressEvent(QMouseEvent* event)
}
}
if (PDFWidgetAnnotationManager* annotationManager = getPDFWidget()->getDrawWidgetProxy()->getAnnotationManager())
{
annotationManager->mousePressEvent(this, event);
setToolTip(annotationManager->getTooltip());
if (event->isAccepted())
{
updateCursor();
return;
}
}
if (event->button() == Qt::LeftButton)
{
m_mouseOperation = MouseOperation::Translate;
@ -301,6 +324,17 @@ void PDFDrawWidgetBase<BaseWidget>::mouseReleaseEvent(QMouseEvent* event)
}
}
if (PDFWidgetAnnotationManager* annotationManager = getPDFWidget()->getDrawWidgetProxy()->getAnnotationManager())
{
annotationManager->mouseReleaseEvent(this, event);
setToolTip(annotationManager->getTooltip());
if (event->isAccepted())
{
updateCursor();
return;
}
}
performMouseOperation(event->pos());
switch (m_mouseOperation)
@ -338,6 +372,17 @@ void PDFDrawWidgetBase<BaseWidget>::mouseMoveEvent(QMouseEvent* event)
}
}
if (PDFWidgetAnnotationManager* annotationManager = getPDFWidget()->getDrawWidgetProxy()->getAnnotationManager())
{
annotationManager->mouseMoveEvent(this, event);
setToolTip(annotationManager->getTooltip());
if (event->isAccepted())
{
updateCursor();
return;
}
}
performMouseOperation(event->pos());
updateCursor();
event->accept();
@ -395,6 +440,17 @@ void PDFDrawWidgetBase<BaseWidget>::wheelEvent(QWheelEvent* event)
}
}
if (PDFWidgetAnnotationManager* annotationManager = getPDFWidget()->getDrawWidgetProxy()->getAnnotationManager())
{
annotationManager->wheelEvent(this, event);
setToolTip(annotationManager->getTooltip());
if (event->isAccepted())
{
updateCursor();
return;
}
}
Qt::KeyboardModifiers keyboardModifiers = QApplication::keyboardModifiers();
PDFDrawWidgetProxy* proxy = m_widget->getDrawWidgetProxy();