for (int i=0; i<modelTable->rowCount(); i++)
{
modelChart
->setData
(modelChart
->index
(i,
0,
QModelIndex()), modelTable
->item
(i,
2)->data
(Qt
::EditRole));
modelChart
->setData
(modelChart
->index
(i,
0,
QModelIndex()), modelTable
->item
(i,
2)->data
(Qt
::EditRole), Qt
::DisplayRole);
modelChart
->setItem
(i,
1,
new QStandardItem(modelTable
->item
(i,
3)->text
()));
modelChart
->setData
(modelChart
->index
(i,
1,
QModelIndex()),
QColor(r, g, b
),Qt
::DecorationRole);
}
for (int i=0; i<modelTable->rowCount(); i++)
{
modelChart->setItem(i, 0, new QStandardItem());
modelChart->setData(modelChart->index(i, 0, QModelIndex()), modelTable->item(i, 2)->data(Qt::EditRole));
modelChart->setData(modelChart->index(i, 0, QModelIndex()), modelTable->item(i, 2)->data(Qt::EditRole), Qt::DisplayRole);
modelChart->setItem(i, 1, new QStandardItem(modelTable->item(i, 3)->text()));
modelChart->setData(modelChart->index(i, 1, QModelIndex()),QColor(r, g, b),Qt::DecorationRole);
}
To copy to clipboard, switch view to plain text mode
Bookmarks