コード例 #1
0
ファイル: uvGUI.cpp プロジェクト: TomKfr/ProjetLO21
/*!
 * \brief Constructeur de la fenêtre de visualisation des détails d'une UV
 * \param u pointeur vers l'UV à afficher
 * \param uvm référence vers l'UVManager
 */
UvAfficheur::UvAfficheur(UV& u, UVManager & uvm) : uv(u), M(uvm) {

       codeLabel = new QLabel("Code : "+uv.getCode(), this);
       titreLabel= new QLabel("Intitule : "+uv.getTitre(), this);
       unsigned int n=uv.getNbCredits();
       QString c=QString::number(n);
       creditsLabel= new QLabel("Nombre de credits : "+c, this);
       categorieLabel = new QLabel("Categorie : "+CategorieToString(uv.getCategorie()), this);

       QString automne ;
       QString printemps;

       if (uv.ouvertureAutomne()==0) automne="non";
       else automne="oui";

       if (uv.ouverturePrintemps()==0) printemps="non";
       else printemps="oui";

       ouverturePLabel = new QLabel("Ouverture Printemps : "+printemps, this);
       ouvertureALabel = new QLabel("Ouverture Automne : "+automne, this);
       fin=new QPushButton("Consultation terminee", this);

       coucheH1=new QHBoxLayout;
       coucheH1->addWidget(codeLabel);

       coucheH2=new QHBoxLayout;
       coucheH2->addWidget(titreLabel);

       coucheH3=new QHBoxLayout;
       coucheH3->addWidget(creditsLabel);


       coucheH4=new QHBoxLayout;
       coucheH4->addWidget(categorieLabel);

       coucheH5=new QHBoxLayout;
       coucheH5->addWidget(ouvertureALabel);
       coucheH5->addWidget(ouverturePLabel);

       coucheH6 = new QHBoxLayout;
       coucheH6->addWidget(fin);

       couche=new QVBoxLayout;
       couche->addLayout(coucheH1);
       couche->addLayout(coucheH2);
       couche->addLayout(coucheH3);
       couche->addLayout(coucheH4);
       couche->addLayout(coucheH5);
       couche->addLayout(coucheH6);
       setLayout(couche);

       QObject::connect(fin, SIGNAL(clicked()), this, SLOT(termine()));
}
コード例 #2
0
ファイル: uv.cpp プロジェクト: jimmyVisse/projet_LO21
void UVManager::ecrireFichier(QXmlStreamWriter *r) {
    r->writeStartElement("uvs");
    for(QMap<QString, UV*>::iterator it = uvs.begin(); it!=uvs.end(); it++) {
        r->writeStartElement("uv");
        r->writeAttribute("automne", ((*it)->ouvertureAutomne())?"true":"false");
        r->writeAttribute("printemps", ((*it)->ouverturePrintemps())?"true":"false");
        r->writeTextElement("code",(*it)->getCode());
        r->writeTextElement("titre",(*it)->getTitre());
        QString cr; cr.setNum((*it)->getNbCredits());
        r->writeTextElement("credits",cr);
        r->writeTextElement("categorie",CategorieToString((*it)->getCategorie()));
        r->writeEndElement();
    }
}