virtual QwtText label(double value) const
 {
     QwtText lbl;
     const int index = qRound(value);
     if ((value == (double)index) && index >= 0 && index < m_labels.size())
     {
         lbl = QwtText(m_labels[index], QwtText::TeXText);
         lbl.setLayoutAttribute(QwtText::MinimumLayout);
     }
     return lbl;
 }
/*!
   \brief Convert a value into its representing label and cache it.

   The conversion between value and label is called very often
   in the layout and painting code. Unfortunately the
   calculation of the label sizes might be slow (really slow
   for rich text in Qt4), so it's necessary to cache the labels.

   \param font Font
   \param value Value

   \return Tick label
*/
const QwtText &QwtAbstractScaleDraw::tickLabel(
    const QFont &font, double value ) const
{
    QMap<double, QwtText>::const_iterator it1 = d_data->labelCache.constFind( value );
    if ( it1 != d_data->labelCache.constEnd() )
        return *it1;

    QwtText lbl = label( value );
    lbl.setRenderFlags( 0 );
    lbl.setLayoutAttribute( QwtText::MinimumLayout );

    ( void )lbl.textSize( font ); // initialize the internal cache

    QMap<double, QwtText>::iterator it2 = d_data->labelCache.insert( value, lbl );
    return *it2;
}