PropertyModel Class Reference

The PropertyModel class creates and provides the visual property items of a module. More...

#include <property_model.h>

Collaboration diagram for PropertyModel:

Collaboration graph
List of all members.

Public Slots

bool createPropertySheet (ModuleInterface *)

Public Member Functions

 PropertyModel ()
 ~PropertyModel ()
IPropertyrootProperty () const
void clear ()
bool setData (const QModelIndex &, const QVariant &, int role=Qt::EditRole)
QVariant data (const QModelIndex &, int role=Qt::DisplayRole) const
QModelIndex index (int, int, const QModelIndex &parent=QModelIndex()) const
QModelIndex parent (const QModelIndex &index) const
int rowCount (const QModelIndex &parent=QModelIndex()) const
int columnCount (const QModelIndex &parent=QModelIndex()) const
QVariant headerData (int, Qt::Orientation, int role=Qt::DisplayRole) const
Qt::ItemFlags flags (const QModelIndex &) const

Private Attributes


Detailed Description

It maps the intern properties of a module to a visual editable property sheet. The visual properties of a module is represented as a tree
See also:
PropertyDelegate, PropertyData and ModuleInterface

Constructor & Destructor Documentation

PropertyModel::PropertyModel (  ) 

PropertyModel::~PropertyModel (  ) 

Member Function Documentation

void PropertyModel::clear (  ) 

deletes all visual properties in the tree

int PropertyModel::columnCount ( const QModelIndex &  parent = QModelIndex()  )  const

every time 2 because we need only two columns

bool PropertyModel::createPropertySheet ( ModuleInterface module  )  [slot]

creates the visual property tree of a module. Most of the QVariant types are supported see AbstractProperty for details.

it's not necessary to show the visual property tree it can also be used to generate complex properties of a module like QPen or QBrush for example XmlWrite and XmlRead used this method to generate the xml structure of a property
UnsupportedException is thrown when the module has a property item that is not supported
module with a NULL pointer the property tree will be deleted otherwise the visual property tree will be created
true on success otherwise false
See also:

QVariant PropertyModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const

returns information how a property look like or which property value will be set on different roles.

index gives the current index
role determine what kind of data is returned
depends on which role was given

Qt::ItemFlags PropertyModel::flags ( const QModelIndex &  index  )  const

if a cell is editable or not

QVariant PropertyModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const

the column text specified by the given section number

QModelIndex PropertyModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const

the index of the item in the model specified by the given row, column and parent index

QModelIndex PropertyModel::parent ( const QModelIndex &  index  )  const

the parent of the model item with the given index, or QModelIndex() if it has no parent

IProperty * PropertyModel::rootProperty (  )  const

the root node of the visual property tree

int PropertyModel::rowCount ( const QModelIndex &  parent = QModelIndex()  )  const

the number of rows under the given parent

bool PropertyModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 

set the changed visual property value to intern property value of the module

index determines where the property was changed
value not used we get the value direct from the property item
role determines on which role was the property changed
true on success otherwise false

Member Data Documentation

ModuleInterface* PropertyModel::m_module [private]

active module

IProperty* PropertyModel::m_rootItem [private]

root node of the visual property tree

The documentation for this class was generated from the following files:
Generated on Thu Apr 5 13:13:18 2007 for LCDBuilder by  doxygen 1.4.7