[poppler] qt4/src

Pino Toscano pino at kemper.freedesktop.org
Sun Feb 27 07:44:06 PST 2011


 qt4/src/poppler-form.cc |   25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

New commits:
commit e927384897595f1bda5f7e41b552602f9cc8ed95
Author: Pino Toscano <pino at kde.org>
Date:   Sun Feb 27 16:39:59 2011 +0100

    [qt4] fix caption of push button fields
    
    instead of asking the 'onStr' of the underlying form widget,
    take (if available) the 'MK' entry, i.e. the appearance characteristics dictionary,
    and use the normal caption of that

diff --git a/qt4/src/poppler-form.cc b/qt4/src/poppler-form.cc
index 40376e5..5c54681 100644
--- a/qt4/src/poppler-form.cc
+++ b/qt4/src/poppler-form.cc
@@ -200,8 +200,29 @@ FormFieldButton::ButtonType FormFieldButton::buttonType() const
 QString FormFieldButton::caption() const
 {
   FormWidgetButton* fwb = static_cast<FormWidgetButton*>(m_formData->fm);
-  GooString *goo = fwb->getOnStr();
-  return goo ? QString::fromUtf8(goo->getCString()) : QString();
+  QString ret;
+  if (fwb->getButtonType() == formButtonPush)
+  {
+    Dict *dict = m_formData->fm->getObj()->getDict();
+    Object obj1;
+    if (dict->lookup("MK", &obj1)->isDict())
+    {
+      AnnotAppearanceCharacs appearCharacs(obj1.getDict());
+      if (appearCharacs.getNormalCaption())
+      {
+        ret = UnicodeParsedString(appearCharacs.getNormalCaption());
+      }
+    }
+    obj1.free();
+  }
+  else
+  {
+    if (GooString *goo = fwb->getOnStr())
+    {
+      ret = QString::fromUtf8(goo->getCString());
+    }
+  }
+  return ret;
 }
 
 bool FormFieldButton::state() const


More information about the poppler mailing list