diff --git a/main.cpp b/main.cpp index cc22cfb..0c0a6eb 100644 --- a/main.cpp +++ b/main.cpp @@ -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(); } diff --git a/path.cpp b/path.cpp index 4f4fd97..64a2a09 100644 --- a/path.cpp +++ b/path.cpp @@ -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()); + } + +} diff --git a/path.h b/path.h index b990bbb..f95f24b 100644 --- a/path.h +++ b/path.h @@ -20,7 +20,7 @@ private: public: Path(); Path(QFile *file); - void addStep(int indice=step.size()); + void addStep(int indice=-1); }; #endif // PATH_H diff --git a/step.cpp b/step.cpp index 409b5d1..861f414 100644 --- a/step.cpp +++ b/step.cpp @@ -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); } } + + }