mirror of
https://invent.kde.org/graphics/okular
synced 2024-07-17 02:37:04 +00:00
d_ptr structure for the FormField classes, easier to expand in the future
svn path=/trunk/KDE/kdegraphics/okular/; revision=682922
This commit is contained in:
parent
8c42d8cf02
commit
32d3dff232
|
@ -12,18 +12,31 @@
|
|||
|
||||
using namespace Okular;
|
||||
|
||||
FormField::FormField( FormField::FieldType t )
|
||||
: m_type( t )
|
||||
class Okular::FormFieldPrivate
|
||||
{
|
||||
public:
|
||||
FormFieldPrivate( FormField::FieldType type )
|
||||
: m_type( type )
|
||||
{
|
||||
}
|
||||
|
||||
FormField::FieldType m_type;
|
||||
};
|
||||
|
||||
FormField::FormField( FormFieldPrivate &dd )
|
||||
: d_ptr( &dd )
|
||||
{
|
||||
}
|
||||
|
||||
FormField::~FormField()
|
||||
{
|
||||
delete d_ptr;
|
||||
}
|
||||
|
||||
FormField::FieldType FormField::type() const
|
||||
{
|
||||
return m_type;
|
||||
Q_D( const FormField );
|
||||
return d->m_type;
|
||||
}
|
||||
|
||||
bool FormField::isReadOnly() const
|
||||
|
@ -37,8 +50,18 @@ bool FormField::isVisible() const
|
|||
}
|
||||
|
||||
|
||||
class Okular::FormFieldTextPrivate : public Okular::FormFieldPrivate
|
||||
{
|
||||
public:
|
||||
FormFieldTextPrivate()
|
||||
: FormFieldPrivate( FormField::FormText )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FormFieldText::FormFieldText()
|
||||
: FormField( FormField::FormText )
|
||||
: FormField( *new FormFieldTextPrivate() )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -76,8 +99,18 @@ bool FormFieldText::canBeSpellChecked() const
|
|||
}
|
||||
|
||||
|
||||
class Okular::FormFieldChoicePrivate : public Okular::FormFieldPrivate
|
||||
{
|
||||
public:
|
||||
FormFieldChoicePrivate()
|
||||
: FormFieldPrivate( FormField::FormChoice )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FormFieldChoice::FormFieldChoice()
|
||||
: FormField( FormField::FormChoice )
|
||||
: FormField( *new FormFieldChoicePrivate() )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
18
core/form.h
18
core/form.h
|
@ -17,6 +17,10 @@
|
|||
|
||||
namespace Okular {
|
||||
|
||||
class FormFieldPrivate;
|
||||
class FormFieldTextPrivate;
|
||||
class FormFieldChoicePrivate;
|
||||
|
||||
/**
|
||||
* @short The base interface of a form field.
|
||||
*
|
||||
|
@ -79,11 +83,11 @@ class OKULAR_EXPORT FormField
|
|||
virtual bool isVisible() const;
|
||||
|
||||
protected:
|
||||
FormField( FieldType t );
|
||||
FormField( FormFieldPrivate &dd );
|
||||
Q_DECLARE_PRIVATE( FormField )
|
||||
FormFieldPrivate *d_ptr;
|
||||
|
||||
private:
|
||||
FieldType m_type;
|
||||
|
||||
Q_DISABLE_COPY( FormField )
|
||||
};
|
||||
|
||||
|
@ -162,6 +166,10 @@ class OKULAR_EXPORT FormFieldText : public FormField
|
|||
|
||||
protected:
|
||||
FormFieldText();
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE( FormFieldText )
|
||||
Q_DISABLE_COPY( FormFieldText )
|
||||
};
|
||||
|
||||
|
||||
|
@ -239,6 +247,10 @@ class OKULAR_EXPORT FormFieldChoice : public FormField
|
|||
|
||||
protected:
|
||||
FormFieldChoice();
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE( FormFieldChoice )
|
||||
Q_DISABLE_COPY( FormFieldChoice )
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue