#include <defaultvariablemodel.h>
|
virtual int | columnCount (const QModelIndex &parent=QModelIndex()) const |
|
virtual QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
|
virtual Qt::ItemFlags | flags (const QModelIndex &index) const |
|
virtual QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
|
virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
|
virtual bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) |
|
This DefaultVariableModel class is an implementation of QAbstractItemModel that can be used with the Variable Manager plugin.
For most uses the addVariable(), removeVariable() and clearVariables() methods are sufficient. They can be used from session (directly or by connecting signals to them), or called from a subclass.
DefaultVariableModel uses the session to run expressions for changing variables, and it gets the commands from the backend's VariableManagementExtension. If you do not want this behavior, you can subclass it and reimplement data() and/or setData().
- See also
- Session::variableModel()
Definition at line 47 of file defaultvariablemodel.h.
Cantor::DefaultVariableModel::DefaultVariableModel |
( |
Session * |
session | ) |
|
|
explicit |
Cantor::DefaultVariableModel::~DefaultVariableModel |
( |
| ) |
|
|
virtual |
void Cantor::DefaultVariableModel::addVariable |
( |
const QString & |
name, |
|
|
const QString & |
value |
|
) |
| |
|
slot |
Adds a variable to the model.
If a variable with the same name already exists, it will be overwritten.
- Parameters
-
name | the name of the variable |
value | the value of the variable |
Definition at line 142 of file defaultvariablemodel.cpp.
void Cantor::DefaultVariableModel::addVariable |
( |
const Variable & |
variable | ) |
|
|
slot |
Convenience method, equivalent to addVariable(variable.name, variable.value)
- Parameters
-
variable | the variable to add |
Definition at line 150 of file defaultvariablemodel.cpp.
void Cantor::DefaultVariableModel::clearVariables |
( |
| ) |
|
|
slot |
int Cantor::DefaultVariableModel::columnCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
protectedvirtual |
QVariant Cantor::DefaultVariableModel::data |
( |
const QModelIndex & |
index, |
|
|
int |
role = Qt::DisplayRole |
|
) |
| const |
|
protectedvirtual |
Qt::ItemFlags Cantor::DefaultVariableModel::flags |
( |
const QModelIndex & |
index | ) |
const |
|
protectedvirtual |
QVariant Cantor::DefaultVariableModel::headerData |
( |
int |
section, |
|
|
Qt::Orientation |
orientation, |
|
|
int |
role = Qt::DisplayRole |
|
) |
| const |
|
protectedvirtual |
void Cantor::DefaultVariableModel::removeVariable |
( |
const QString & |
name | ) |
|
|
slot |
Remove the variable name
from the model.
If a variable with the specified name
doesn't exists, this method does nothing.
- Parameters
-
name | the name of the variable to remove |
Definition at line 162 of file defaultvariablemodel.cpp.
void Cantor::DefaultVariableModel::removeVariable |
( |
const Variable & |
variable | ) |
|
|
slot |
Convenience method, equivalent to removeVariable(variable.name)
- Parameters
-
variable | the variable to remove |
Definition at line 169 of file defaultvariablemodel.cpp.
int Cantor::DefaultVariableModel::rowCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
protectedvirtual |
Session* Cantor::DefaultVariableModel::session |
( |
| ) |
const |
Get the session which created this Model and whose variables it contains.
- Returns
- the session
bool Cantor::DefaultVariableModel::setData |
( |
const QModelIndex & |
index, |
|
|
const QVariant & |
value, |
|
|
int |
role = Qt::EditRole |
|
) |
| |
|
protectedvirtual |
Session * Cantor::DefaultVariableModel::session |
|
read |
The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:50 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.