itom 1.3.0
|
class for for visualizing the available users More...
#include <UserModel.h>
Public Member Functions | |
UserModel () | |
~UserModel () | |
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) |
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< UserInfoStruct > | m_userInfo |
list with user information |
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.
UserModel::UserModel | ( | ) |
constructor
contructor, creating column headers for the tree view
UserModel::~UserModel | ( | ) |
destructor - clean up, clear header and alignment list
int UserModel::addUser | ( | const UserInfoStruct & | newUser | ) |
Adds a user to the current model
newUser | Struct containing new User |
returns the passed row as index, as the users are arranged in a simple one dimensional list
int UserModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
return column count
[in] | parent | parent of current item |
QVariant UserModel::data | ( | const QModelIndex & | index, |
int | role | ||
) | const |
return data elements for a given row
[in] | index | index for which the data elements should be delivered |
[in] | role | the current role of the model |
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 UserModel::headerData | ( | int | section, |
Qt::Orientation | orientation, | ||
int | role = Qt::DisplayRole |
||
) | const |
return the header / captions for the tree view model
QModelIndex UserModel::index | ( | int | row, |
int | column, | ||
const QModelIndex & | parent = QModelIndex() |
||
) | const |
return current index element
[in] | row | row of current element |
[in] | column | column of current element |
[in] | parent | parent of current element |
returns the passed row as index, as the users are arranged in a simple one dimensional list
QModelIndex UserModel::parent | ( | const QModelIndex & | index | ) | const |
return parent element
[in] | index | the element's index for which the parent should be returned |
int UserModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
return number of rows
[in] | parent | parent of current item |