Home

QtMmlWidget Class Reference

The QtMmlWidget class renders mathematical formulas written in MathML 2.0. More...

 #include <QtMmlWidget>

Inherits QFrame.

Public Types

Public Functions

Additional Inherited Members


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

enum QtMmlWidget::MmlFont

This ennumerated type is used in fontName() and setFontName() to specify a font type.

ConstantValueDescription
QtMmlWidget::NormalFont0The default font type, used to render expressions for which no mathvariant or fontfamily is specified, or for which the "normal" mathvariant is specified.
QtMmlWidget::FrakturFont1The font type used to render expressions for which the "fraktur" mathvariant is specified.
QtMmlWidget::SansSerifFont2The font type used to render expressions for which the "sans-serif" mathvariant is specified.
QtMmlWidget::ScriptFont3The font type used to render expressions for which the "script" mathvariant is specified.
QtMmlWidget::MonospaceFont4The font type used to render expressions for which the "monospace" mathvariant is specified.
QtMmlWidget::DoublestruckFont5The 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 )

Constructs a QtMmlWidget object. The parent parameter is 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().

void QtMmlWidget::clear ()

Clears the contents of this widget.

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().

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().

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 successfully 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 <math> element.

void QtMmlWidget::setDrawFrames ( bool b )

If b is true, draws a red bounding rectangle around each expression; if b is false, no such rectangle is drawn. This is mostly useful for debugging MathML expressions.

See also drawFrames().

void QtMmlWidget::setFontName ( MmlFont type, const QString & name )

Sets the name of the font used to render the font type to name.

See also fontName(), setBaseFontPointSize(), baseFontPointSize(), and QtMmlWidget::MmlFont.

QSize QtMmlWidget::sizeHint () const   [virtual]

Returns the size of the formula in pixels.

Reimplemented from QWidget.


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Solutions