QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
TerminalStripModel Class Reference

#include <terminalstripmodel.h>

Inherits QAbstractTableModel.

Collaboration diagram for TerminalStripModel:
Collaboration graph

Classes

struct  BridgePixmap
 

Public Types

enum  Column {
  Pos = 0 , Level = 1 , Level0 = 2 , Level1 = 3 ,
  Level2 = 4 , Level3 = 5 , Label = 6 , Conductor = 7 ,
  XRef = 8 , Cable = 9 , CableWire = 10 , Type = 11 ,
  Function = 12 , Led = 13 , Invalid = 99
}
 

Public Member Functions

 TerminalStripModel (TerminalStrip *terminal_strip, QObject *parent=nullptr)
 TerminalStripModel::TerminalStripModel.
 
void setTerminalStrip (TerminalStrip *terminal_strip)
 TerminalStripModel::setTerminalStrip set the current terminal strip of this model to terminal_strip.
 
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
virtual int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
virtual bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
virtual QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
virtual Qt::ItemFlags flags (const QModelIndex &index) const override
 
QVector< modelRealTerminalDatamodifiedmodelRealTerminalData () const
 TerminalStripModel::modifiedRealTerminalData.
 
QVector< modelPhysicalTerminalDatamodelPhysicalTerminalDataForIndex (QModelIndexList index_list) const
 TerminalStripModel::terminalsForIndex.
 
QVector< modelRealTerminalDatamodelRealTerminalDataForIndex (QModelIndexList index_list) const
 TerminalStripModel::realTerminalDataForIndex.
 
modelRealTerminalData modelRealTerminalDataForIndex (const QModelIndex &index) const
 TerminalStripModel::realTerminalDataForIndex.
 
void buildBridgePixmap (const QSize &pixmap_size)
 TerminalStripModel::buildBridgePixmap Build the pixmap of bridge. You should call this method when you know the size to use in the bridge cell of a QTableView.
 
void reload ()
 TerminalStripModel::reload Reload (reset) the model.
 

Static Public Member Functions

static int levelForColumn (TerminalStripModel::Column column)
 TerminalStripModel::levelForColumn Return the terminal level for column column or -1 if column is not a level column.
 
static TerminalStripModel::Column columnTypeForIndex (const QModelIndex &index)
 TerminalStripModel::columnTypeForIndex.
 

Private Member Functions

void fillPhysicalTerminalData ()
 
modelRealTerminalData dataAtRow (int row) const
 
void replaceDataAtRow (modelRealTerminalData data, int row)
 TerminalStripModel::replaceDataAtRow Replace the data at row row by data.
 
modelPhysicalTerminalData physicalDataAtIndex (int index) const
 TerminalStripModel::physicalDataAtIndex.
 
modelRealTerminalData realDataAtIndex (int index) const
 TerminalStripModel::realDataAtIndex.
 
QPixmap bridgePixmapFor (const QModelIndex &index) const
 

Private Attributes

QPointer< TerminalStripm_terminal_strip
 
QHash< QPointer< Element >, QVector< bool > > m_modified_cell
 
QVector< modelPhysicalTerminalDatam_physical_data
 
QHash< QColor, BridgePixmapm_bridges_pixmaps
 

Member Enumeration Documentation

◆ Column

Enumerator
Pos 
Level 
Level0 
Level1 
Level2 
Level3 
Label 
Conductor 
XRef 
Cable 
CableWire 
Type 
Function 
Led 
Invalid 

Constructor & Destructor Documentation

◆ TerminalStripModel()

TerminalStripModel::TerminalStripModel ( TerminalStrip terminal_strip,
QObject *  parent = nullptr 
)

TerminalStripModel::TerminalStripModel.

Parameters
terminal_strip
parent
Here is the call graph for this function:

Member Function Documentation

◆ bridgePixmapFor()

QPixmap TerminalStripModel::bridgePixmapFor ( const QModelIndex &  index) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ buildBridgePixmap()

void TerminalStripModel::buildBridgePixmap ( const QSize &  pixmap_size)

TerminalStripModel::buildBridgePixmap Build the pixmap of bridge. You should call this method when you know the size to use in the bridge cell of a QTableView.

Parameters
pixmap_size
Here is the call graph for this function:
Here is the caller graph for this function:

◆ columnCount()

int TerminalStripModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
overridevirtual

◆ columnTypeForIndex()

TerminalStripModel::Column TerminalStripModel::columnTypeForIndex ( const QModelIndex &  index)
static

TerminalStripModel::columnTypeForIndex.

Parameters
index
Returns
the thing (pos, level, type, function etc...) for index
Here is the caller graph for this function:

◆ data()

QVariant TerminalStripModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
overridevirtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dataAtRow()

modelRealTerminalData TerminalStripModel::dataAtRow ( int  row) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fillPhysicalTerminalData()

void TerminalStripModel::fillPhysicalTerminalData ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ flags()

Qt::ItemFlags TerminalStripModel::flags ( const QModelIndex &  index) const
overridevirtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ headerData()

QVariant TerminalStripModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
overridevirtual

◆ levelForColumn()

int TerminalStripModel::levelForColumn ( TerminalStripModel::Column  column)
static

TerminalStripModel::levelForColumn Return the terminal level for column column or -1 if column is not a level column.

Parameters
column
Returns
Here is the caller graph for this function:

◆ modelPhysicalTerminalDataForIndex()

QVector< modelPhysicalTerminalData > TerminalStripModel::modelPhysicalTerminalDataForIndex ( QModelIndexList  index_list) const

TerminalStripModel::terminalsForIndex.

Parameters
index_list
Returns
A vector of PhysicalTerminalData represented by index_list. If sereval index point to the same terminal the vector have only one PhysicalTerminalData
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modelRealTerminalDataForIndex() [1/2]

modelRealTerminalData TerminalStripModel::modelRealTerminalDataForIndex ( const QModelIndex &  index) const

TerminalStripModel::realTerminalDataForIndex.

Parameters
index
Returns
modelRealTerminalData at index index or null modelRealTerminalData if invalid
Here is the call graph for this function:

◆ modelRealTerminalDataForIndex() [2/2]

QVector< modelRealTerminalData > TerminalStripModel::modelRealTerminalDataForIndex ( QModelIndexList  index_list) const

TerminalStripModel::realTerminalDataForIndex.

Parameters
index_list
Returns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modifiedmodelRealTerminalData()

QVector< modelRealTerminalData > TerminalStripModel::modifiedmodelRealTerminalData ( ) const

TerminalStripModel::modifiedRealTerminalData.

Returns
a vector of modified terminal.
Here is the caller graph for this function:

◆ physicalDataAtIndex()

modelPhysicalTerminalData TerminalStripModel::physicalDataAtIndex ( int  index) const
private

TerminalStripModel::physicalDataAtIndex.

Parameters
index
Returns
the physical terminal data at index. We need to use this method because the model can have more index than physical terminal, because physical terminal can be multi-level and each level have is own row. If index is out of range, return a default PhysicalTerminalData (pos_ is set to -1 by default)
Here is the caller graph for this function:

◆ realDataAtIndex()

modelRealTerminalData TerminalStripModel::realDataAtIndex ( int  index) const
private

TerminalStripModel::realDataAtIndex.

Parameters
index
Returns
the realTerminalData at index index.
Here is the caller graph for this function:

◆ reload()

void TerminalStripModel::reload ( )

TerminalStripModel::reload Reload (reset) the model.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ replaceDataAtRow()

void TerminalStripModel::replaceDataAtRow ( modelRealTerminalData  data,
int  row 
)
private

TerminalStripModel::replaceDataAtRow Replace the data at row row by data.

Parameters
data
row
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rowCount()

int TerminalStripModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
overridevirtual
Here is the caller graph for this function:

◆ setData()

bool TerminalStripModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
overridevirtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTerminalStrip()

void TerminalStripModel::setTerminalStrip ( TerminalStrip terminal_strip)

TerminalStripModel::setTerminalStrip set the current terminal strip of this model to terminal_strip.

Parameters
terminal_strip
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_bridges_pixmaps

QHash<QColor, BridgePixmap> TerminalStripModel::m_bridges_pixmaps
private

◆ m_modified_cell

QHash<QPointer<Element>, QVector<bool> > TerminalStripModel::m_modified_cell
private

◆ m_physical_data

QVector<modelPhysicalTerminalData> TerminalStripModel::m_physical_data
private

◆ m_terminal_strip

QPointer<TerminalStrip> TerminalStripModel::m_terminal_strip
private

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