PDA

View Full Version : Simple example use of qtmmlwidget.



mbkb
6th August 2009, 18:32
Dear QtCentre,

I am trying to use the above widget to display a polynomial (nothing more for now!). I have downloaded qtmmlwidget-2.4-opensource which is a "Qt Solution". I have compiled the example provided, which works as expected. I understand that I need to add

include(../src/qtmmlwidget.pri)

or equivalent to my .pro file.

However, from the example I'm having trouble discerning exactly how to:

(a) read the .mml file into a QTextStream, and then into a QString.
(b) use QtMmlWidget to take this string and display the content of the .mml file.

I would be grateful if someone could show me as simple an example as possible of a qt application that takes a .mml file and displays it as a widget in say a MainWindow.

Many Thanks

Matt

franz
6th August 2009, 20:29
Read about QTextStream and QtMmlWidget (http://doc.trolltech.com/solutions/4/qtmmlwidget/qtmmlwidget.html) (check setContent()). It really isn't that difficult.

Open a file
Connect a QTextStream to it
Extract data (textstream >> string)
Put data in QtMmlWidget (mmlThing->setContent(string))

mbkb
7th August 2009, 12:27
I have it working now! I'll make the 'Class Reference' pages my first port of call in future.

Thanks

Matt