Partage
  • Partager sur Facebook
  • Partager sur Twitter

probleme avec qt4

    6 mai 2008 à 12:57:28

    salut,
    j'ai utiliser l'exemple http://doc.trolltech.com/4.4/webkit-previewer.html qt4 sous ubuntu pour ajouter plus de fonctinnalité (utilisation de DOM) mais j'ai ses erreurs a la compilation:
    mainwindow.cpp:8:24: erreur: QDomDocument : Aucun fichier ou répertoire de ce type
    mainwindow.cpp: In member function «void MainWindow::updateTextEdit()":
    mainwindow.cpp:144: attention : unused variable «bb"
    mainwindow.cpp: In member function «void MainWindow::dom()":
    mainwindow.cpp:161: erreur: «QDomDocument" was not declared in this scope
    mainwindow.cpp:161: erreur: expected `;' before «doc"
    mainwindow.cpp:162: erreur: «QDomElement" was not declared in this scope
    mainwindow.cpp:162: erreur: expected `;' before «root"
    mainwindow.cpp:163: erreur: «doc" was not declared in this scope
    mainwindow.cpp:163: erreur: «root" was not declared in this scope
    mainwindow.cpp:165: erreur: expected `;' before «tag"
    mainwindow.cpp:166: erreur: «tag" was not declared in this scope
    mainwindow.cpp:168: erreur: «QDomText" was not declared in this scope
    mainwindow.cpp:168: erreur: expected `;' before «t"
    mainwindow.cpp:169: erreur: «t" was not declared in this scope
    mainwindow.cpp:171: attention : unused variable «xml"
    make: *** [mainwindow.o] Erreur 1

    veux dire quoi c'est erreurs ???? et voila le code que j'ai ajouter:
    void MainWindow::dom()
    {
    QDomDocument doc("MyML");
    QDomElement root = doc.createElement("MyML");
    doc.appendChild(root);

    QDomElement tag = doc.createElement("Greeting");
    root.appendChild(tag);

    QDomText t = doc.createTextNode("Hello World");
    tag.appendChild(t);

    QString xml = doc.toString();
    }

    merci,,,,,,,,
    • Partager sur Facebook
    • Partager sur Twitter
      6 mai 2008 à 16:49:45

      essais d'ajouter, dans ton fichier .pro :

      QT += xml
      


      puis refait qmake puis make.

      EDIT : oh et, apprend à entourer ton code de balise de code, pour une meilleur lisibilité ;)
      • Partager sur Facebook
      • Partager sur Twitter
      Altarapp.com - Applications, Code Snippets, API Wrappers et etc, le tout en C# le plus clair du temps!
        7 mai 2008 à 10:59:06

        Salut;
        J’ai ajouté QT +=xml ça marche très bien, merci beaucoup.
        J’ai essaye d’exécuter l'exemple Simple DOM Model de qt4 http://doc.trolltech.com/4.4/itemviews [...] dommodel.html mais il n’affiche rien lorsque j’ouvre un fichier .html ???
        Pouvez vous m'aider?
        Pour info je l’exécuter à partir de consol (Qt4.3.4 Command Prompt) et par ( Examples and Demos )de menu démarrer.
        Merci,
        Bon développement,
        • Partager sur Facebook
        • Partager sur Twitter
          7 mai 2008 à 16:37:43

          il semble que l'exemple soit Fait pour exécuter des fichier XML et non HTML ;)

          DOM -> pour XML.
          • Partager sur Facebook
          • Partager sur Twitter
          Altarapp.com - Applications, Code Snippets, API Wrappers et etc, le tout en C# le plus clair du temps!
            8 mai 2008 à 15:28:45

            Salut,
            Finalement ça marche pour html mais l’exemple de dom est trop limité
            Par exemple pour ce fichier html ça marche bien :
            <html><head><title>arbre dom</title></head>
            <body>
            <p><font >
            salut
            </font>
            </p></body></html>
            Mais si j’ajoute à la balise font la propriété size =10 s’affiche rien ??

            • Partager sur Facebook
            • Partager sur Twitter

            probleme avec qt4

            × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
            × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
            • Editeur
            • Markdown