Skip to content
qwt_text.cpp 15.6 KiB
Newer Older
pixhawk's avatar
pixhawk committed
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
 * Qwt Widget Library
 * Copyright (C) 1997   Josef Wilgen
 * Copyright (C) 2003   Uwe Rathmann
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the Qwt License, Version 1.0
 *****************************************************************************/

Bryant's avatar
Bryant committed
#include "qwt_text.h"
#include "qwt_painter.h"
#include "qwt_text_engine.h"
pixhawk's avatar
pixhawk committed
#include <qmap.h>
#include <qfont.h>
#include <qcolor.h>
#include <qpen.h>
#include <qbrush.h>
#include <qpainter.h>
#include <qapplication.h>
#include <qdesktopwidget.h>
Bryant's avatar
Bryant committed
#include <qmath.h>
pixhawk's avatar
pixhawk committed

class QwtTextEngineDict
{
public:
Bryant's avatar
Bryant committed
    static QwtTextEngineDict &dict();
pixhawk's avatar
pixhawk committed

Bryant's avatar
Bryant committed
    void setTextEngine( QwtText::TextFormat, QwtTextEngine * );

    const QwtTextEngine *textEngine( QwtText::TextFormat ) const;
    const QwtTextEngine *textEngine( const QString &,
        QwtText::TextFormat ) const;
pixhawk's avatar
pixhawk committed

private:
Bryant's avatar
Bryant committed
    QwtTextEngineDict();
    ~QwtTextEngineDict();

pixhawk's avatar
pixhawk committed
    typedef QMap<int, QwtTextEngine *> EngineMap;

Bryant's avatar
Bryant committed
    inline const QwtTextEngine *engine( EngineMap::const_iterator &it ) const
    {
pixhawk's avatar
pixhawk committed
        return it.value();
    }

    EngineMap d_map;
};

Bryant's avatar
Bryant committed
QwtTextEngineDict &QwtTextEngineDict::dict()
{
    static QwtTextEngineDict engineDict;
    return engineDict;
}

pixhawk's avatar
pixhawk committed
QwtTextEngineDict::QwtTextEngineDict()
{
Bryant's avatar
Bryant committed
    d_map.insert( QwtText::PlainText, new QwtPlainTextEngine() );
pixhawk's avatar
pixhawk committed
#ifndef QT_NO_RICHTEXT
Bryant's avatar
Bryant committed
    d_map.insert( QwtText::RichText, new QwtRichTextEngine() );
pixhawk's avatar
pixhawk committed
#endif
}

QwtTextEngineDict::~QwtTextEngineDict()
{
    for ( EngineMap::const_iterator it = d_map.begin();
Bryant's avatar
Bryant committed
        it != d_map.end(); ++it )
    {
        const QwtTextEngine *textEngine = engine( it );
pixhawk's avatar
pixhawk committed
        delete textEngine;
    }
}

Bryant's avatar
Bryant committed
const QwtTextEngine *QwtTextEngineDict::textEngine( const QString& text,
    QwtText::TextFormat format ) const
pixhawk's avatar
pixhawk committed
{
Bryant's avatar
Bryant committed
    if ( format == QwtText::AutoText )
    {
        for ( EngineMap::const_iterator it = d_map.begin();
Bryant's avatar
Bryant committed
            it != d_map.end(); ++it )
        {
            if ( it.key() != QwtText::PlainText )
            {
                const QwtTextEngine *e = engine( it );
                if ( e && e->mightRender( text ) )
                    return e;
pixhawk's avatar
pixhawk committed
            }
        }
    }

Bryant's avatar
Bryant committed
    EngineMap::const_iterator it = d_map.find( format );
    if ( it != d_map.end() )
    {
        const QwtTextEngine *e = engine( it );
pixhawk's avatar
pixhawk committed
        if ( e )
            return e;
    }

Bryant's avatar
Bryant committed
    it = d_map.find( QwtText::PlainText );
    return engine( it );
pixhawk's avatar
pixhawk committed
}

Bryant's avatar
Bryant committed
void QwtTextEngineDict::setTextEngine( QwtText::TextFormat format,
    QwtTextEngine *engine )
pixhawk's avatar
pixhawk committed
{
    if ( format == QwtText::AutoText )
        return;

    if ( format == QwtText::PlainText && engine == NULL )
        return;

Bryant's avatar
Bryant committed
    EngineMap::const_iterator it = d_map.find( format );
    if ( it != d_map.end() )
    {
        const QwtTextEngine *e = this->engine( it );
pixhawk's avatar
pixhawk committed
        if ( e )
            delete e;

Bryant's avatar
Bryant committed
        d_map.remove( format );
pixhawk's avatar
pixhawk committed
    }

    if ( engine != NULL )
Bryant's avatar
Bryant committed
        d_map.insert( format, engine );
pixhawk's avatar
pixhawk committed
}

const QwtTextEngine *QwtTextEngineDict::textEngine(
Bryant's avatar
Bryant committed
    QwtText::TextFormat format ) const
pixhawk's avatar
pixhawk committed
{
    const QwtTextEngine *e = NULL;

Bryant's avatar
Bryant committed
    EngineMap::const_iterator it = d_map.find( format );
pixhawk's avatar
pixhawk committed
    if ( it != d_map.end() )
Bryant's avatar
Bryant committed
        e = engine( it );
pixhawk's avatar
pixhawk committed

    return e;
}

class QwtText::PrivateData
{
public:
    PrivateData():
Bryant's avatar
Bryant committed
        renderFlags( Qt::AlignCenter ),
        borderRadius( 0 ),
        borderPen( Qt::NoPen ),
        backgroundBrush( Qt::NoBrush ),
        paintAttributes( 0 ),
        layoutAttributes( 0 ),
        textEngine( NULL )
    {
pixhawk's avatar
pixhawk committed
    }

    int renderFlags;
    QString text;
    QFont font;
    QColor color;
Bryant's avatar
Bryant committed
    double borderRadius;
    QPen borderPen;
pixhawk's avatar
pixhawk committed
    QBrush backgroundBrush;

Bryant's avatar
Bryant committed
    QwtText::PaintAttributes paintAttributes;
    QwtText::LayoutAttributes layoutAttributes;
pixhawk's avatar
pixhawk committed

    const QwtTextEngine *textEngine;
};

class QwtText::LayoutCache
{
public:
Bryant's avatar
Bryant committed
    void invalidate()
    {
        textSize = QSizeF();
pixhawk's avatar
pixhawk committed
    }

    QFont font;
Bryant's avatar
Bryant committed
    QSizeF textSize;
pixhawk's avatar
pixhawk committed
};

/*!
   Constructor

   \param text Text content
   \param textFormat Text format
*/
Bryant's avatar
Bryant committed
QwtText::QwtText( const QString &text, QwtText::TextFormat textFormat )
pixhawk's avatar
pixhawk committed
{
    d_data = new PrivateData;
    d_data->text = text;
Bryant's avatar
Bryant committed
    d_data->textEngine = textEngine( text, textFormat );
pixhawk's avatar
pixhawk committed

    d_layoutCache = new LayoutCache;
}

//! Copy constructor
Bryant's avatar
Bryant committed
QwtText::QwtText( const QwtText &other )
pixhawk's avatar
pixhawk committed
{
    d_data = new PrivateData;
    *d_data = *other.d_data;

    d_layoutCache = new LayoutCache;
    *d_layoutCache = *other.d_layoutCache;
}

//! Destructor
QwtText::~QwtText()
pixhawk's avatar
pixhawk committed
{
    delete d_data;
    delete d_layoutCache;
}

Bryant's avatar
Bryant committed
//! Assignment operator
QwtText &QwtText::operator=( const QwtText & other )
pixhawk's avatar
pixhawk committed
{
    *d_data = *other.d_data;
    *d_layoutCache = *other.d_layoutCache;
    return *this;
}
Bryant's avatar
Bryant committed
//! Relational operator
bool QwtText::operator==( const QwtText &other ) const
pixhawk's avatar
pixhawk committed
{
    return d_data->renderFlags == other.d_data->renderFlags &&
Bryant's avatar
Bryant committed
        d_data->text == other.d_data->text &&
        d_data->font == other.d_data->font &&
        d_data->color == other.d_data->color &&
        d_data->borderRadius == other.d_data->borderRadius &&
        d_data->borderPen == other.d_data->borderPen &&
        d_data->backgroundBrush == other.d_data->backgroundBrush &&
        d_data->paintAttributes == other.d_data->paintAttributes &&
        d_data->textEngine == other.d_data->textEngine;
pixhawk's avatar
pixhawk committed
}

Bryant's avatar
Bryant committed
//! Relational operator
bool QwtText::operator!=( const QwtText &other ) const // invalidate
pixhawk's avatar
pixhawk committed
{
Bryant's avatar
Bryant committed
    return !( other == *this );
pixhawk's avatar
pixhawk committed
}

/*!
   Assign a new text content

   \param text Text content
   \param textFormat Text format
Bryant's avatar
Bryant committed

   \sa text()
pixhawk's avatar
pixhawk committed
*/
Bryant's avatar
Bryant committed
void QwtText::setText( const QString &text,
    QwtText::TextFormat textFormat )
{
    d_data->text = text;
Bryant's avatar
Bryant committed
    d_data->textEngine = textEngine( text, textFormat );
pixhawk's avatar
pixhawk committed
    d_layoutCache->invalidate();
}

Bryant's avatar
Bryant committed
   \return Text as QString.
   \sa setText()
pixhawk's avatar
pixhawk committed
*/
QString QwtText::text() const
{
    return d_data->text;
pixhawk's avatar
pixhawk committed
}

/*!
   \brief Change the render flags

   The default setting is Qt::AlignCenter

Bryant's avatar
Bryant committed
   \param renderFlags Bitwise OR of the flags used like in QPainter::drawText()
pixhawk's avatar
pixhawk committed

Bryant's avatar
Bryant committed
   \sa renderFlags(), QwtTextEngine::draw()
pixhawk's avatar
pixhawk committed
   \note Some renderFlags might have no effect, depending on the text format.
*/
Bryant's avatar
Bryant committed
void QwtText::setRenderFlags( int renderFlags )
Bryant's avatar
Bryant committed
    if ( renderFlags != d_data->renderFlags )
    {
        d_data->renderFlags = renderFlags;
pixhawk's avatar
pixhawk committed
        d_layoutCache->invalidate();
    }
}

/*!
   \return Render flags
Bryant's avatar
Bryant committed
   \sa setRenderFlags()
pixhawk's avatar
pixhawk committed
*/
int QwtText::renderFlags() const
{
    return d_data->renderFlags;
pixhawk's avatar
pixhawk committed
}

pixhawk's avatar
pixhawk committed
   Set the font.

   \param font Font
   \note Setting the font might have no effect, when
         the text contains control sequences for setting fonts.
*/
Bryant's avatar
Bryant committed
void QwtText::setFont( const QFont &font )
pixhawk's avatar
pixhawk committed
{
    d_data->font = font;
Bryant's avatar
Bryant committed
    setPaintAttribute( PaintUsingTextFont );
pixhawk's avatar
pixhawk committed
}

//! Return the font.
QFont QwtText::font() const
{
    return d_data->font;
pixhawk's avatar
pixhawk committed
}

/*!
Bryant's avatar
Bryant committed
   Return the font of the text, if it has one.
   Otherwise return defaultFont.

   \param defaultFont Default font
   \return Font used for drawing the text
pixhawk's avatar
pixhawk committed

Bryant's avatar
Bryant committed
   \sa setFont(), font(), PaintAttributes
pixhawk's avatar
pixhawk committed
*/
Bryant's avatar
Bryant committed
QFont QwtText::usedFont( const QFont &defaultFont ) const
pixhawk's avatar
pixhawk committed
{
    if ( d_data->paintAttributes & PaintUsingTextFont )
        return d_data->font;

    return defaultFont;
}

Bryant's avatar
Bryant committed
   Set the pen color used for drawing the text.
pixhawk's avatar
pixhawk committed

   \param color Color
   \note Setting the color might have no effect, when
         the text contains control sequences for setting colors.
*/
Bryant's avatar
Bryant committed
void QwtText::setColor( const QColor &color )
{
    d_data->color = color;
Bryant's avatar
Bryant committed
    setPaintAttribute( PaintUsingTextColor );
pixhawk's avatar
pixhawk committed
}

//! Return the pen color, used for painting the text
QColor QwtText::color() const
{
    return d_data->color;
pixhawk's avatar
pixhawk committed
}

/*!
  Return the color of the text, if it has one.
pixhawk's avatar
pixhawk committed
  Otherwise return defaultColor.

  \param defaultColor Default color
Bryant's avatar
Bryant committed
  \return Color used for drawing the text

  \sa setColor(), color(), PaintAttributes
pixhawk's avatar
pixhawk committed
*/
Bryant's avatar
Bryant committed
QColor QwtText::usedColor( const QColor &defaultColor ) const
pixhawk's avatar
pixhawk committed
{
    if ( d_data->paintAttributes & PaintUsingTextColor )
        return d_data->color;

    return defaultColor;
}

Bryant's avatar
Bryant committed
/*!
  Set the radius for the corners of the border frame

  \param radius Radius of a rounded corner
  \sa borderRadius(), setBorderPen(), setBackgroundBrush()
*/
void QwtText::setBorderRadius( double radius )
{
    d_data->borderRadius = qMax( 0.0, radius );
}

/*!
  \return Radius for the corners of the border frame
  \sa setBorderRadius(), borderPen(), backgroundBrush()
*/
double QwtText::borderRadius() const
{
    return d_data->borderRadius;
}

pixhawk's avatar
pixhawk committed
/*!
   Set the background pen

   \param pen Background pen
Bryant's avatar
Bryant committed
   \sa borderPen(), setBackgroundBrush()
pixhawk's avatar
pixhawk committed
*/
Bryant's avatar
Bryant committed
void QwtText::setBorderPen( const QPen &pen )
Bryant's avatar
Bryant committed
    d_data->borderPen = pen;
    setPaintAttribute( PaintBackground );
pixhawk's avatar
pixhawk committed
}

pixhawk's avatar
pixhawk committed
   \return Background pen
Bryant's avatar
Bryant committed
   \sa setBorderPen(), backgroundBrush()
pixhawk's avatar
pixhawk committed
*/
Bryant's avatar
Bryant committed
QPen QwtText::borderPen() const
Bryant's avatar
Bryant committed
    return d_data->borderPen;
pixhawk's avatar
pixhawk committed
}

/*!
   Set the background brush

   \param brush Background brush
Bryant's avatar
Bryant committed
   \sa backgroundBrush(), setBorderPen()
pixhawk's avatar
pixhawk committed
*/
Bryant's avatar
Bryant committed
void QwtText::setBackgroundBrush( const QBrush &brush )
{
    d_data->backgroundBrush = brush;
Bryant's avatar
Bryant committed
    setPaintAttribute( PaintBackground );
pixhawk's avatar
pixhawk committed
}

pixhawk's avatar
pixhawk committed
   \return Background brush
Bryant's avatar
Bryant committed
   \sa setBackgroundBrush(), borderPen()
pixhawk's avatar
pixhawk committed
*/
QBrush QwtText::backgroundBrush() const
{
    return d_data->backgroundBrush;
pixhawk's avatar
pixhawk committed
}

/*!
   Change a paint attribute

   \param attribute Paint attribute
   \param on On/Off

Bryant's avatar
Bryant committed
   \note Used by setFont(), setColor(),
         setBorderPen() and setBackgroundBrush()
   \sa testPaintAttribute()
pixhawk's avatar
pixhawk committed
*/
Bryant's avatar
Bryant committed
void QwtText::setPaintAttribute( PaintAttribute attribute, bool on )
pixhawk's avatar
pixhawk committed
{
    if ( on )
        d_data->paintAttributes |= attribute;
    else
        d_data->paintAttributes &= ~attribute;
}

/*!
   Test a paint attribute

   \param attribute Paint attribute
   \return true, if attribute is enabled

Bryant's avatar
Bryant committed
   \sa setPaintAttribute()
pixhawk's avatar
pixhawk committed
*/
Bryant's avatar
Bryant committed
bool QwtText::testPaintAttribute( PaintAttribute attribute ) const
pixhawk's avatar
pixhawk committed
{
    return d_data->paintAttributes & attribute;
}

/*!
   Change a layout attribute

   \param attribute Layout attribute
   \param on On/Off
Bryant's avatar
Bryant committed
   \sa testLayoutAttribute()
Bryant's avatar
Bryant committed
void QwtText::setLayoutAttribute( LayoutAttribute attribute, bool on )
pixhawk's avatar
pixhawk committed
{
    if ( on )
        d_data->layoutAttributes |= attribute;
    else
        d_data->layoutAttributes &= ~attribute;
}

/*!
   Test a layout attribute

   \param attribute Layout attribute
   \return true, if attribute is enabled

Bryant's avatar
Bryant committed
   \sa setLayoutAttribute()
pixhawk's avatar
pixhawk committed
*/
Bryant's avatar
Bryant committed
bool QwtText::testLayoutAttribute( LayoutAttribute attribute ) const
pixhawk's avatar
pixhawk committed
{
    return d_data->layoutAttributes | attribute;
}

/*!
   Find the height for a given width

   \param defaultFont Font, used for the calculation if the text has no font
   \param width Width

   \return Calculated height
*/
Bryant's avatar
Bryant committed
double QwtText::heightForWidth( double width, const QFont &defaultFont ) const
pixhawk's avatar
pixhawk committed
{
    // We want to calculate in screen metrics. So
    // we need a font that uses screen metrics

Bryant's avatar
Bryant committed
    const QFont font( usedFont( defaultFont ), QApplication::desktop() );
pixhawk's avatar
pixhawk committed

Bryant's avatar
Bryant committed
    double h = 0;
pixhawk's avatar
pixhawk committed

Bryant's avatar
Bryant committed
    if ( d_data->layoutAttributes & MinimumLayout )
    {
        double left, right, top, bottom;
        d_data->textEngine->textMargins( font, d_data->text,
            left, right, top, bottom );
pixhawk's avatar
pixhawk committed

        h = d_data->textEngine->heightForWidth(
Bryant's avatar
Bryant committed
            font, d_data->renderFlags, d_data->text,
            width + left + right );
pixhawk's avatar
pixhawk committed

        h -= top + bottom;
Bryant's avatar
Bryant committed
    }
    else
    {
pixhawk's avatar
pixhawk committed
        h = d_data->textEngine->heightForWidth(
Bryant's avatar
Bryant committed
            font, d_data->renderFlags, d_data->text, width );
pixhawk's avatar
pixhawk committed
    }

    return h;
}

/*!
   Find the height for a given width

   \param defaultFont Font, used for the calculation if the text has no font

   \return Calculated height
*/

/*!
   Returns the size, that is needed to render text

   \param defaultFont Font of the text
   \return Caluclated size
*/
Bryant's avatar
Bryant committed
QSizeF QwtText::textSize( const QFont &defaultFont ) const
pixhawk's avatar
pixhawk committed
{
    // We want to calculate in screen metrics. So
    // we need a font that uses screen metrics

Bryant's avatar
Bryant committed
    const QFont font( usedFont( defaultFont ), QApplication::desktop() );
pixhawk's avatar
pixhawk committed

    if ( !d_layoutCache->textSize.isValid()
Bryant's avatar
Bryant committed
        || d_layoutCache->font != font )
    {
pixhawk's avatar
pixhawk committed
        d_layoutCache->textSize = d_data->textEngine->textSize(
Bryant's avatar
Bryant committed
            font, d_data->renderFlags, d_data->text );
pixhawk's avatar
pixhawk committed
        d_layoutCache->font = font;
    }

Bryant's avatar
Bryant committed
    QSizeF sz = d_layoutCache->textSize;
pixhawk's avatar
pixhawk committed

Bryant's avatar
Bryant committed
    if ( d_data->layoutAttributes & MinimumLayout )
    {
        double left, right, top, bottom;
        d_data->textEngine->textMargins( font, d_data->text,
            left, right, top, bottom );
        sz -= QSizeF( left + right, top + bottom );
pixhawk's avatar
pixhawk committed
    }

    return sz;
}

/*!
   Draw a text into a rectangle

   \param painter Painter
   \param rect Rectangle
*/
Bryant's avatar
Bryant committed
void QwtText::draw( QPainter *painter, const QRectF &rect ) const
pixhawk's avatar
pixhawk committed
{
Bryant's avatar
Bryant committed
    if ( d_data->paintAttributes & PaintBackground )
    {
        if ( d_data->borderPen != Qt::NoPen ||
            d_data->backgroundBrush != Qt::NoBrush )
        {
pixhawk's avatar
pixhawk committed
            painter->save();
Bryant's avatar
Bryant committed

            painter->setPen( d_data->borderPen );
            painter->setBrush( d_data->backgroundBrush );

            if ( d_data->borderRadius == 0 )
            {
                QwtPainter::drawRect( painter, rect );
            }
            else
            {
                painter->setRenderHint( QPainter::Antialiasing, true );
                painter->drawRoundedRect( rect,
                    d_data->borderRadius, d_data->borderRadius );
            }

pixhawk's avatar
pixhawk committed
            painter->restore();
        }
    }

    painter->save();

Bryant's avatar
Bryant committed
    if ( d_data->paintAttributes & PaintUsingTextFont )
    {
        painter->setFont( d_data->font );
pixhawk's avatar
pixhawk committed
    }

Bryant's avatar
Bryant committed
    if ( d_data->paintAttributes & PaintUsingTextColor )
    {
pixhawk's avatar
pixhawk committed
        if ( d_data->color.isValid() )
Bryant's avatar
Bryant committed
            painter->setPen( d_data->color );
pixhawk's avatar
pixhawk committed
    }

Bryant's avatar
Bryant committed
    QRectF expandedRect = rect;
    if ( d_data->layoutAttributes & MinimumLayout )
    {
pixhawk's avatar
pixhawk committed
        // We want to calculate in screen metrics. So
        // we need a font that uses screen metrics

Bryant's avatar
Bryant committed
        const QFont font( painter->font(), QApplication::desktop() );
pixhawk's avatar
pixhawk committed

Bryant's avatar
Bryant committed
        double left, right, top, bottom;
pixhawk's avatar
pixhawk committed
        d_data->textEngine->textMargins(
Bryant's avatar
Bryant committed
            font, d_data->text, left, right, top, bottom );

        expandedRect.setTop( rect.top() - top );
        expandedRect.setBottom( rect.bottom() + bottom );
        expandedRect.setLeft( rect.left() - left );
        expandedRect.setRight( rect.right() + right );
pixhawk's avatar
pixhawk committed
    }

Bryant's avatar
Bryant committed
    d_data->textEngine->draw( painter, expandedRect,
        d_data->renderFlags, d_data->text );
pixhawk's avatar
pixhawk committed

    painter->restore();
}

/*!
   Find the text engine for a text format

   In case of QwtText::AutoText the first text engine
pixhawk's avatar
pixhawk committed
   (beside QwtPlainTextEngine) is returned, where QwtTextEngine::mightRender
Bryant's avatar
Bryant committed
   returns true. If there is none QwtPlainTextEngine is returned.
pixhawk's avatar
pixhawk committed

   If no text engine is registered for the format QwtPlainTextEngine
pixhawk's avatar
pixhawk committed
   is returnd.

   \param text Text, needed in case of AutoText
   \param format Text format

Bryant's avatar
Bryant committed
   \return Corresponding text engine
*/
const QwtTextEngine *QwtText::textEngine( const QString &text,
    QwtText::TextFormat format )
{
    return QwtTextEngineDict::dict().textEngine( text, format );
pixhawk's avatar
pixhawk committed
}

/*!
   Assign/Replace a text engine for a text format

   With setTextEngine it is possible to extend Qwt with
   other types of text formats.
pixhawk's avatar
pixhawk committed

   For QwtText::PlainText it is not allowed to assign a engine == NULL.
pixhawk's avatar
pixhawk committed
   \param format Text format
   \param engine Text engine

   \sa QwtMathMLTextEngine
   \warning Using QwtText::AutoText does nothing.
*/
Bryant's avatar
Bryant committed
void QwtText::setTextEngine( QwtText::TextFormat format,
    QwtTextEngine *engine )
pixhawk's avatar
pixhawk committed
{
Bryant's avatar
Bryant committed
    QwtTextEngineDict::dict().setTextEngine( format, engine );
pixhawk's avatar
pixhawk committed
}

/*!
   \brief Find the text engine for a text format

   textEngine can be used to find out if a text format is supported.
pixhawk's avatar
pixhawk committed

   \param format Text format
   \return The text engine, or NULL if no engine is available.
*/
Bryant's avatar
Bryant committed
const QwtTextEngine *QwtText::textEngine( QwtText::TextFormat format )
pixhawk's avatar
pixhawk committed
{
Bryant's avatar
Bryant committed
    return  QwtTextEngineDict::dict().textEngine( format );
pixhawk's avatar
pixhawk committed
}