equal
deleted
inserted
replaced
37 int columnCount(const QModelIndex &parent = QModelIndex()) const { |
37 int columnCount(const QModelIndex &parent = QModelIndex()) const { |
38 return attributes.size(); |
38 return attributes.size(); |
39 } |
39 } |
40 |
40 |
41 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::ItemDataRole::DisplayRole) const { |
41 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::ItemDataRole::DisplayRole) const { |
42 if (role != Qt::ItemDataRole::DisplayRole) return QVariant(); |
42 if (orientation == Qt::Orientation::Horizontal && role == Qt::ItemDataRole::DisplayRole) return QString::fromStdWString(attributes[section].getAttributeName().c_str()); |
43 else if (orientation == Qt::Orientation::Horizontal) return QString::fromStdWString(attributes[section].getAttributeName().c_str()); |
43 if (orientation == Qt::Orientation::Horizontal && role == Qt::ItemDataRole::ToolTipRole) return QString::fromStdWString(attributes[section].getTypeName().c_str()); |
44 else if (orientation == Qt::Orientation::Vertical) return QString("%1").arg(section + 1); |
44 if (orientation == Qt::Orientation::Vertical && role == Qt::ItemDataRole::DisplayRole) return QString("%1").arg(section + 1); |
|
45 return QVariant(); |
45 } |
46 } |
46 |
47 |
47 QVariant data(const QModelIndex &index, int role = Qt::ItemDataRole::DisplayRole) const { |
48 QVariant data(const QModelIndex &index, int role = Qt::ItemDataRole::DisplayRole) const { |
48 if (role == Qt::ItemDataRole::DisplayRole || role == Qt::ItemDataRole::EditRole) return records[index.row()]->at(index.column()); |
49 if (role == Qt::ItemDataRole::DisplayRole || role == Qt::ItemDataRole::EditRole) return records[index.row()]->at(index.column()); |
49 else return QVariant(); |
50 else return QVariant(); |