18#ifndef TERMINALSTRIPMODEL_H
19#define TERMINALSTRIPMODEL_H
21#include <QAbstractTableModel>
24#include <QStyledItemDelegate>
28#include "../terminalstrip.h"
32inline uint
qHash(
const QColor &key, uint seed) {
33 return qHash(key.name(), seed);
37inline uint
qHash(
const QPointer<Element> &key, uint seed) {
39 return qHash(key->uuid(), seed);
41 return qHash(QUuid(), seed);
75 virtual int rowCount (
const QModelIndex &parent = QModelIndex())
const override;
76 virtual int columnCount (
const QModelIndex &parent = QModelIndex())
const override;
77 virtual QVariant
data (
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
78 virtual bool setData (
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole)
override;
79 virtual QVariant
headerData (
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
80 virtual Qt::ItemFlags
flags (
const QModelIndex &index)
const override;
124 const QStyleOptionViewItem &option,
125 const QModelIndex &index)
const override;
128 QAbstractItemModel *model,
129 const QModelIndex &index)
const override;
131 void paint(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
Definition conductor.h:43
The TerminalStrip class This class hold all the datas and configurations of a terminal strip (but the...
Definition terminalstrip.h:45
Definition terminalstripmodel.h:116
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
TerminalStripModelDelegate::paint By default on a QTableView, Qt draw pixmap in cell with a little ma...
Definition terminalstripmodel.cpp:849
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
Definition terminalstripmodel.cpp:819
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition terminalstripmodel.cpp:793
Definition terminalstripmodel.h:47
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Definition terminalstripmodel.cpp:152
QHash< QPointer< Element >, QVector< bool > > m_modified_cell
Definition terminalstripmodel.h:101
modelRealTerminalData realDataAtIndex(int index) const
TerminalStripModel::realDataAtIndex.
Definition terminalstripmodel.cpp:632
QVector< modelPhysicalTerminalData > m_physical_data
Definition terminalstripmodel.h:102
static TerminalStripModel::Column columnTypeForIndex(const QModelIndex &index)
TerminalStripModel::columnTypeForIndex.
Definition terminalstripmodel.cpp:77
void setTerminalStrip(TerminalStrip *terminal_strip)
TerminalStripModel::setTerminalStrip set the current terminal strip of this model to terminal_strip.
Definition terminalstripmodel.cpp:124
static int levelForColumn(TerminalStripModel::Column column)
TerminalStripModel::levelForColumn Return the terminal level for column column or -1 if column is not...
Definition terminalstripmodel.cpp:61
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Definition terminalstripmodel.cpp:209
QPixmap bridgePixmapFor(const QModelIndex &index) const
Definition terminalstripmodel.cpp:653
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const override
Definition terminalstripmodel.cpp:146
QVector< modelPhysicalTerminalData > modelPhysicalTerminalDataForIndex(QModelIndexList index_list) const
TerminalStripModel::terminalsForIndex.
Definition terminalstripmodel.cpp:350
QVector< modelRealTerminalData > modelRealTerminalDataForIndex(QModelIndexList index_list) const
TerminalStripModel::realTerminalDataForIndex.
Definition terminalstripmodel.cpp:382
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition terminalstripmodel.cpp:130
QPointer< TerminalStrip > m_terminal_strip
Definition terminalstripmodel.h:100
QHash< QColor, BridgePixmap > m_bridges_pixmaps
Definition terminalstripmodel.h:111
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Definition terminalstripmodel.cpp:276
modelPhysicalTerminalData physicalDataAtIndex(int index) const
TerminalStripModel::physicalDataAtIndex.
Definition terminalstripmodel.cpp:599
void replaceDataAtRow(modelRealTerminalData data, int row)
TerminalStripModel::replaceDataAtRow Replace the data at row row by data.
Definition terminalstripmodel.cpp:560
Column
Definition terminalstripmodel.h:49
@ Level3
Definition terminalstripmodel.h:55
@ Pos
Definition terminalstripmodel.h:50
@ Level2
Definition terminalstripmodel.h:54
@ Cable
Definition terminalstripmodel.h:59
@ Label
Definition terminalstripmodel.h:56
@ Invalid
Definition terminalstripmodel.h:64
@ Type
Definition terminalstripmodel.h:61
@ CableWire
Definition terminalstripmodel.h:60
@ Level0
Definition terminalstripmodel.h:52
@ Function
Definition terminalstripmodel.h:62
@ Level
Definition terminalstripmodel.h:51
@ XRef
Definition terminalstripmodel.h:58
@ Led
Definition terminalstripmodel.h:63
@ Level1
Definition terminalstripmodel.h:53
void reload()
TerminalStripModel::reload Reload (reset) the model.
Definition terminalstripmodel.cpp:497
void fillPhysicalTerminalData()
Definition terminalstripmodel.cpp:506
void buildBridgePixmap(const QSize &pixmap_size)
TerminalStripModel::buildBridgePixmap Build the pixmap of bridge. You should call this method when yo...
Definition terminalstripmodel.cpp:428
QVector< modelRealTerminalData > modifiedmodelRealTerminalData() const
TerminalStripModel::modifiedRealTerminalData.
Definition terminalstripmodel.cpp:322
virtual Qt::ItemFlags flags(const QModelIndex &index) const override
Definition terminalstripmodel.cpp:305
modelRealTerminalData dataAtRow(int row) const
Definition terminalstripmodel.cpp:530
Definition terminalstripmodel.h:104
QPixmap bottom_
Definition terminalstripmodel.h:107
QPixmap top_
Definition terminalstripmodel.h:105
QPixmap none_
Definition terminalstripmodel.h:108
QPixmap middle_
Definition terminalstripmodel.h:106
Definition modelTerminalData.h:66
Definition modelTerminalData.h:26
uint qHash(const QColor &key, uint seed)
Definition terminalstripmodel.h:32