Home

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


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.

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

Example: mainwindow.cpp.

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

Example: mainwindow.cpp.

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.

This file is part of the Qt Solutions. Copyright © 2003-2004 Trolltech. All Rights Reserved.

Copyright © 2003-2004 TrolltechTrademarks
Qt Solutions