/
pi_coder
/
ByteMachine
Обзор
Документация
Войти
/
pi_coder
/
ByteMachine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/output_model.cpp
74 строки
2 KB
pimenov-and
Перенос функциональности из старого проекта, в основном это описания узлов
19 июл 2026, 20:13
19 июл 2026, 20:13
cb3c51b
Код
Авторство
О чём код?
//////////////////////////////////////////////////////////////// // ByteMachine // Модель для данных для панели Output //////////////////////////////////////////////////////////////// #include "output_model.h" //============================================================== // Получение количетсва строк //============================================================== int OutputModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent) return 0; } //============================================================== // Получение количества столбцов //============================================================== int OutputModel::columnCount(const QModelIndex &parent) const { Q_UNUSED(parent) return 3; } //============================================================== // Получение данных для заголовка //============================================================== QVariant OutputModel::headerData(int section, Qt::Orientation orientation, int role) const { if (role != Qt::DisplayRole) { return QVariant(); } if (orientation == Qt::Horizontal) { switch (section) { case 0: { return QString("Type"); } case 1: { return QString("Message"); } case 2: { return QString("Time"); } default: { return QString("Столбец %1").arg(section + 1); } } } return QAbstractTableModel::headerData(section, orientation, role); } //============================================================== // Получение данных ячеек //============================================================== QVariant OutputModel::data(const QModelIndex &index, int role) const { if (role == Qt::DisplayRole) { return QString("Row %1, Col %2").arg(index.row() + 1).arg(index.column() + 1); } return QVariant{}; }