QTfrontend/ammoSchemeModel.cpp
changeset 4647 20b982afbe6e
parent 4600 5a3b1dbdd4c9
child 4820 4dcfbf9f7910
equal deleted inserted replaced
4588:5ef5415c4ee1 4647:20b982afbe6e
   626 
   626 
   627 bool AmmoSchemeModel::insertRows(int row, int count, const QModelIndex & parent)
   627 bool AmmoSchemeModel::insertRows(int row, int count, const QModelIndex & parent)
   628 {
   628 {
   629     Q_UNUSED(count);
   629     Q_UNUSED(count);
   630 
   630 
   631     beginInsertRows(parent, row, row);
   631     beginInsertRows(parent, schemes.size(), schemes.size());
   632 
   632 
   633     QList<QVariant> newScheme = defaultScheme;
   633     if (row == -1)
   634     newScheme[0] = QVariant(tr("new"));
   634     {
   635 
   635         QList<QVariant> newScheme = defaultScheme;
   636     schemes.insert(row, newScheme);
   636         newScheme[0] = QVariant(tr("new"));
       
   637         schemes.insert(schemes.size(), newScheme);
       
   638     }
       
   639     else
       
   640     {
       
   641         QList<QVariant> newScheme = schemes[row];
       
   642         newScheme[0] = QVariant(tr("copy of") + " " + newScheme[0].toString());
       
   643         schemes.insert(schemes.size(), newScheme);
       
   644     }
   637 
   645 
   638     endInsertRows();
   646     endInsertRows();
   639 
   647 
   640     return true;
   648     return true;
   641 }
   649 }