|
|
|
|
@ -90,13 +90,11 @@ QVariant ModelsModel::data(const QModelIndex &index, int role /*= Qt::DisplayRol
|
|
|
|
|
// return QVariant();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
if (Qt::DecorationRole == role) {
|
|
|
|
|
if (Qt::DecorationRole == role) { //根据训练模板的是否成功标志位 设置列表中型号字符串前面的颜色块 绿色表示成功 红色表示失败 黄色表示没有训练
|
|
|
|
|
/*The data to be rendered as a decoration in the form of an icon. (QColor, QIcon or QPixmap)*/
|
|
|
|
|
QString str = m_lstHeader.at(nCol);
|
|
|
|
|
if ("modelID" == str){
|
|
|
|
|
QString strModel = m_list.at(nRow);
|
|
|
|
|
//if (!m_pData->contains(strModel))
|
|
|
|
|
// return QVariant();
|
|
|
|
|
if (m_pData->contains(strModel))
|
|
|
|
|
{
|
|
|
|
|
int nTypeModel = m_pData->value(strModel)->getImageModel();
|
|
|
|
|
@ -111,7 +109,7 @@ QVariant ModelsModel::data(const QModelIndex &index, int role /*= Qt::DisplayRol
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (Qt::TextColorRole == role){
|
|
|
|
|
if (Qt::TextColorRole == role){//根据训练模板的图片数量 判断数量是否低于指定的数值,如果低于设定的数值,修改字体颜色 提醒用户
|
|
|
|
|
QString str = m_lstHeader.at(nCol);
|
|
|
|
|
if ("modelID" == str){
|
|
|
|
|
QString strModel = m_list.at(nRow);
|
|
|
|
|
@ -123,8 +121,20 @@ QVariant ModelsModel::data(const QModelIndex &index, int role /*= Qt::DisplayRol
|
|
|
|
|
else
|
|
|
|
|
return QColor(0, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
//if (!m_pData->contains(strModel))
|
|
|
|
|
// return QVariant();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (Qt::BackgroundColorRole == role) {//根据是否加入训练标志位 设置列表对应元素的背景颜色为淡黄色 方便识别被修改的型号
|
|
|
|
|
QString str = m_lstHeader.at(nCol);
|
|
|
|
|
if ("modelID" == str) {
|
|
|
|
|
QString strModel = m_list.at(nRow);
|
|
|
|
|
if (m_pData->contains(strModel))
|
|
|
|
|
{
|
|
|
|
|
bool bAddTrain = m_pData->value(strModel)->getAddTrainFlag();
|
|
|
|
|
if (bAddTrain == false)
|
|
|
|
|
return QColor(250, 250, 0,50);
|
|
|
|
|
else
|
|
|
|
|
return QVariant();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return QVariant();
|
|
|
|
|
|