mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
3D PDF: Open media viewer on double click
This commit is contained in:
@@ -434,6 +434,11 @@ const PDF3D_U3D_ContextManager::ContextData* PDF3D_U3D_ContextManager::getContex
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PDF3D_U3D PDF3D_U3D::parse(QByteArray data)
|
||||
{
|
||||
return PDF3D_U3D();
|
||||
}
|
||||
|
||||
} // namespace u3d
|
||||
|
||||
} // namespace pdf
|
||||
|
@@ -31,6 +31,8 @@ namespace u3d
|
||||
class PDF3D_U3D
|
||||
{
|
||||
public:
|
||||
|
||||
static PDF3D_U3D parse(QByteArray data);
|
||||
};
|
||||
|
||||
class PDF3D_U3D_ContextManager
|
||||
|
@@ -1039,6 +1039,23 @@ bool PDFAnnotation::isTypeEditable(AnnotationType type)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PDFAnnotation::isTypeMultimedia(AnnotationType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case AnnotationType::Sound:
|
||||
case AnnotationType::Movie:
|
||||
case AnnotationType::_3D:
|
||||
case AnnotationType::RichMedia:
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QPen PDFAnnotation::getPen() const
|
||||
{
|
||||
QColor strokeColor = getStrokeColor();
|
||||
@@ -1816,7 +1833,8 @@ void PDFWidgetAnnotationManager::mousePressEvent(QWidget* widget, QMouseEvent* e
|
||||
void PDFWidgetAnnotationManager::mouseDoubleClickEvent(QWidget* widget, QMouseEvent* event)
|
||||
{
|
||||
Q_UNUSED(widget);
|
||||
Q_UNUSED(event);
|
||||
|
||||
updateFromMouseEvent(event);
|
||||
}
|
||||
|
||||
void PDFWidgetAnnotationManager::mouseReleaseEvent(QWidget* widget, QMouseEvent* event)
|
||||
@@ -1967,6 +1985,16 @@ void PDFWidgetAnnotationManager::updateFromMouseEvent(QMouseEvent* event)
|
||||
Q_EMIT actionTriggered(linkAction);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute multimedia annotation
|
||||
if (event->type() == QEvent::MouseButtonDblClick && event->button() == Qt::LeftButton)
|
||||
{
|
||||
const PDFAnnotation* annotation = pageAnnotation.annotation.get();
|
||||
if (PDFAnnotation::isTypeMultimedia(annotation->getType()))
|
||||
{
|
||||
emit multimediaTriggered(annotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -601,6 +601,10 @@ public:
|
||||
/// \param type Annotation type
|
||||
static bool isTypeEditable(AnnotationType type);
|
||||
|
||||
/// Returns true, if annotation is multimedia
|
||||
/// \param type Annotation type
|
||||
static bool isTypeMultimedia(AnnotationType type);
|
||||
|
||||
protected:
|
||||
virtual QColor getStrokeColor() const;
|
||||
virtual QColor getFillColor() const;
|
||||
@@ -1655,8 +1659,9 @@ public:
|
||||
virtual int getInputPriority() const override { return AnnotationPriority; }
|
||||
|
||||
signals:
|
||||
void actionTriggered(const PDFAction* action);
|
||||
void documentModified(PDFModifiedDocument document);
|
||||
void actionTriggered(const pdf::PDFAction* action);
|
||||
void multimediaTriggered(const pdf::PDFAnnotation* annotation);
|
||||
void documentModified(pdf::PDFModifiedDocument document);
|
||||
|
||||
private:
|
||||
void updateFromMouseEvent(QMouseEvent* event);
|
||||
|
Reference in New Issue
Block a user