final constructeur (copie) step
This commit is contained in:
parent
016927b34a
commit
96321942f0
8
main.cpp
8
main.cpp
@ -13,13 +13,5 @@ int main(int argc, char *argv[])
|
|||||||
MainWindow w;
|
MainWindow w;
|
||||||
//w.show();
|
//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();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
9
path.cpp
9
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
2
path.h
2
path.h
@ -20,7 +20,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
Path();
|
Path();
|
||||||
Path(QFile *file);
|
Path(QFile *file);
|
||||||
void addStep(int indice=step.size());
|
void addStep(int indice=-1);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PATH_H
|
#endif // PATH_H
|
||||||
|
|||||||
6
step.cpp
6
step.cpp
@ -55,12 +55,14 @@ Step::Step( QJsonObject &in)
|
|||||||
for (const QJsonValue &val : personnagetab) {
|
for (const QJsonValue &val : personnagetab) {
|
||||||
if (val.isObject()) {
|
if (val.isObject()) {
|
||||||
QJsonObject obj = val.toObject();
|
QJsonObject obj = val.toObject();
|
||||||
QString personnage = obj["personnage"].toString();
|
QString personnages = obj["personnage"].toString();
|
||||||
personnage.append(personnage);
|
personnage.append(personnages);
|
||||||
QString textes = obj["texte"].toString();
|
QString textes = obj["texte"].toString();
|
||||||
texte.append(textes);
|
texte.append(textes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user