示例#1
0
void CurveNameList::tryToRemoveOriginalCopy (const QModelIndex &index,
                                             const QVariant &value,
                                             int role)
{
  // After the copy part of a move maneuver, the old entry must be identified and removed
  if (index.column () == 0 && role == Qt::DisplayRole) {
    QModelIndex indexToRemove = indexForValue (index,
                                               value); // Returns Invalid if no duplicate entry was found
    if (indexToRemove.isValid()) {

      QString before = m_modelCurvesEntries.join (PIPE).replace (TAB, SPACE);

      beginRemoveRows (QModelIndex (),
                       indexToRemove.row(),
                   indexToRemove.row());
      m_modelCurvesEntries.removeAt (indexToRemove.row ());
      endRemoveRows ();

      emit dataChanged (indexToRemove,
                        indexToRemove);

      QString after = m_modelCurvesEntries.join (PIPE).replace (TAB, SPACE);

      LOG4CPP_INFO_S ((*mainCat)) << "CurveNameList::setData removed"
                                  << " indexRow=" << indexToRemove.row ()
                                  << " indexCol=" << indexToRemove.column ()
                                  << " before=" << before.toLatin1().data()
                                  << " after=" << after.toLatin1().data();
    }
  }
}
示例#2
0
void AccountsModel::accountUpdated(Account account)
{
	QModelIndex index = indexForValue(account);
	emit dataChanged(index, index);
}