Hello, I appended a patch which adds accessors for the editChoice property of the FormWidgetChoice class. They are modelled on the corresponding methods for the contents property of FormWidgetText class and its accessors in FormFieldText. Tested it with a very limited number of PDF files.
Best regards, Adam. On 16.10.2012 22:29, Albert Astals Cid wrote: > El Dimarts, 16 d'octubre de 2012, a les 17:58:58, Adam Reichold va escriure: >> Hello, > > Hi > >> >> Upon making use of the form support in qt4 frontend, I stumbled upon >> the following question: If a FormFieldChoice of ChoiceType ComboBox is >> editable, the user can type in any desired value which should then >> probably be added to the available choices. But how can I add a custom >> choice as there is no FormFieldChoice::setChoices? > > You can't > > Seems we forgot to wrap FormFieldChoice::setEditChoice > > Do you feel like adding it? > > Cheers, > Albert > >> >> Thanks for any advice. Best regards, Adam. > _______________________________________________ > poppler mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/poppler >
From 1a79beeeb36f6689926633f7e6ab902a26513ac0 Mon Sep 17 00:00:00 2001 From: Adam Reichold <[email protected]> Date: Wed, 17 Oct 2012 08:27:13 +0200 Subject: [PATCH] added accessors for FormWidgetChoice::editChoice property to qt4 frontend --- qt4/src/poppler-form.cc | 22 ++++++++++++++++++++++ qt4/src/poppler-form.h | 14 ++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/qt4/src/poppler-form.cc b/qt4/src/poppler-form.cc index f072356..ddd4cfc 100644 --- a/qt4/src/poppler-form.cc +++ b/qt4/src/poppler-form.cc @@ -379,6 +379,28 @@ void FormFieldChoice::setCurrentChoices( const QList<int> &choice ) fwc->select( choice.at( i ) ); } +QString FormFieldChoice::editChoice() const +{ + FormWidgetChoice* fwc = static_cast<FormWidgetChoice*>(m_formData->fm); + + if ( fwc->isCombo() && fwc->hasEdit() ) + return UnicodeParsedString(fwc->getEditChoice()); + else + return QString(); +} + +void FormFieldChoice::setEditChoice(const QString& text) +{ + FormWidgetChoice* fwc = static_cast<FormWidgetChoice*>(m_formData->fm); + + if ( fwc->isCombo() && fwc->hasEdit() ) + { + GooString* goo = QStringToUnicodeGooString( text ); + fwc->setEditChoice( goo ); + delete goo; + } +} + Qt::Alignment FormFieldChoice::textAlignment() const { return formTextAlignment(m_formData->fm); diff --git a/qt4/src/poppler-form.h b/qt4/src/poppler-form.h index 9af367b..e6b2113 100644 --- a/qt4/src/poppler-form.h +++ b/qt4/src/poppler-form.h @@ -305,6 +305,20 @@ namespace Poppler { Sets the selected choices to \p choice. */ void setCurrentChoices( const QList<int> &choice ); + + /** + The text entered into an editable combo box choice field. Otherwise a null string. + + \since 0.22 + */ + QString editChoice() const; + + /** + Sets the text entered into an editable combo box choice field. Otherwise does nothing. + + \since 0.22 + */ + void setEditChoice(const QString& text); /** The horizontal alignment for the text of this text field. -- 1.7.12.3
signature.asc
Description: OpenPGP digital signature
_______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
