TableModel::TableModel(QObject *parent) : QAbstractTableModel(parent).
To copy to clipboard, switch view to plain text mode
...{
tableModel= new TableModel(this);
}
void TableViewList::onDataAdded(float data1, float data2, float data3)
{
tableModel->setData(index, data1, Qt::EditRole);
tableModel->setData(index, data2, Qt::EditRole);
tableModel->setData(index, data3, Qt::EditRole);
setModel(tableModel);
}
...{
tableModel= new TableModel(this);
}
void TableViewList::onDataAdded(float data1, float data2, float data3)
{
int row = tableModel->rowCount(QModelIndex());
tableModel->insertRows(row, 1, QModelIndex());
QModelIndex index = tableModel->index(row, 0, QModelIndex());
tableModel->setData(index, data1, Qt::EditRole);
index = tableModel->index(row, 1, QModelIndex());
tableModel->setData(index, data2, Qt::EditRole);
index = tableModel->index(row, 2, QModelIndex());
tableModel->setData(index, data3, Qt::EditRole);
setModel(tableModel);
}
To copy to clipboard, switch view to plain text mode
Bookmarks