From 7bae846bb4498dddbdf3f2b0f9a749318b5f3c8b Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Thu, 22 Mar 2018 14:53:19 +0100 Subject: [PATCH] Qt5: Allow setting of visibility Extends Qt5 API to allow setting visibility flags --- qt5/src/poppler-form.cc | 11 +++++++++++ qt5/src/poppler-form.h | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/qt5/src/poppler-form.cc b/qt5/src/poppler-form.cc index eee504b3..6aefacc2 100644 --- a/qt5/src/poppler-form.cc +++ b/qt5/src/poppler-form.cc @@ -162,6 +162,17 @@ bool FormField::isVisible() const return !(m_formData->fm->getWidgetAnnotation()->getFlags() & Annot::flagHidden); } +void FormField::setVisible(bool value) +{ + Guint flags = m_formData->fm->getWidgetAnnotation()->getFlags(); + if (value) { + flags &= ~Annot::flagHidden; + } else { + flags |= Annot::flagHidden; + } + m_formData->fm->getWidgetAnnotation()->setFlags(flags); +} + Link* FormField::activationAction() const { Link* action = nullptr; diff --git a/qt5/src/poppler-form.h b/qt5/src/poppler-form.h index d52f7e4b..a730b6ce 100644 --- a/qt5/src/poppler-form.h +++ b/qt5/src/poppler-form.h @@ -122,6 +122,11 @@ namespace Poppler { bool isVisible() const; /** + Set whether this form field is visible. + */ + void setVisible(bool value); + + /** The activation action of this form field. \note It may be null. -- 2.11.0