itom 2.0.0
ito::UserModel Class Reference

class for for visualizing the available users More...

#include <UserModel.h>

List of all members.

Public Types

enum  UserModelIndex {
  umiName = 0, umiId = 1, umiRole = 2, umiIniFile = 3,
  umiFeatures = 4
}

Public Member Functions

 UserModel ()
 ~UserModel ()
QString getRoleName (const UserRole &role) const
QString getFeatureName (const UserFeature &feature) const
QVariant data (const QModelIndex &index, int role) const
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
QModelIndex index (int row, int column, 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
int addUser (const UserInfoStruct &newUser)
void removeAllUsers ()
bool removeUser (const QModelIndex &index)

Private Attributes

QList< QString > m_headers
 string list of names of column headers
QList< QVariant > m_alignment
 list of alignments for the corresponding headers
QList< UserInfoStructm_userInfo
 list with user information

Detailed Description

class for for visualizing the available users

The UserModel is used in the initially shown user list. It contains the userId (which is the user name part of the ini-file name), the plain text user name and the ini-file.


Constructor & Destructor Documentation

ito::UserModel::UserModel ( )

constructor

contructor, creating column headers for the tree view

ito::UserModel::~UserModel ( )

destructor - clean up, clear header and alignment list


Member Function Documentation

int ito::UserModel::addUser ( const UserInfoStruct newUser)

Adds a user to the current model

Parameters:
newUserStruct containing new User
Returns:
QModelIndex - index of the position in the list where the user was added

returns the passed row as index, as the users are arranged in a simple one dimensional list

int ito::UserModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const

return column count

Parameters:
[in]parentparent of current item
Returns:
2 for child elements (instances) and the header size for root elements (plugins)
QVariant ito::UserModel::data ( const QModelIndex &  index,
int  role 
) const

return data elements for a given row

Parameters:
[in]indexindex for which the data elements should be delivered
[in]rolethe current role of the model
Returns:
data of the selected element, depending on the element's row and column (passed in index.row and index.column)

This method is actually used to fill the tree view. It returns the data for the selected element, depending as well on the column of the selected element, passed in index.column. The method here is divded into two parts. The first one handels requests for root elements (plugins) the second one is used for child elements (instances of plugins).

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

return the header / captions for the tree view model

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

return current index element

Parameters:
[in]rowrow of current element
[in]columncolumn of current element
[in]parentparent of current element
Returns:
QModelIndex - element at current index

returns the passed row as index, as the users are arranged in a simple one dimensional list

QModelIndex ito::UserModel::parent ( const QModelIndex &  index) const

return parent element

Parameters:
[in]indexthe element's index for which the parent should be returned
Returns:
the parent element.
int ito::UserModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const

return number of rows

Parameters:
[in]parentparent of current item
Returns:
returns number of users

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends