|
QtPdCom
1.5.2
|
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. | |
| void | revert () |
| Reverts all edited data. | |
| void | addRow () |
| updates the visibleRowCount variable. | |
| void | addRowAndCopyLast () |
| updates the visibleRowCount variable with initialization. | |
| void | remRow () |
Signals | |
| void | editingChanged (bool) |
Public Member Functions | |
| TableModel (QObject *parent=nullptr) | |
| Constructor. | |
| ~TableModel () | |
| Destructor. | |
| void | addColumn (TableColumn *) |
| Adds a column. | |
| void | insertColumn (TableColumn *, int position) |
| void | removeColumn (TableColumn *) |
| void | clearColumns () |
| Clears the Columns. | |
| bool | isEditing () const |
| unsigned int | getRowCapacity () const |
| bool | hasVisibleRowsVariable () const |
| virtual int | rowCount (const QModelIndex &) const |
| Implements the model interface. | |
| virtual int | columnCount (const QModelIndex &) const |
| Implements the model interface. | |
| virtual QVariant | data (const QModelIndex &, int) const |
| Implements the Model interface. | |
| virtual QVariant | headerData (int, Qt::Orientation, int) const |
| Implements the Model interface. | |
| virtual Qt::ItemFlags | flags (const QModelIndex &) const |
| Implements the Model interface. | |
| virtual bool | setData (const QModelIndex &, const QVariant &, int) |
| bool | insertRows (int position, int count=1, const QModelIndex &parent={}) override |
| updates the visibleRowCount variable. | |
| 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. | |
| void | setHighlightRowVariable (PdCom::Process *, const QString &, const PdCom::Selector &={}, const Transmission &=QtPdCom::event_mode) |
| Subscribe to a process variable for highlighting a row. | |
| void | clearHighlightRowVariable () |
| Q_INVOKABLE QString | toCsv (bool includeHeader, QChar seperator=QChar(','), const QLocale &locale=QLocale::c()) const |
| Export table as CSV file. | |
| Q_INVOKABLE int | fromCsv (QString csvData, QChar seperator=QChar(','), int startRow=0, int startColumn=0, const QLocale &locale=QLocale::c()) |
| Import CSV file. | |
| 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. | |
| 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. | |
| 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. | |
| void | columnHeaderChanged () |
| Reacts on header data changes. | |
| void | valueChanged () |
| Reacts on process variable changes. | |
| void | highlightRowChanged () |
| void | visibleRowCountChanged () |
Private Attributes | |
| class Q_DECL_HIDDEN | Impl |
| std::unique_ptr< Impl > | impl |
Table model.
| TableModel::TableModel | ( | QObject * | parent = nullptr | ) |
Constructor.
Destructor.
| void TableModel::addColumn | ( | TableColumn * | column | ) |
Adds a column.
|
slot |
updates the visibleRowCount variable.
|
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
| void TableModel::clearColumns | ( | ) |
Clears the Columns.
| void TableModel::clearVisibleRowsVariable | ( | ) |
|
virtual |
Implements the model interface.
|
privateslot |
Reacts on header data changes.
|
slot |
Commits all edited data.
|
virtual |
Implements the Model interface.
|
privateslot |
Reacts on process variable dimension changes.
|
signal |
|
virtual |
Implements the Model interface.
| 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 \n .
| 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. |
| unsigned int TableModel::getRowCapacity | ( | ) | const |
| bool TableModel::hasVisibleRowsVariable | ( | ) | const |
|
virtual |
Implements the Model interface.
|
privateslot |
| void TableModel::insertColumn | ( | TableColumn * | col, |
| int | position ) |
|
override |
updates the visibleRowCount variable.
| bool TableModel::isEditing | ( | ) | const |
| void QtPdCom::TableModel::removeColumn | ( | TableColumn * | column | ) |
|
override |
|
slot |
|
slot |
Reverts all edited data.
|
override |
|
virtual |
Implements the model interface.
|
virtual |
| void TableModel::setDisabledColor | ( | QColor | dc, |
| int | idx = -1 ) |
| void TableModel::setHighlightColor | ( | QColor | hc, |
| int | idx = -1 ) |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
|
privateslot |
Reacts on process variable changes.
|
privateslot |
|
private |
|
private |
|
read |