QtMmlWidget Class Reference
The QtMmlWidget class renders mathematical formulas written in MathML 2.0.
More...
#include <qtmmlwidget.h>
List of all member functions.
Public Members
enum
MmlFont { NormalFont, FrakturFont, SansSerifFont, ScriptFont, MonospaceFont, DoublestruckFont }
QtMmlWidget ( QWidget * parent = 0, const char * name = 0 )
void
setFontName ( MmlFont type, const QString & name )
bool
setContent ( const QString & text, QString * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )
Detailed Description
The QtMmlWidget class renders mathematical formulas written in MathML 2.0.
QtMmlWidget implements the Presentation Markup subset of the
MathML 2.0 specification, with a few exceptions.
QtMmlWidget *mmlWidget = new QtMmlWidget(this);
QString errorMsg;
int errorLine;
int errorColumn;
bool ok = mmlWidget->setContent(mmlText, &errorMsg, &errorLine, &errorColumn);
if (!ok) {
qWarning("MathML error: %s, Line: %d, Column: %d",
errorMsg.latin1(), errorLine, errorColumn);
}
Member Type Documentation
QtMmlWidget::MmlFont
This ennumerated type is used in fontName() and setFontName() to
specify a font type.
- QtMmlWidget::NormalFont - The default font type, used to render
expressions for which no mathvariant or fontfamily is specified,
or for which the "normal" mathvariant is specified.
- QtMmlWidget::FrakturFont - The font type used to render expressions for
which the "fraktur" mathvariant is specified.
- QtMmlWidget::SansSerifFont - The font type used to render expressions
for which the "sans-serif" mathvariant is specified.
- QtMmlWidget::ScriptFont - The font type used to render expressions
for which the "script" mathvariant is specified.
- QtMmlWidget::MonospaceFont - The font type used to render expressions
for which the "monospace" mathvariant is specified.
- QtMmlWidget::DoublestruckFont - The font type used to render expressions
for which the "doublestruck" mathvariant is specified.
See also setFontName(), fontName(), setBaseFontPointSize(), and baseFontPointSize().
Member Function Documentation
QtMmlWidget::QtMmlWidget ( QWidget * parent = 0, const char * name = 0 )
Constructs a QtMmlWidget object. The parent and name
parameters are passed to QFrame's constructor.
QtMmlWidget::~QtMmlWidget ()
Destructs a QtMmlWidget object.
int QtMmlWidget::baseFontPointSize () const
Returns the point size of the font used to render expressions
whose scriptlevel is 0.
See also setBaseFontPointSize(), fontName(), and setFontName().
Example: mainwindow.cpp.
void QtMmlWidget::clear ()
Clears the contents of this widget.
Example: mainwindow.cpp.
bool QtMmlWidget::drawFrames () const
Returns true if each expression should be drawn with a red
bounding rectangle; otherwise returns false.
This is mostly useful for debugging MathML expressions.
See also setDrawFrames().
Example: mainwindow.cpp.
QString QtMmlWidget::fontName ( MmlFont type ) const
Returns the name of the font used to render the font type.
See also setFontName(), setBaseFontPointSize(), baseFontPointSize(), and QtMmlWidget::MmlFont.
void QtMmlWidget::setBaseFontPointSize ( int size )
Sets the point size of the font used to render expressions
whose scriptlevel is 0.
See also baseFontPointSize(), fontName(), and setFontName().
Example: mainwindow.cpp.
bool QtMmlWidget::setContent ( const QString & text, QString * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )
Sets the MathML expression to be rendered. The expression is given
in the string text. If the expression is sucesfully parsed,
this method returns true; otherwise it returns false. If an error
occured errorMsg is set to a diagnostic message, while errorLine and errorColumn contain the location of the error.
Any of errorMsg, errorLine and errorColumn may be 0,
in which case they are not set.
text should contain MathML 2.0 presentation markup elements enclosed
in a