void MyTreeZoneModel::switchEtat(Groupe_selection *zones){

    if(zones == NULL){
        Projet *pro = mainwindow->getCurent_projet();
        zones = pro->getZones();
    }
    Zone * child;
    QVector<Zone*> childs = zones->getZones();

    foreach(child, childs){
        if(child->getType() == Zone::composite){
            switchEtat((Groupe_selection *)child);
        }
        else{
            child->switchEtat();
            emit layoutChanged();
        }
    }
}
bool MyTreeZoneModel::setData (const QModelIndex &index, const QVariant &value, int role)
{
    Zone *zIndex = nodeFromIndex(index);

    if(role == Qt::EditRole){
        zIndex->setLabel(value.toString());
    }

    if(role == Qt::CheckStateRole)
    {
        zIndex->setDisplayed(static_cast<Qt::CheckState>(value.toUInt()));
        emit dataChanged(index, index);

        if(zIndex->getType() == Zone::composite){
            switchEtat((Groupe_selection *)zIndex);
            emit layoutChanged();
        }
    }
    return true;
}