Question Class Reference

A model class, for describing a Question asked to the user. More...

#include <question.h>

Inheritance diagram for Question:

Inheritance graph
[legend]
List of all members.

Public Slots

virtual bool setValue (QVariant newValue)
 Has the side-effect of emitting a valueChanged() signal.

Public Member Functions

 Question (QString name, QString label, QVariant defaultValue=QString(), QVariant::Type type=QVariant::String)
 A question is a thing you ask the user.
 Question ()
virtual Qt::ItemFlags flags () const
virtual QString toString () const
virtual QVariant defaultValue () const
virtual QVariant value () const
virtual QVariant::Type type () const
 
Returns:
the type of value().

virtual QStringList choices () const
 For some Questions, there is a list of valid answers.
QString label () const
virtual ~Question ()

Protected Member Functions

void setType (QVariant::Type type)
void setLabel (QString label)

Protected Attributes

QString m_Label
QVariant m_Value
QVariant::Type m_Type
QVariant m_DefaultValue

Friends

class FormFactory

Detailed Description

A model class, for describing a Question asked to the user.

Still experimental.

Author:
Alan Ezust

Definition at line 16 of file question.h.


Constructor & Destructor Documentation

Question::Question ( QString  name,
QString  label,
QVariant  defaultValue = QString(),
QVariant::Type  type = QVariant::String 
)

A question is a thing you ask the user.

Parameters:
name - the property name
label - the prompt or label you want the user to see
defaultValue - the default value (if any) for this question
type - the type of the answer you want to get back

Definition at line 9 of file question.cpp.

References m_Label, m_Type, and m_Value.


Member Function Documentation

QVariant::Type Question::type (  )  const [virtual]

Returns:
the type of value().

If this is QVariant::StringList, it is used to hold a single String value, but the type is used to constrain the values to a list of strings. see choices()

Definition at line 34 of file question.cpp.

References m_Type.

Referenced by FormFactory::createEditor().

QStringList Question::choices (  )  const [virtual]

For some Questions, there is a list of valid answers.

Returns:
the list of valid answers, in the case where they can be enumerated as a stringlist

Reimplemented in ChoiceQuestion.

Definition at line 43 of file question.cpp.

Referenced by FormFactory::createEditor().

bool Question::setValue ( QVariant  newValue  )  [virtual, slot]

Has the side-effect of emitting a valueChanged() signal.

Returns:
false if there was an error setting the value (such as an invalid value)

Reimplemented in PropQuestion, and SettingsQuestion.

Definition at line 28 of file question.cpp.

References m_Value.

Referenced by FormModel::setProperty(), and FormModel::setValues().


The documentation for this class was generated from the following files:
Generated on Wed Sep 30 01:15:44 2009 for oopapidocs by  doxygen 1.5.1