Thursday, April 1, 2010

MathML editor using Qt support for MathML

I decided to give the MML widget a try to create an example for MathML rendering: display a mathematical formula from the description contained in an XML file. This is a component available from Qt solutions (see my previous post about them) to enhance the by itself long list of classes and modules already available in Qt. For more information about the MathML standard, you may read this MathML introduction

The component is composed of just one class, QtMmlWidget which can be used as source code into our project, or it can be built into a library (./configure -library). One requirement is the presence of a Unicode font, which can be found here font for Mozilla.

My example is inspired by the sample contained along MML widget from Qt. In this case, the text editor has syntax highlighting (courtesy of the Qt's example about xmlpatterns) and the the formula is updated every time the Save option is used. Besides that, the formula can be exported as an image file.



I hope that this simple application may serve as an introduction to both MathML and the MML capabilities that Qt provide us.

8 comments:

  1. Good ! Do you know whether, there will be any available python bindings for it ?

    ReplyDelete
  2. I'm not sure that this component is available for Python too. Would you like to try contacting some of the forums (http://qt.nokia.com/developer/community-resources)?
    Another approach could be trying to build the component as a shared library (.so in Linux or .dll in Windows) and using it from Python as an external library.

    Good luck!

    ReplyDelete
  3. Is that an april fool?

    Because I can't find it anymore :)

    ReplyDelete
  4. This component looks like it has disappeared off the face of the Internet...

    ReplyDelete
  5. Well, I don'tr know how to say. It's a really surprise to me that Nokia removed all the components from the Qt page (catalog) and move it into gitorious but I cannot find it even there.
    One thing I can suggest is to give Qt Webkit a try to see if the MathML support for HTML5 is working now.

    ReplyDelete
  6. I've found some source for the component hosted elsewhere:

    http://kdeedu.sourcearchive.com/documentation/4.4.1/dir_db7223a53d9a4a5aeccf7dd8eac40251.html

    I was able to build it just fine!

    ReplyDelete
  7. For whoever is looking for QtMmlWidget: ftp://ftp.qt.nokia.com/qt/solutions/lgpl/.

    ReplyDelete
    Replies
    1. QtMmlWidget has long been discontinued. QtMmlWidget's MathML renderer was incorporated in Qwt at some point, but it wasn't working properly. I have however 'fixed' it and it is now working in a way similar to the original QtMmlWidget (see http://www.qtcentre.org/threads/54293-MathML-problem-displaying-a-math-expression?p=249735#post249735). Hopefully, 'my' changes will get incorporated in Qwt.

      Delete