Add table widget and item model for free terminal

WIP, the change made in the table widget can't be applied.
This commit is contained in:
joshua
2022-03-12 19:07:49 +01:00
parent 0ff099fb52
commit 9cbc3a2265
13 changed files with 1084 additions and 291 deletions

View File

@@ -26,7 +26,7 @@
#include <QColor>
#include "../terminalstrip.h"
#include "../../qetgraphicsitem/element.h"
#include "modelTerminalData.h"
//Code to use QColor as key for QHash
inline uint qHash(const QColor &key, uint seed) {
@@ -43,37 +43,6 @@ inline uint qHash(const QPointer<Element> &key, uint seed) {
class TerminalStrip;
struct modelRealTerminalData
{
int level_ = -1;
QString label_;
QString Xref_;
QString cable_;
QString cable_wire;
QString conductor_;
bool led_ = false;
bool bridged_ = false;
ElementData::TerminalType type_ = ElementData::TerminalType::TTGeneric;
ElementData::TerminalFunction function_ = ElementData::TerminalFunction::TFGeneric;
QPointer<Element> element_;
QWeakPointer<RealTerminal> real_terminal;
};
struct modelPhysicalTerminalData
{
QVector<modelRealTerminalData> real_data;
int pos_ = -1;
QUuid uuid_;
};
inline bool operator == (const modelPhysicalTerminalData &data_1, const modelPhysicalTerminalData &data_2) {
return data_1.uuid_ == data_2.uuid_;
}
class TerminalStripModel : public QAbstractTableModel
{
public:
@@ -124,8 +93,6 @@ class TerminalStripModel : public QAbstractTableModel
modelRealTerminalData realDataAtIndex(int index) const;
QPixmap bridgePixmapFor(const QModelIndex &index) const;
static modelRealTerminalData modelRealData(const QWeakPointer<RealTerminal> &real_terminal);
private:
QPointer<TerminalStrip> m_terminal_strip;
QHash<QPointer<Element>, QVector<bool>> m_modified_cell;