Bonjour,
je suis en train de faire une fonction pour enregistrer un fichier, mais elle n'a pas l'air de marcher.
voici la fonction:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
void FenCodeGenere::enregistrer()
{
 
        QString nomH = nom;
        nomH += ".h";
    QByteArray code= codeGene->toUtf8();
 
 
    QFile fichier(nomH);
 
   QDir::setPath( QFileDialog::getSaveFileName(this));
 
 
     fichier.open(QIODevice::WriteOnly);
 
 
        fichier.write(code);
       if (fichier.exist())
              QMessageBox::information(this, "R�ussite de sauvegarde", "Vous venez de sauvegarder le code: "
        + nom +  ".h dans le dossier: " + dossier, QMessageBox::Close);
 
}
voilà, et la console affiche ça:
Citation Envoyé par console
FenCodeGenere.cpp: In member function «void FenCodeGenere::enregistrer()»:
FenCodeGenere.cpp:90: erreur: cannot call member function «void QDir::setPath(const QString&)» without object
FenCodeGenere.cpp:99: erreur: «dossier» was not declared in this scope
make: *** [FenCodeGenere.o] Erreur 1
Quelqu'un pourrait m'orienter svp...
merci d'avance