final constructeur (copie) step

This commit is contained in:
p2405951 2025-06-19 10:22:43 +02:00
parent 016927b34a
commit 96321942f0
4 changed files with 13 additions and 12 deletions

View File

@ -13,13 +13,5 @@ int main(int argc, char *argv[])
MainWindow w;
//w.show();
QFile file(":/data/ex.txt");
file.open(QIODevice::ReadOnly|QIODevice::Text);
QTextStream in(&file);
Step v();
/* QString contenu = in.readAll();
qDebug() << "Contenu lu depuis QTextStream:";
qDebug().noquote() << contenu;*/
return a.exec();
}

View File

@ -41,4 +41,11 @@ Path::Path(QFile *file){
}
void Path::addStep(int indice){step.insert(indice, Step());}
void Path::addStep(int indice){
if(indice==-1){
step.append(Step());
}else{
step.insert(indice, Step());
}
}

2
path.h
View File

@ -20,7 +20,7 @@ private:
public:
Path();
Path(QFile *file);
void addStep(int indice=step.size());
void addStep(int indice=-1);
};
#endif // PATH_H

View File

@ -55,12 +55,14 @@ Step::Step( QJsonObject &in)
for (const QJsonValue &val : personnagetab) {
if (val.isObject()) {
QJsonObject obj = val.toObject();
QString personnage = obj["personnage"].toString();
personnage.append(personnage);
QString personnages = obj["personnage"].toString();
personnage.append(personnages);
QString textes = obj["texte"].toString();
texte.append(textes);
}
}
}