PDA

View Full Version : Need help with two questions please



phantom2323
1st March 2012, 04:59
Hello all. I am creating a computerized quiz application for a tutoring center I work at, and I have two questions that I hope some of you can shed some light on:

1. I am formatting how the questions will be shown using HTML, displayed via QTextDocument/QTextEdit. I'm storing some images (30-40 KB each in size) in a SQLite DB as BLOBs, and read the data into a QImage and add this image as a resource using QTextDocument::addResource. Within the HTML code for any given question, I am using the <img> tag whose source will be the relevant resource name. When I'm done with the image, do I have to remove the resource name some how. Or are there any other considerations I need to take into account (besides deleting the QImage pointer, which I do)?

2. I would prefer to have some nicely formatted mathematical expressions shown. As I understand it, the Qt Web Kit does not support MathML (at least I couldnt get it to understand it when I did a quick test). I still need something that will work nicely with HTML, but I would prefer not to create imagse and store them in the DB like any other image I would need. Any suggestions about how I could render math expressions and insert it into the question?

Thank you for your time and consideration regarding my questions! Much appreciated :)

Spitfire
5th March 2012, 12:33
Take a look at this (http://doc.qt.nokia.com/solutions/4/qtmmlwidget/qtmmlwidget.html) if you haven't seen it yet, maybe it will help you.

Also deleting the image should be ok as QTextDocument makes a copy of the resources and store them in the cache.
The only way to clear the cahe is to call QTextDocument::clear().