QtPdCom  1.0.0
Classes | Public Slots | Signals | Public Member Functions | Private Slots | Private Attributes | List of all members
QtPdCom::TableModel Class Reference

Table model. More...

#include <TableModel.h>

Inheritance diagram for QtPdCom::TableModel:
Inheritance graph
[legend]
Collaboration diagram for QtPdCom::TableModel:
Collaboration graph
[legend]

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 remRow ()
 updates the visibleRowCount variable.
 

Signals

void editingChanged (bool)
 

Public Member Functions

 TableModel (QObject *parent=nullptr)
 Constructor.
 
 ~TableModel ()
 Destructor.
 
void addColumn (TableColumn *)
 Adds a column.
 
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)
 
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 ()
 
void setVisibleRowsVariable (PdCom::Variable pv)
 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)
 

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< Implimpl
 

Detailed Description

Table model.

See also
TableColumn.

Constructor & Destructor Documentation

◆ TableModel()

TableModel::TableModel ( QObject *  parent = nullptr)

◆ ~TableModel()

TableModel::~TableModel ( )

Destructor.

References clearColumns(), and impl.

Member Function Documentation

◆ addColumn()

void TableModel::addColumn ( TableColumn col)

Adds a column.

References columnHeaderChanged(), dimensionChanged(), impl, and valueChanged().

◆ addRow

void TableModel::addRow ( )
slot

updates the visibleRowCount variable.

References impl.

◆ clearColumns()

void TableModel::clearColumns ( )

Clears the Columns.

References columnHeaderChanged(), dimensionChanged(), impl, and valueChanged().

Referenced by ~TableModel().

◆ clearHighlightRowVariable()

void TableModel::clearHighlightRowVariable ( )

References impl.

Referenced by setHighlightRowVariable().

◆ clearVisibleRowsVariable()

void TableModel::clearVisibleRowsVariable ( )

References impl.

Referenced by setVisibleRowsVariable().

◆ columnCount()

int TableModel::columnCount ( const QModelIndex &  index) const
virtual

Implements the model interface.

Returns
Number of columns.

References impl.

◆ columnHeaderChanged

void TableModel::columnHeaderChanged ( )
privateslot

Reacts on header data changes.

References impl.

Referenced by addColumn(), and clearColumns().

◆ commit

void TableModel::commit ( )
slot

Commits all edited data.

References editingChanged(), and impl.

◆ data()

QVariant TableModel::data ( const QModelIndex &  index,
int  role 
) const
virtual

Implements the Model interface.

References impl.

◆ dimensionChanged

void TableModel::dimensionChanged ( )
privateslot

Reacts on process variable dimension changes.

References impl.

Referenced by addColumn(), and clearColumns().

◆ editingChanged

void QtPdCom::TableModel::editingChanged ( bool  )
signal

Referenced by commit(), revert(), and setData().

◆ flags()

Qt::ItemFlags TableModel::flags ( const QModelIndex &  index) const
virtual

Implements the Model interface.

References impl.

◆ getRowCapacity()

unsigned int TableModel::getRowCapacity ( ) const

References impl.

◆ hasVisibleRowsVariable()

bool TableModel::hasVisibleRowsVariable ( ) const

References impl.

◆ headerData()

QVariant TableModel::headerData ( int  section,
Qt::Orientation  o,
int  role 
) const
virtual

Implements the Model interface.

References impl.

◆ highlightRowChanged

void TableModel::highlightRowChanged ( )
privateslot

References impl.

Referenced by TableModel().

◆ isEditing()

bool TableModel::isEditing ( ) const

References impl.

Referenced by setData().

◆ remRow

void TableModel::remRow ( )
slot

updates the visibleRowCount variable.

References impl.

◆ revert

void TableModel::revert ( )
slot

Reverts all edited data.

References editingChanged(), and impl.

◆ rowCount()

int TableModel::rowCount ( const QModelIndex &  index) const
virtual

Implements the model interface.

Returns
Number of rows.

References impl.

◆ setData()

bool TableModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role 
)
virtual

References editingChanged(), impl, and isEditing().

◆ setDisabledColor()

void TableModel::setDisabledColor ( QColor  dc,
int  idx = -1 
)

References impl.

◆ setHighlightColor()

void TableModel::setHighlightColor ( QColor  hc,
int  idx = -1 
)

References impl.

◆ setHighlightRowVariable() [1/2]

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.

Parameters
processProcess variable.
pathVariable path.
selectorSelector.
transmissionTransmission.

References clearHighlightRowVariable(), and impl.

◆ setHighlightRowVariable() [2/2]

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.

Parameters
pvProcess variable.
selectorSelector.
transmissionTransmission.

References clearHighlightRowVariable(), and impl.

◆ setVisibleRowsVariable()

void TableModel::setVisibleRowsVariable ( PdCom::Variable  pv)

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.

Parameters
pvProcess variable.

References clearVisibleRowsVariable(), and impl.

◆ valueChanged

void TableModel::valueChanged ( )
privateslot

Reacts on process variable changes.

References QtPdCom::TableColumn::getRows(), and impl.

Referenced by addColumn(), clearColumns(), and TableModel().

◆ visibleRowCountChanged

void TableModel::visibleRowCountChanged ( )
privateslot

References impl.

Referenced by TableModel().

Member Data Documentation

◆ Impl

class Q_DECL_HIDDEN QtPdCom::TableModel::Impl
private

◆ impl

std::unique_ptr<Impl> QtPdCom::TableModel::impl
private

The documentation for this class was generated from the following files: