// frame_id contains the key we may want to store in the model
// Get the amount of rows already stored in the model
int row;
unsigned int stored_id;
// Parse the model to look if this identifier is already stored
for (row = 0; row < rowCount; row++) {
stored_id
= m_model
->data
(m_model
->index
(row,
0,
QModelIndex()),Qt
::DisplayRole).
toUInt();
if (stored_id == frame_id) {
// This identifier is already stored in the model, so we simply return it color
return QColor(m_model
->data
(m_model
->index
(row,
1,
QModelIndex()),Qt
::DisplayRole).
toString());
}
}
// This identifier is not already stored in the model, so we will add it at the end.
m_model
->setData
(m_model
->index
(row,
0,
QModelIndex()),frame.
id);
m_model
->setData
(m_model
->index
(row,
2,
QModelIndex()),
"");
// frame_id contains the key we may want to store in the model
// Get the amount of rows already stored in the model
int rowCount = m_model->rowCount(QModelIndex());
int row;
unsigned int stored_id;
// Parse the model to look if this identifier is already stored
for (row = 0; row < rowCount; row++) {
stored_id = m_model->data(m_model->index(row,0,QModelIndex()),Qt::DisplayRole).toUInt();
if (stored_id == frame_id) {
// This identifier is already stored in the model, so we simply return it color
return QColor(m_model->data(m_model->index(row,1,QModelIndex()),Qt::DisplayRole).toString());
}
}
// This identifier is not already stored in the model, so we will add it at the end.
m_model->insertRows(row,1,QModelIndex());
m_model->setData(m_model->index(row,0,QModelIndex()),frame.id);
m_model->setData(m_model->index(row,1,QModelIndex()),QColor(Qt::white).name());
m_model->setData(m_model->index(row,2,QModelIndex()),"");
To copy to clipboard, switch view to plain text mode
Bookmarks