AccountViewModel Class Reference

Model for the account view. More...

#include <accountviewmodel.h>

List of all members.

Public Member Functions

 AccountViewModel (AccountList *accounts, QObject *parent)
 Constructor.
 ~AccountViewModel ()
 Destructor.
virtual QModelIndex index (int row, int column, const QModelIndex &parent) const
 Returns the index of the account data in this model specified by the given row, column.
virtual QModelIndex parent (const QModelIndex &) const
 Overloaded from QAbstractItemModel.
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const
 Overloaded from QAbstractItemModel.
virtual int columnCount (const QModelIndex &) const
 Overloaded from QAbstractItemModel.
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 Overloaded from QAbstractItemModel.
virtual bool hasChildren (const QModelIndex &parent=QModelIndex()) const
 Overloaded from QAbstractItemModel.
virtual Qt::ItemFlags flags (const QModelIndex &index) const
 Returns the flags of the given index.
QVariant headerData (int section, Qt::Orientation orientation, int role) const
 Returns the header text of the given section.
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
 Assign the given value to the account property described by the given index.
void refresh ()
 Emits the dataChanged signal to the views to inform they about changed data.
void sort (int column, Qt::SortOrder order=Qt::AscendingOrder)
 Sorts the model by column in the given order.
void sort ()
 Sorts the model by the last sort properties.
void saveSetup ()
 Saves the setup.
AccountgetAccount (const QModelIndex index) const
 Returns the account at the given index.


Detailed Description

Model for the account view.

Definition at line 46 of file accountviewmodel.h.


Constructor & Destructor Documentation

AccountViewModel::AccountViewModel ( AccountList accounts,
QObject *  parent 
)

Constructor.

Parameters:
accounts pointer to the account list
parent parent object

Definition at line 20 of file accountviewmodel.cpp.


Member Function Documentation

QModelIndex AccountViewModel::index ( int  row,
int  column,
const QModelIndex &  parent 
) const [virtual]

Returns the index of the account data in this model specified by the given row, column.

The parent index is not used. Overloaded from QAbstractItemModel

Parameters:
row Row
column Column
parent parent index; not used

Definition at line 35 of file accountviewmodel.cpp.

QModelIndex AccountViewModel::parent ( const QModelIndex &   )  const [virtual]

Overloaded from QAbstractItemModel.

Because this model doesn't provide tree structured data this function just returns an invalid index.

Definition at line 44 of file accountviewmodel.cpp.

int AccountViewModel::rowCount ( const QModelIndex &  parent = QModelIndex()  )  const [virtual]

Overloaded from QAbstractItemModel.

Doesn't give a parent item, because the model doesn't provide tree structured data The row count is equal to the number of accounts.

Parameters:
parent parent index

Definition at line 49 of file accountviewmodel.cpp.

int AccountViewModel::columnCount ( const QModelIndex &   )  const [virtual]

Overloaded from QAbstractItemModel.

Doesn't give a parent item, because the model doesn't provide tree structured data. The column count is equal to the number of showed account data. Always returns 6.

Definition at line 57 of file accountviewmodel.cpp.

QVariant AccountViewModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const [virtual]

Overloaded from QAbstractItemModel.

Returns the data of the given index.

Parameters:
index the index
role the role

Definition at line 62 of file accountviewmodel.cpp.

bool AccountViewModel::hasChildren ( const QModelIndex &  parent = QModelIndex()  )  const [virtual]

Overloaded from QAbstractItemModel.

It returns true if the given index is invalid because a invalid index is the root index. All content is a child of the root index. If the index is valid it always returns false because no data has a child.

Parameters:
parent parent index

Definition at line 134 of file accountviewmodel.cpp.

Qt::ItemFlags AccountViewModel::flags ( const QModelIndex &  index  )  const [virtual]

Returns the flags of the given index.

Parameters:
index index

Definition at line 143 of file accountviewmodel.cpp.

QVariant AccountViewModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const

Returns the header text of the given section.

Parameters:
section header section
orientation orientation of the header; just returns the horizontal orientation
role display role

Definition at line 156 of file accountviewmodel.cpp.

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

Assign the given value to the account property described by the given index.

Parameters:
index index
value value
role role

Definition at line 174 of file accountviewmodel.cpp.

void AccountViewModel::sort ( int  column,
Qt::SortOrder  order = Qt::AscendingOrder 
)

Sorts the model by column in the given order.

Parameters:
column column to sort
order sort order

Definition at line 214 of file accountviewmodel.cpp.

Account * AccountViewModel::getAccount ( const QModelIndex  index  )  const

Returns the account at the given index.

Parameters:
index index

Definition at line 317 of file accountviewmodel.cpp.


The documentation for this class was generated from the following files:

Generated on Tue May 18 19:43:53 2010 for KShowmail by  doxygen 1.5.6