Hello,

Despite all my research on the web, I'm still failing to display correctly a math expression using the MathML engine of Qwt. So far, I created a minimalist "testing project", aiming to only display a MathML-formatted text fed in via a text file in the execution directory :
Qt Code:
  1. // includes erased here for clarity
  2. int main(int argc, char** argv)
  3. {
  4. ifstream ifs("text");
  5. std::string fullText="";
  6. while(!ifs.eof())
  7. {
  8. std::string line;
  9. getline(ifs,line);
  10. fullText += line + "\n";
  11. }
  12.  
  13. QTextCodec::setCodecForCStrings(QTextCodec::codecForName("utf-8")); // Strings in files are UTF-8 encoded
  14. QwtText::setTextEngine(QwtText::MathMLText, new QwtMathMLTextEngine()); // Setting Qwt text engine to MathML
  15.  
  16. QApplication a(argc, argv);
  17.  
  18. QString locale = QLocale::system().name().section('_', 0, 0); // Installs a translator to the user's locale
  19. QTranslator translator;
  20. translator.load(QString("qt_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
  21. a.installTranslator(&translator);
  22.  
  23. QwtText text(QString(fullText.c_str()), QwtText::MathMLText);
  24. QwtTextLabel* lbl = new QwtTextLabel(text);
  25. lbl->setMinimumHeight(100);
  26. lbl->setMinimumWidth(200);
  27. lbl->show();
  28.  
  29.  
  30. return a.exec();
  31. }
To copy to clipboard, switch view to plain text mode 

My "text" file contains a MathML expression directly copy/pasted from Wikipedia, to display the solutions of a quadratic equation, which - I suppose - is syntaxically correct : http://pastebin.com/Nq6gYkvf.
This code results displaying only letters, not formatted at all, as seen in this screenshot :
tmp.png

What am I doing wrong?

Thanks for your help,
Tobast.