QtPdCom
1.3.3
|
Table model. More...
#include <TableModel.h>
Classes | |
struct | Exception |
Exception type. More... | |
class | Impl |
Table model. More... | |
Public Slots | |
void | commit () |
Commits all edited data. More... | |
void | revert () |
Reverts all edited data. More... | |
void | addRow () |
updates the visibleRowCount variable. More... | |
void | addRowAndCopyLast () |
updates the visibleRowCount variable with initialization. More... | |
void | remRow () |
Signals | |
void | editingChanged (bool) |
Public Member Functions | |
TableModel (QObject *parent=nullptr) | |
Constructor. More... | |
~TableModel () | |
Destructor. More... | |
void | addColumn (TableColumn *) |
Adds a column. More... | |
void | insertColumn (TableColumn *, int position) |
void | removeColumn (TableColumn *) |
void | clearColumns () |
Clears the Columns. More... | |
bool | isEditing () const |
unsigned int | getRowCapacity () const |
bool | hasVisibleRowsVariable () const |
virtual int | rowCount (const QModelIndex &) const |
Implements the model interface. More... | |
virtual int | columnCount (const QModelIndex &) const |
Implements the model interface. More... | |
virtual QVariant | data (const QModelIndex &, int) const |
Implements the Model interface. More... | |
virtual QVariant | headerData (int, Qt::Orientation, int) const |
Implements the Model interface. More... | |
virtual Qt::ItemFlags | flags (const QModelIndex &) const |
Implements the Model interface. More... | |
virtual bool | setData (const QModelIndex &, const QVariant &, int) |
bool | insertRows (int position, int count=1, const QModelIndex &parent={}) override |
updates the visibleRowCount variable. More... | |
bool | removeRows (int row, int count, const QModelIndex &parent={}) override |
void | setHighlightRowVariable (PdCom::Variable, const PdCom::Selector &={}, const Transmission &=QtPdCom::event_mode) |
Subscribe to a process variable for highlighting a row. More... | |
void | setHighlightRowVariable (PdCom::Process *, const QString &, const PdCom::Selector &={}, const Transmission &=QtPdCom::event_mode) |
Subscribe to a process variable for highlighting a row. More... | |
void | clearHighlightRowVariable () |
Q_INVOKABLE QString | toCsv (bool includeHeader, QChar seperator=QChar(','), const QLocale &locale=QLocale::c()) const |
Export table as CSV file. More... | |
Q_INVOKABLE int | fromCsv (QString csvData, QChar seperator=QChar(','), int startRow=0, int startColumn=0, const QLocale &locale=QLocale::c()) |
Import CSV file. More... | |
void | setVisibleRowsVariable (PdCom::Variable pv, const PdCom::Selector &={}, const Transmission &=QtPdCom::event_mode) |
Subscribe to a process variable for setting the visible rows of the Table, this is most often a parameter which also gets updated if the Table row count gets changed by editing. More... | |
void | setVisibleRowsVariable (PdCom::Process *, const QString &, const PdCom::Selector &={}, const Transmission &=QtPdCom::event_mode) |
Subscribe to a process variable for setting the visible rows of the Table, this is most often a parameter which also gets updated if the Table row count gets changed by editing. More... | |
void | clearVisibleRowsVariable () |
void | setHighlightColor (QColor, int=-1) |
void | setDisabledColor (QColor, int=-1) |
QHash< int, QByteArray > | roleNames () const override |
Properties | |
bool | editing |
Private Slots | |
void | dimensionChanged () |
Reacts on process variable dimension changes. More... | |
void | columnHeaderChanged () |
Reacts on header data changes. More... | |
void | valueChanged () |
Reacts on process variable changes. More... | |
void | highlightRowChanged () |
void | visibleRowCountChanged () |
Private Attributes | |
class Q_DECL_HIDDEN | Impl |
std::unique_ptr< Impl > | impl |
Table model.
TableModel::TableModel | ( | QObject * | parent = nullptr | ) |
Constructor.
References highlightRowChanged(), impl, valueChanged(), and visibleRowCountChanged().
TableModel::~TableModel | ( | ) |
Destructor.
References clearColumns(), and impl.
void TableModel::addColumn | ( | TableColumn * | column | ) |
Adds a column.
References insertColumn().
|
slot |
|
slot |
updates the visibleRowCount variable with initialization.
if value is a scalar all columns will be initialized with the same value otherwise must be a QVariantList
References addRow(), editingChanged(), impl, and isEditing().
void TableModel::clearColumns | ( | ) |
Clears the Columns.
References columnHeaderChanged(), dimensionChanged(), impl, and valueChanged().
Referenced by ~TableModel().
void TableModel::clearHighlightRowVariable | ( | ) |
References impl.
Referenced by setHighlightRowVariable().
void TableModel::clearVisibleRowsVariable | ( | ) |
References impl.
Referenced by setVisibleRowsVariable().
|
virtual |
|
privateslot |
|
slot |
Commits all edited data.
References editingChanged(), and impl.
|
virtual |
Implements the Model interface.
References impl.
|
privateslot |
Reacts on process variable dimension changes.
References impl.
Referenced by clearColumns(), and insertColumn().
|
signal |
Referenced by addRowAndCopyLast(), commit(), fromCsv(), insertRows(), revert(), and setData().
|
virtual |
Implements the Model interface.
References impl.
int TableModel::fromCsv | ( | QString | csvData, |
QChar | seperator = QChar(',') , |
||
int | startRow = 0 , |
||
int | startColumn = 0 , |
||
const QLocale & | locale = QLocale::c() |
||
) |
Import CSV file.
Also switch to edit mode. Numbers are expected to be formatted in Posix ("C") format, lines are separated by unix newlines .
separator | Column separator character, default , . |
startRow | First row to import, default 0. |
startColumn | First Column to import, default 0. |
locale | Locale for string conversion, default C Locale. |
References editingChanged(), impl, isEditing(), and rowCount().
unsigned int TableModel::getRowCapacity | ( | ) | const |
References impl.
bool TableModel::hasVisibleRowsVariable | ( | ) | const |
References impl.
Referenced by insertRows(), and removeRows().
|
virtual |
Implements the Model interface.
References impl.
|
privateslot |
References impl.
Referenced by TableModel().
void TableModel::insertColumn | ( | TableColumn * | col, |
int | position | ||
) |
References columnHeaderChanged(), dimensionChanged(), impl, and valueChanged().
Referenced by addColumn().
|
override |
updates the visibleRowCount variable.
References editingChanged(), hasVisibleRowsVariable(), impl, and isEditing().
bool TableModel::isEditing | ( | ) | const |
Referenced by addRowAndCopyLast(), fromCsv(), insertRows(), setData(), and visibleRowCountChanged().
void QtPdCom::TableModel::removeColumn | ( | TableColumn * | column | ) |
|
override |
References hasVisibleRowsVariable(), and impl.
Referenced by remRow().
|
slot |
References impl, and removeRows().
|
slot |
Reverts all edited data.
References editingChanged(), and impl.
|
override |
|
virtual |
|
virtual |
References editingChanged(), impl, and isEditing().
void TableModel::setDisabledColor | ( | QColor | dc, |
int | idx = -1 |
||
) |
References impl.
void TableModel::setHighlightColor | ( | QColor | hc, |
int | idx = -1 |
||
) |
References impl.
void TableModel::setHighlightRowVariable | ( | PdCom::Variable | pv, |
const PdCom::Selector & | selector = {} , |
||
const Transmission & | transmission = QtPdCom::event_mode |
||
) |
Subscribe to a process variable for highlighting a row.
The variable value determines the highlighted row.
pv | Process variable. |
selector | Selector. |
transmission | Transmission. |
References clearHighlightRowVariable(), and impl.
void TableModel::setHighlightRowVariable | ( | PdCom::Process * | process, |
const QString & | path, | ||
const PdCom::Selector & | selector = {} , |
||
const Transmission & | transmission = QtPdCom::event_mode |
||
) |
Subscribe to a process variable for highlighting a row.
The variable value determines the highlighted row.
process | Process variable. |
path | Variable path. |
selector | Selector. |
transmission | Transmission. |
References clearHighlightRowVariable(), and impl.
void TableModel::setVisibleRowsVariable | ( | PdCom::Variable | pv, |
const PdCom::Selector & | selector = {} , |
||
const Transmission & | transmission = QtPdCom::event_mode |
||
) |
Subscribe to a process variable for setting the visible rows of the Table, this is most often a parameter which also gets updated if the Table row count gets changed by editing.
pv | Process variable. |
selector | Selector. |
transmission | Transmission. |
References clearVisibleRowsVariable(), and impl.
void TableModel::setVisibleRowsVariable | ( | PdCom::Process * | process, |
const QString & | path, | ||
const PdCom::Selector & | selector = {} , |
||
const Transmission & | transmission = QtPdCom::event_mode |
||
) |
Subscribe to a process variable for setting the visible rows of the Table, this is most often a parameter which also gets updated if the Table row count gets changed by editing.
process | Process variable. |
path | Variable path. |
selector | Selector. |
transmission | Transmission. |
References clearVisibleRowsVariable(), and impl.
QString TableModel::toCsv | ( | bool | includeHeader, |
QChar | seperator = QChar(',') , |
||
const QLocale & | locale = QLocale::c() |
||
) | const |
Export table as CSV file.
includeHeader | Use column headers as first row. |
separator | Separator character, default , |
locale | Locale for string conversion, default C Locale. |
References impl, and rowCount().
|
privateslot |
Reacts on process variable changes.
References QtPdCom::TableColumn::getRows(), and impl.
Referenced by clearColumns(), insertColumn(), and TableModel().
|
privateslot |
References impl, and isEditing().
Referenced by TableModel().
|
private |
|
private |
Referenced by addRow(), addRowAndCopyLast(), clearColumns(), clearHighlightRowVariable(), clearVisibleRowsVariable(), columnCount(), columnHeaderChanged(), commit(), data(), dimensionChanged(), flags(), fromCsv(), getRowCapacity(), hasVisibleRowsVariable(), headerData(), highlightRowChanged(), insertColumn(), insertRows(), isEditing(), removeRows(), remRow(), revert(), rowCount(), setData(), setDisabledColor(), setHighlightColor(), setHighlightRowVariable(), setVisibleRowsVariable(), TableModel(), toCsv(), valueChanged(), visibleRowCountChanged(), and ~TableModel().
|
read |
Referenced by isEditing().