#include <tablemodel.h>
Public Member Functions | |
| TableModel (QObject *parent=0) | |
| TableModel (QList< Process > listofPairs, QObject *parent=0) | |
| ~TableModel () | |
| int | rowCount (const QModelIndex &parent) const |
| int | columnCount (const QModelIndex &parent) const |
| QVariant | data (const QModelIndex &index, int role) const |
| QVariant | headerData (int section, Qt::Orientation orientation, int role) const |
| Qt::ItemFlags | flags (const QModelIndex &index) const |
| bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) |
| bool | insertRows (int position, int rows, const QModelIndex &index=QModelIndex()) |
| bool | removeRows (int position, int rows, const QModelIndex &index=QModelIndex()) |
| bool | refillRows (const QModelIndex &index=QModelIndex()) |
| QList< Process > | getList () |
Public Attributes | |
| std::string | lsof_pid |
| PreviewWindow | fileList |
Private Slots | |
| void | refreshTable () |
| void | rowSelected (QModelIndex index) |
Private Attributes | |
| QTimer * | timer |
| QList< Process > | listOfProcesses |
| TableModel::TableModel | ( | QObject * | parent = 0 |
) |
Constructor. Initializes a ProcessExtractor type object, populates a list by function calls to select rows from database. Raises signal every 3 seconds to call refreshTable() so that list of running processing is refrehed in the database and hence the table.
| TableModel::TableModel | ( | QList< Process > | pairs, | |
| QObject * | parent = 0 | |||
| ) |
Contructor to assign data member listOfProcesses with
| pairs |
| TableModel::~TableModel | ( | ) |
| int TableModel::columnCount | ( | const QModelIndex & | parent | ) | const |
Returns the number of columns in database and table
| QVariant TableModel::data | ( | const QModelIndex & | index, | |
| int | role | |||
| ) | const |
Depending on the
| index | passed, function returns appropriate value in corresponding row-column pair |
| Qt::ItemFlags TableModel::flags | ( | const QModelIndex & | index | ) | const |
Function to set flag values
| QList< Process > TableModel::getList | ( | ) |
| QVariant TableModel::headerData | ( | int | section, | |
| Qt::Orientation | orientation, | |||
| int | role | |||
| ) | const |
Function to assign header information on the table
| bool TableModel::insertRows | ( | int | position, | |
| int | rows, | |||
| const QModelIndex & | index = QModelIndex() | |||
| ) |
Function to insert empty rows into the table
| bool TableModel::refillRows | ( | const QModelIndex & | index = QModelIndex() |
) |
Function called when timer signal raised. Refrehes database and table rows with afresh with latest process information
| void TableModel::refreshTable | ( | ) | [private, slot] |
Slot being called when timer signal is raised.
| bool TableModel::removeRows | ( | int | position, | |
| int | rows, | |||
| const QModelIndex & | index = QModelIndex() | |||
| ) |
Function to remove
| rows | number of rows from given | |
| position |
| int TableModel::rowCount | ( | const QModelIndex & | parent | ) | const |
Returns the size of listOfProcesses
| void TableModel::rowSelected | ( | QModelIndex | index | ) | [private, slot] |
This is a slot raised by signal of row being double clicked in a table. It initiates the pop up window displaying all files used by the selected process.
| bool TableModel::setData | ( | const QModelIndex & | index, | |
| const QVariant & | value, | |||
| int | role = Qt::EditRole | |||
| ) |
QList< Process > TableModel::listOfProcesses [private] |
| std::string TableModel::lsof_pid |
QTimer* TableModel::timer [private] |
1.4.7