void Projet::supprimerTache(const QString& ident){ for(std::size_t i=0;i<taches.size();++i) { if (ident==taches[i]->getId()) { if (taches[i]->getStatus()){ throw ProjetException("erreur, supprimer d'abord la programmation de cette tache"); } taches.erase(taches.begin()+i); return; } } }
void Projectwindow::actualiserselection(QTreeWidgetItem* selection,int column){ //QMessageBox::information(this,"test","Message d'info de test"); if(selection->data(0,Qt::UserRole)=="projet"){ current=reinterpret_cast<Projet*>(selection->data( 1, Qt::UserRole).value<quintptr>()); } else if (selection->data(0,Qt::UserRole)=="tache"){ currenttask=reinterpret_cast<Tache*>(selection->data( 1, Qt::UserRole).value<quintptr>()); while(selection->data(0,Qt::UserRole)!="projet") selection=selection->parent(); current=reinterpret_cast<Projet*>(selection->data( 1, Qt::UserRole).value<quintptr>()); } else throw ProjetException("item non referencé"); }
TacheComposite& Projet::ajouterTacheComposite(const QString& id, const QString& t, const QDateTime &dispo, const QDateTime &deadline, bool b){ if (trouverTache(id)) throw ProjetException("erreur, tache deja existante dans le projet"); TacheComposite* newt=new TacheComposite(id,t,dispo,deadline, b); addItem(newt); return *newt; }