Index: trunk/BNC/qwt/qwt_thermo.cpp
===================================================================
--- trunk/BNC/qwt/qwt_thermo.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_thermo.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,8 +9,9 @@
 
 #include "qwt_thermo.h"
-#include "qwt_scale_engine.h"
 #include "qwt_scale_draw.h"
 #include "qwt_scale_map.h"
 #include "qwt_color_map.h"
+#include "qwt_math.h"
+
 #include <qpainter.h>
 #include <qevent.h>
@@ -18,8 +19,11 @@
 #include <qstyle.h>
 #include <qstyleoption.h>
-#include <qmath.h>
-
-static inline void qwtDrawLine( QPainter *painter, int pos,
-    const QColor &color, const QRect &pipeRect, const QRect &liquidRect,
+#include <qmargins.h>
+
+#include <algorithm>
+#include <functional>
+
+static inline void qwtDrawLine( QPainter* painter, int pos,
+    const QColor& color, const QRect& pipeRect, const QRect& liquidRect,
     Qt::Orientation orientation )
 {
@@ -37,7 +41,7 @@
 }
 
-QVector<double> qwtTickList( const QwtScaleDiv &scaleDiv )
-{
-    QVector<double> values;
+static QVector< double > qwtTickList( const QwtScaleDiv& scaleDiv )
+{
+    QVector< double > values;
 
     double lowerLimit = scaleDiv.interval().minValue();
@@ -52,5 +56,5 @@
         tickType < QwtScaleDiv::NTickTypes; tickType++ )
     {
-        const QList<double> ticks = scaleDiv.ticks( tickType );
+        const QList< double > ticks = scaleDiv.ticks( tickType );
 
         for ( int i = 0; i < ticks.count(); i++ )
@@ -69,18 +73,18 @@
 class QwtThermo::PrivateData
 {
-public:
-    PrivateData():
-        orientation( Qt::Vertical ),
-        scalePosition( QwtThermo::TrailingScale ),
-        spacing( 3 ),
-        borderWidth( 2 ),
-        pipeWidth( 10 ),
-        alarmLevel( 0.0 ),
-        alarmEnabled( false ),
-        autoFillPipe( true ),
-        originMode( QwtThermo::OriginMinimum ),
-        origin( 0.0 ),
-        colorMap( NULL ),
-        value( 0.0 )
+  public:
+    PrivateData()
+        : orientation( Qt::Vertical )
+        , scalePosition( QwtThermo::TrailingScale )
+        , spacing( 3 )
+        , borderWidth( 2 )
+        , pipeWidth( 10 )
+        , alarmLevel( 0.0 )
+        , alarmEnabled( false )
+        , autoFillPipe( true )
+        , originMode( QwtThermo::OriginMinimum )
+        , origin( 0.0 )
+        , colorMap( NULL )
+        , value( 0.0 )
     {
         rangeFlags = QwtInterval::IncludeBorders;
@@ -106,5 +110,5 @@
     double origin;
 
-    QwtColorMap *colorMap;
+    QwtColorMap* colorMap;
 
     double value;
@@ -112,14 +116,14 @@
 
 /*!
-  Constructor
-  \param parent Parent widget
-*/
-QwtThermo::QwtThermo( QWidget *parent ):
-    QwtAbstractScale( parent )
-{
-    d_data = new PrivateData;
+   Constructor
+   \param parent Parent widget
+ */
+QwtThermo::QwtThermo( QWidget* parent )
+    : QwtAbstractScale( parent )
+{
+    m_data = new PrivateData;
 
     QSizePolicy policy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
-    if ( d_data->orientation == Qt::Vertical )
+    if ( m_data->orientation == Qt::Vertical )
         policy.transpose();
 
@@ -133,27 +137,27 @@
 QwtThermo::~QwtThermo()
 {
-    delete d_data;
-}
-
-/*!
-  \brief Exclude/Include min/max values
-
-  According to the flags minValue() and maxValue()
-  are included/excluded from the pipe. In case of an
-  excluded value the corresponding tick is painted
-  1 pixel off of the pipeRect().
-
-  F.e. when a minimum
-  of 0.0 has to be displayed as an empty pipe the minValue()
-  needs to be excluded.
-
-  \param flags Range flags
-  \sa rangeFlags()
-*/
+    delete m_data;
+}
+
+/*!
+   \brief Exclude/Include min/max values
+
+   According to the flags minValue() and maxValue()
+   are included/excluded from the pipe. In case of an
+   excluded value the corresponding tick is painted
+   1 pixel off of the pipeRect().
+
+   F.e. when a minimum
+   of 0.0 has to be displayed as an empty pipe the minValue()
+   needs to be excluded.
+
+   \param flags Range flags
+   \sa rangeFlags()
+ */
 void QwtThermo::setRangeFlags( QwtInterval::BorderFlags flags )
 {
-    if ( d_data->rangeFlags != flags )
-    {
-        d_data->rangeFlags = flags;
+    if ( m_data->rangeFlags != flags )
+    {
+        m_data->rangeFlags = flags;
         update();
     }
@@ -161,23 +165,23 @@
 
 /*!
-  \return Range flags
-  \sa setRangeFlags()
-*/
+   \return Range flags
+   \sa setRangeFlags()
+ */
 QwtInterval::BorderFlags QwtThermo::rangeFlags() const
 {
-    return d_data->rangeFlags;
-}
-
-/*!
-  Set the current value.
-
-  \param value New Value
-  \sa value()
-*/
+    return m_data->rangeFlags;
+}
+
+/*!
+   Set the current value.
+
+   \param value New Value
+   \sa value()
+ */
 void QwtThermo::setValue( double value )
 {
-    if ( d_data->value != value )
-    {
-        d_data->value = value;
+    if ( m_data->value != value )
+    {
+        m_data->value = value;
         update();
     }
@@ -187,19 +191,19 @@
 double QwtThermo::value() const
 {
-    return d_data->value;
-}
-
-/*!
-  \brief Set a scale draw
-
-  For changing the labels of the scales, it
-  is necessary to derive from QwtScaleDraw and
-  overload QwtScaleDraw::label().
-
-  \param scaleDraw ScaleDraw object, that has to be created with
+    return m_data->value;
+}
+
+/*!
+   \brief Set a scale draw
+
+   For changing the labels of the scales, it
+   is necessary to derive from QwtScaleDraw and
+   overload QwtScaleDraw::label().
+
+   \param scaleDraw ScaleDraw object, that has to be created with
                    new and will be deleted in ~QwtThermo() or the next
                    call of setScaleDraw().
-*/
-void QwtThermo::setScaleDraw( QwtScaleDraw *scaleDraw )
+ */
+void QwtThermo::setScaleDraw( QwtScaleDraw* scaleDraw )
 {
     setAbstractScaleDraw( scaleDraw );
@@ -210,8 +214,8 @@
    \return the scale draw of the thermo
    \sa setScaleDraw()
-*/
-const QwtScaleDraw *QwtThermo::scaleDraw() const
-{
-    return static_cast<const QwtScaleDraw *>( abstractScaleDraw() );
+ */
+const QwtScaleDraw* QwtThermo::scaleDraw() const
+{
+    return static_cast< const QwtScaleDraw* >( abstractScaleDraw() );
 }
 
@@ -219,15 +223,15 @@
    \return the scale draw of the thermo
    \sa setScaleDraw()
-*/
-QwtScaleDraw *QwtThermo::scaleDraw()
-{
-    return static_cast<QwtScaleDraw *>( abstractScaleDraw() );
-}
-
-/*!
-  Paint event handler
-  \param event Paint event
-*/
-void QwtThermo::paintEvent( QPaintEvent *event )
+ */
+QwtScaleDraw* QwtThermo::scaleDraw()
+{
+    return static_cast< QwtScaleDraw* >( abstractScaleDraw() );
+}
+
+/*!
+   Paint event handler
+   \param event Paint event
+ */
+void QwtThermo::paintEvent( QPaintEvent* event )
 {
     QPainter painter( this );
@@ -235,5 +239,5 @@
 
     QStyleOption opt;
-    opt.init(this);
+    opt.initFrom(this);
     style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
 
@@ -242,9 +246,9 @@
     if ( !tRect.contains( event->rect() ) )
     {
-        if ( d_data->scalePosition != QwtThermo::NoScale )
+        if ( m_data->scalePosition != QwtThermo::NoScale )
             scaleDraw()->draw( &painter, palette() );
     }
 
-    const int bw = d_data->borderWidth;
+    const int bw = m_data->borderWidth;
 
     const QBrush brush = palette().brush( QPalette::Base );
@@ -252,5 +256,5 @@
         tRect.adjusted( -bw, -bw, bw, bw ),
         palette(), true, bw,
-        d_data->autoFillPipe ? &brush : NULL );
+        m_data->autoFillPipe ? &brush : NULL );
 
     drawLiquid( &painter, tRect );
@@ -258,8 +262,8 @@
 
 /*!
-  Resize event handler
-  \param event Resize event
-*/
-void QwtThermo::resizeEvent( QResizeEvent *event )
+   Resize event handler
+   \param event Resize event
+ */
+void QwtThermo::resizeEvent( QResizeEvent* event )
 {
     Q_UNUSED( event );
@@ -268,8 +272,8 @@
 
 /*!
-  Qt change event handler
-  \param event Event
-*/
-void QwtThermo::changeEvent( QEvent *event )
+   Qt change event handler
+   \param event Event
+ */
+void QwtThermo::changeEvent( QEvent* event )
 {
     switch( event->type() )
@@ -287,24 +291,24 @@
 
 /*!
-  Recalculate the QwtThermo geometry and layout based on
-  pipeRect() and the fonts.
-
-  \param update_geometry notify the layout system and call update
+   Recalculate the QwtThermo geometry and layout based on
+   pipeRect() and the fonts.
+
+   \param update_geometry notify the layout system and call update
          to redraw the scale
-*/
+ */
 void QwtThermo::layoutThermo( bool update_geometry )
 {
     const QRect tRect = pipeRect();
-    const int bw = d_data->borderWidth + d_data->spacing;
+    const int bw = m_data->borderWidth + m_data->spacing;
     const bool inverted = ( upperBound() < lowerBound() );
 
     int from, to;
 
-    if ( d_data->orientation == Qt::Horizontal )
+    if ( m_data->orientation == Qt::Horizontal )
     {
         from = tRect.left();
         to = tRect.right();
 
-        if ( d_data->rangeFlags & QwtInterval::ExcludeMinimum )
+        if ( m_data->rangeFlags & QwtInterval::ExcludeMinimum )
         {
             if ( inverted )
@@ -313,5 +317,5 @@
                 from--;
         }
-        if ( d_data->rangeFlags & QwtInterval::ExcludeMaximum )
+        if ( m_data->rangeFlags & QwtInterval::ExcludeMaximum )
         {
             if ( inverted )
@@ -321,5 +325,5 @@
         }
 
-        if ( d_data->scalePosition == QwtThermo::TrailingScale )
+        if ( m_data->scalePosition == QwtThermo::TrailingScale )
         {
             scaleDraw()->setAlignment( QwtScaleDraw::TopScale );
@@ -339,5 +343,5 @@
         to = tRect.bottom();
 
-        if ( d_data->rangeFlags & QwtInterval::ExcludeMinimum )
+        if ( m_data->rangeFlags & QwtInterval::ExcludeMinimum )
         {
             if ( inverted )
@@ -346,5 +350,5 @@
                 to++;
         }
-        if ( d_data->rangeFlags & QwtInterval::ExcludeMaximum )
+        if ( m_data->rangeFlags & QwtInterval::ExcludeMaximum )
         {
             if ( inverted )
@@ -354,5 +358,5 @@
         }
 
-        if ( d_data->scalePosition == QwtThermo::LeadingScale )
+        if ( m_data->scalePosition == QwtThermo::LeadingScale )
         {
             scaleDraw()->setAlignment( QwtScaleDraw::RightScale );
@@ -376,11 +380,11 @@
 
 /*!
-  \return Bounding rectangle of the pipe ( without borders )
+   \return Bounding rectangle of the pipe ( without borders )
           in widget coordinates
-*/
+ */
 QRect QwtThermo::pipeRect() const
 {
     int mbd = 0;
-    if ( d_data->scalePosition != QwtThermo::NoScale )
+    if ( m_data->scalePosition != QwtThermo::NoScale )
     {
         int d1, d2;
@@ -388,5 +392,5 @@
         mbd = qMax( d1, d2 );
     }
-    const int bw = d_data->borderWidth;
+    const int bw = m_data->borderWidth;
     const int scaleOff = bw + mbd;
 
@@ -394,14 +398,14 @@
 
     QRect pipeRect = cr;
-    if ( d_data->orientation == Qt::Horizontal )
+    if ( m_data->orientation == Qt::Horizontal )
     {
         pipeRect.adjust( scaleOff, 0, -scaleOff, 0 );
 
-        if ( d_data->scalePosition == QwtThermo::TrailingScale )
-            pipeRect.setTop( cr.top() + cr.height() - bw - d_data->pipeWidth );
+        if ( m_data->scalePosition == QwtThermo::TrailingScale )
+            pipeRect.setTop( cr.top() + cr.height() - bw - m_data->pipeWidth );
         else
             pipeRect.setTop( bw );
 
-        pipeRect.setHeight( d_data->pipeWidth );
+        pipeRect.setHeight( m_data->pipeWidth );
     }
     else // Qt::Vertical
@@ -409,10 +413,10 @@
         pipeRect.adjust( 0, scaleOff, 0, -scaleOff );
 
-        if ( d_data->scalePosition == QwtThermo::LeadingScale )
+        if ( m_data->scalePosition == QwtThermo::LeadingScale )
             pipeRect.setLeft( bw );
         else
-            pipeRect.setLeft( cr.left() + cr.width() - bw - d_data->pipeWidth );
-
-        pipeRect.setWidth( d_data->pipeWidth );
+            pipeRect.setLeft( cr.left() + cr.width() - bw - m_data->pipeWidth );
+
+        pipeRect.setWidth( m_data->pipeWidth );
     }
 
@@ -421,15 +425,15 @@
 
 /*!
-  \brief Set the orientation.
-  \param orientation Allowed values are Qt::Horizontal and Qt::Vertical.
-
-  \sa orientation(), scalePosition()
-*/
+   \brief Set the orientation.
+   \param orientation Allowed values are Qt::Horizontal and Qt::Vertical.
+
+   \sa orientation(), scalePosition()
+ */
 void QwtThermo::setOrientation( Qt::Orientation orientation )
 {
-    if ( orientation == d_data->orientation )
+    if ( orientation == m_data->orientation )
         return;
 
-    d_data->orientation = orientation;
+    m_data->orientation = orientation;
 
     if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
@@ -446,73 +450,73 @@
 
 /*!
-  \return Orientation
-  \sa setOrientation()
-*/
+   \return Orientation
+   \sa setOrientation()
+ */
 Qt::Orientation QwtThermo::orientation() const
 {
-    return d_data->orientation;
-}
-
-/*!
-  \brief Change how the origin is determined.
-  \sa originMode(), serOrigin(), origin()
+    return m_data->orientation;
+}
+
+/*!
+   \brief Change how the origin is determined.
+   \sa originMode(), serOrigin(), origin()
  */
 void QwtThermo::setOriginMode( OriginMode m )
 {
-    if ( m == d_data->originMode )
+    if ( m == m_data->originMode )
         return;
 
-    d_data->originMode = m;
+    m_data->originMode = m;
     update();
 }
 
 /*!
-  \return Mode, how the origin is determined.
-  \sa setOriginMode(), serOrigin(), origin()
+   \return Mode, how the origin is determined.
+   \sa setOriginMode(), serOrigin(), origin()
  */
 QwtThermo::OriginMode QwtThermo::originMode() const
 {
-    return d_data->originMode;
-}
-
-/*!
-  \brief Specifies the custom origin.
-
-  If originMode is set to OriginCustom this property controls where the
-  liquid starts.
-
-  \param origin New origin level
-  \sa setOriginMode(), originMode(), origin()
+    return m_data->originMode;
+}
+
+/*!
+   \brief Specifies the custom origin.
+
+   If originMode is set to OriginCustom this property controls where the
+   liquid starts.
+
+   \param origin New origin level
+   \sa setOriginMode(), originMode(), origin()
  */
 void QwtThermo::setOrigin( double origin )
 {
-    if ( origin == d_data->origin )
+    if ( origin == m_data->origin )
         return;
 
-    d_data->origin = origin;
+    m_data->origin = origin;
     update();
 }
 
 /*!
-  \return Origin of the thermo, when OriginCustom is enabled
-  \sa setOrigin(), setOriginMode(), originMode()
+   \return Origin of the thermo, when OriginCustom is enabled
+   \sa setOrigin(), setOriginMode(), originMode()
  */
 double QwtThermo::origin() const
 {
-    return d_data->origin;
-}
-
-/*!
-  \brief Change the position of the scale
-  \param scalePosition Position of the scale.
-
-  \sa ScalePosition, scalePosition()
-*/
+    return m_data->origin;
+}
+
+/*!
+   \brief Change the position of the scale
+   \param scalePosition Position of the scale.
+
+   \sa ScalePosition, scalePosition()
+ */
 void QwtThermo::setScalePosition( ScalePosition scalePosition )
 {
-    if ( d_data->scalePosition == scalePosition )
+    if ( m_data->scalePosition == scalePosition )
         return;
 
-    d_data->scalePosition = scalePosition;
+    m_data->scalePosition = scalePosition;
 
     if ( testAttribute( Qt::WA_WState_Polished ) )
@@ -523,8 +527,8 @@
    \return Scale position.
    \sa setScalePosition()
-*/
+ */
 QwtThermo::ScalePosition QwtThermo::scalePosition() const
 {
-    return d_data->scalePosition;
+    return m_data->scalePosition;
 }
 
@@ -539,7 +543,7 @@
    \param painter Painter
    \param pipeRect Bounding rectangle of the pipe without borders
-*/
+ */
 void QwtThermo::drawLiquid(
-    QPainter *painter, const QRect &pipeRect ) const
+    QPainter* painter, const QRect& pipeRect ) const
 {
     painter->save();
@@ -551,5 +555,5 @@
     QRect liquidRect = fillRect( pipeRect );
 
-    if ( d_data->colorMap != NULL )
+    if ( m_data->colorMap != NULL )
     {
         const QwtInterval interval = scaleDiv().interval().normalized();
@@ -558,10 +562,10 @@
         // we calculate the colors for the rounded tick values
 
-        QVector<double> values = qwtTickList( scaleDraw()->scaleDiv() );
+        QVector< double > values = qwtTickList( scaleDraw()->scaleDiv() );
 
         if ( scaleMap.isInverting() )
-            qSort( values.begin(), values.end(), qGreater<double>() );
+            std::sort( values.begin(), values.end(), std::greater< double >() );
         else
-            qSort( values.begin(), values.end(), qLess<double>() );
+            std::sort( values.begin(), values.end(), std::less< double >() );
 
         int from;
@@ -570,6 +574,6 @@
             from = qRound( scaleMap.transform( values[0] ) );
             qwtDrawLine( painter, from,
-                d_data->colorMap->color( interval, values[0] ),
-                pipeRect, liquidRect, d_data->orientation );
+                m_data->colorMap->color( interval, values[0] ),
+                pipeRect, liquidRect, m_data->orientation );
         }
 
@@ -583,11 +587,11 @@
 
                 qwtDrawLine( painter, pos,
-                    d_data->colorMap->color( interval, v ),
-                    pipeRect, liquidRect, d_data->orientation );
+                    m_data->colorMap->color( interval, v ),
+                    pipeRect, liquidRect, m_data->orientation );
             }
 
             qwtDrawLine( painter, to,
-                d_data->colorMap->color( interval, values[i] ),
-                pipeRect, liquidRect, d_data->orientation );
+                m_data->colorMap->color( interval, values[i] ),
+                pipeRect, liquidRect, m_data->orientation );
 
             from = to;
@@ -596,5 +600,5 @@
     else
     {
-        if ( !liquidRect.isEmpty() && d_data->alarmEnabled )
+        if ( !liquidRect.isEmpty() && m_data->alarmEnabled )
         {
             const QRect r = alarmRect( liquidRect );
@@ -613,14 +617,14 @@
 
 /*!
-  \brief Change the spacing between pipe and scale
-
-  A spacing of 0 means, that the backbone of the scale is below
-  the pipe.
-
-  The default setting is 3 pixels.
-
-  \param spacing Number of pixels
-  \sa spacing();
-*/
+   \brief Change the spacing between pipe and scale
+
+   A spacing of 0 means, that the backbone of the scale is below
+   the pipe.
+
+   The default setting is 3 pixels.
+
+   \param spacing Number of pixels
+   \sa spacing();
+ */
 void QwtThermo::setSpacing( int spacing )
 {
@@ -628,7 +632,7 @@
         spacing = 0;
 
-    if ( spacing != d_data->spacing  )
-    {
-        d_data->spacing = spacing;
+    if ( spacing != m_data->spacing  )
+    {
+        m_data->spacing = spacing;
         layoutThermo( true );
     }
@@ -636,10 +640,10 @@
 
 /*!
-  \return Number of pixels between pipe and scale
-  \sa setSpacing()
-*/
+   \return Number of pixels between pipe and scale
+   \sa setSpacing()
+ */
 int QwtThermo::spacing() const
 {
-    return d_data->spacing;
+    return m_data->spacing;
 }
 
@@ -648,5 +652,5 @@
    \param width Border width
    \sa borderWidth()
-*/
+ */
 void QwtThermo::setBorderWidth( int width )
 {
@@ -654,7 +658,7 @@
         width = 0;
 
-    if ( width != d_data->borderWidth  )
-    {
-        d_data->borderWidth = width;
+    if ( width != m_data->borderWidth  )
+    {
+        m_data->borderWidth = width;
         layoutThermo( true );
     }
@@ -664,54 +668,54 @@
    \return Border width of the thermometer pipe.
    \sa setBorderWidth()
-*/
+ */
 int QwtThermo::borderWidth() const
 {
-    return d_data->borderWidth;
-}
-
-/*!
-  \brief Assign a color map for the fill color
-
-  \param colorMap Color map
-  \warning The alarm threshold has no effect, when
+    return m_data->borderWidth;
+}
+
+/*!
+   \brief Assign a color map for the fill color
+
+   \param colorMap Color map
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
-void QwtThermo::setColorMap( QwtColorMap *colorMap )
-{
-    if ( colorMap != d_data->colorMap )
-    {
-        delete d_data->colorMap;
-        d_data->colorMap = colorMap;
-    }
-}
-
-/*!
-  \return Color map for the fill color
-  \warning The alarm threshold has no effect, when
+ */
+void QwtThermo::setColorMap( QwtColorMap* colorMap )
+{
+    if ( colorMap != m_data->colorMap )
+    {
+        delete m_data->colorMap;
+        m_data->colorMap = colorMap;
+    }
+}
+
+/*!
+   \return Color map for the fill color
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
-QwtColorMap *QwtThermo::colorMap()
-{
-    return d_data->colorMap;
-}
-
-/*!
-  \return Color map for the fill color
-  \warning The alarm threshold has no effect, when
+ */
+QwtColorMap* QwtThermo::colorMap()
+{
+    return m_data->colorMap;
+}
+
+/*!
+   \return Color map for the fill color
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
-const QwtColorMap *QwtThermo::colorMap() const
-{
-    return d_data->colorMap;
-}
-
-/*!
-  \brief Change the brush of the liquid.
-
-  Changes the QPalette::ButtonText brush of the palette.
-
-  \param brush New brush.
-  \sa fillBrush(), QWidget::setPalette()
-*/
+ */
+const QwtColorMap* QwtThermo::colorMap() const
+{
+    return m_data->colorMap;
+}
+
+/*!
+   \brief Change the brush of the liquid.
+
+   Changes the QPalette::ButtonText brush of the palette.
+
+   \param brush New brush.
+   \sa fillBrush(), QWidget::setPalette()
+ */
 void QwtThermo::setFillBrush( const QBrush& brush )
 {
@@ -722,7 +726,7 @@
 
 /*!
-  \return Liquid ( QPalette::ButtonText ) brush.
-  \sa setFillBrush(), QWidget::palette()
-*/
+   \return Liquid ( QPalette::ButtonText ) brush.
+   \sa setFillBrush(), QWidget::palette()
+ */
 QBrush QwtThermo::fillBrush() const
 {
@@ -731,14 +735,14 @@
 
 /*!
-  \brief Specify the liquid brush above the alarm threshold
-
-  Changes the QPalette::Highlight brush of the palette.
-
-  \param brush New brush.
-  \sa alarmBrush(), QWidget::setPalette()
-
-  \warning The alarm threshold has no effect, when
+   \brief Specify the liquid brush above the alarm threshold
+
+   Changes the QPalette::Highlight brush of the palette.
+
+   \param brush New brush.
+   \sa alarmBrush(), QWidget::setPalette()
+
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
+ */
 void QwtThermo::setAlarmBrush( const QBrush& brush )
 {
@@ -749,10 +753,10 @@
 
 /*!
-  \return Liquid brush ( QPalette::Highlight ) above the alarm threshold.
-  \sa setAlarmBrush(), QWidget::palette()
-
-  \warning The alarm threshold has no effect, when
+   \return Liquid brush ( QPalette::Highlight ) above the alarm threshold.
+   \sa setAlarmBrush(), QWidget::palette()
+
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
+ */
 QBrush QwtThermo::alarmBrush() const
 {
@@ -761,42 +765,42 @@
 
 /*!
-  Specify the alarm threshold.
-
-  \param level Alarm threshold
-  \sa alarmLevel()
-
-  \warning The alarm threshold has no effect, when
+   Specify the alarm threshold.
+
+   \param level Alarm threshold
+   \sa alarmLevel()
+
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
+ */
 void QwtThermo::setAlarmLevel( double level )
 {
-    d_data->alarmLevel = level;
-    d_data->alarmEnabled = 1;
+    m_data->alarmLevel = level;
+    m_data->alarmEnabled = 1;
     update();
 }
 
 /*!
-  \return Alarm threshold.
-  \sa setAlarmLevel()
-
-  \warning The alarm threshold has no effect, when
+   \return Alarm threshold.
+   \sa setAlarmLevel()
+
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
+ */
 double QwtThermo::alarmLevel() const
 {
-    return d_data->alarmLevel;
-}
-
-/*!
-  Change the width of the pipe.
-
-  \param width Width of the pipe
-  \sa pipeWidth()
-*/
+    return m_data->alarmLevel;
+}
+
+/*!
+   Change the width of the pipe.
+
+   \param width Width of the pipe
+   \sa pipeWidth()
+ */
 void QwtThermo::setPipeWidth( int width )
 {
     if ( width > 0 )
     {
-        d_data->pipeWidth = width;
+        m_data->pipeWidth = width;
         layoutThermo( true );
     }
@@ -804,40 +808,40 @@
 
 /*!
-  \return Width of the pipe.
-  \sa setPipeWidth()
-*/
+   \return Width of the pipe.
+   \sa setPipeWidth()
+ */
 int QwtThermo::pipeWidth() const
 {
-    return d_data->pipeWidth;
-}
-
-/*!
-  \brief Enable or disable the alarm threshold
-  \param on true (disabled) or false (enabled)
-
-  \warning The alarm threshold has no effect, when
+    return m_data->pipeWidth;
+}
+
+/*!
+   \brief Enable or disable the alarm threshold
+   \param on true (disabled) or false (enabled)
+
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
+ */
 void QwtThermo::setAlarmEnabled( bool on )
 {
-    d_data->alarmEnabled = on;
+    m_data->alarmEnabled = on;
     update();
 }
 
 /*!
-  \return True, when the alarm threshold is enabled.
-
-  \warning The alarm threshold has no effect, when
+   \return True, when the alarm threshold is enabled.
+
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
+ */
 bool QwtThermo::alarmEnabled() const
 {
-    return d_data->alarmEnabled;
-}
-
-/*!
-  \return the minimum size hint
-  \sa minimumSizeHint()
-*/
+    return m_data->alarmEnabled;
+}
+
+/*!
+   \return the minimum size hint
+   \sa minimumSizeHint()
+ */
 QSize QwtThermo::sizeHint() const
 {
@@ -846,19 +850,19 @@
 
 /*!
-  \return Minimum size hint
-  \warning The return value depends on the font and the scale.
-  \sa sizeHint()
-*/
+   \return Minimum size hint
+   \warning The return value depends on the font and the scale.
+   \sa sizeHint()
+ */
 QSize QwtThermo::minimumSizeHint() const
 {
     int w = 0, h = 0;
 
-    if ( d_data->scalePosition != NoScale )
-    {
-        const int sdExtent = qCeil( scaleDraw()->extent( font() ) );
+    if ( m_data->scalePosition != NoScale )
+    {
+        const int sdExtent = qwtCeil( scaleDraw()->extent( font() ) );
         const int sdLength = scaleDraw()->minLength( font() );
 
         w = sdLength;
-        h = d_data->pipeWidth + sdExtent + d_data->spacing;
+        h = m_data->pipeWidth + sdExtent + m_data->spacing;
 
     }
@@ -866,18 +870,17 @@
     {
         w = 200;
-        h = d_data->pipeWidth;
-    }
-
-    if ( d_data->orientation == Qt::Vertical )
+        h = m_data->pipeWidth;
+    }
+
+    if ( m_data->orientation == Qt::Vertical )
         qSwap( w, h );
 
-    w += 2 * d_data->borderWidth;
-    h += 2 * d_data->borderWidth;
+    w += 2 * m_data->borderWidth;
+    h += 2 * m_data->borderWidth;
 
     // finally add the margins
-    int left, right, top, bottom;
-    getContentsMargins( &left, &top, &right, &bottom );
-    w += left + right;
-    h += top + bottom;
+    const QMargins m = contentsMargins();
+    w += m.left() + m.right();
+    h += m.top() + m.bottom();
 
     return QSize( w, h );
@@ -885,19 +888,19 @@
 
 /*!
-  \brief Calculate the filled rectangle of the pipe
-
-  \param pipeRect Rectangle of the pipe
-  \return Rectangle to be filled ( fill and alarm brush )
-
-  \sa pipeRect(), alarmRect()
- */
-QRect QwtThermo::fillRect( const QRect &pipeRect ) const
+   \brief Calculate the filled rectangle of the pipe
+
+   \param pipeRect Rectangle of the pipe
+   \return Rectangle to be filled ( fill and alarm brush )
+
+   \sa pipeRect(), alarmRect()
+ */
+QRect QwtThermo::fillRect( const QRect& pipeRect ) const
 {
     double origin;
-    if ( d_data->originMode == OriginMinimum )
+    if ( m_data->originMode == OriginMinimum )
     {
         origin = qMin( lowerBound(), upperBound() );
     }
-    else if ( d_data->originMode == OriginMaximum )
+    else if ( m_data->originMode == OriginMaximum )
     {
         origin = qMax( lowerBound(), upperBound() );
@@ -905,10 +908,10 @@
     else // OriginCustom
     {
-        origin = d_data->origin;
+        origin = m_data->origin;
     }
 
     const QwtScaleMap scaleMap = scaleDraw()->scaleMap();
 
-    int from = qRound( scaleMap.transform( d_data->value ) );
+    int from = qRound( scaleMap.transform( m_data->value ) );
     int to = qRound( scaleMap.transform( origin ) );
 
@@ -917,5 +920,5 @@
 
     QRect fillRect = pipeRect;
-    if ( d_data->orientation == Qt::Horizontal )
+    if ( m_data->orientation == Qt::Horizontal )
     {
         fillRect.setLeft( from );
@@ -932,16 +935,16 @@
 
 /*!
-  \brief Calculate the alarm rectangle of the pipe
-
-  \param fillRect Filled rectangle in the pipe
-  \return Rectangle to be filled with the alarm brush
-
-  \sa pipeRect(), fillRect(), alarmLevel(), alarmBrush()
- */
-QRect QwtThermo::alarmRect( const QRect &fillRect ) const
+   \brief Calculate the alarm rectangle of the pipe
+
+   \param fillRect Filled rectangle in the pipe
+   \return Rectangle to be filled with the alarm brush
+
+   \sa pipeRect(), fillRect(), alarmLevel(), alarmBrush()
+ */
+QRect QwtThermo::alarmRect( const QRect& fillRect ) const
 {
     QRect alarmRect( 0, 0, -1, -1); // something invalid
 
-    if ( !d_data->alarmEnabled )
+    if ( !m_data->alarmEnabled )
         return alarmRect;
 
@@ -949,18 +952,18 @@
 
     bool increasing;
-    if ( d_data->originMode == OriginCustom )
-    {
-        increasing = d_data->value > d_data->origin;
+    if ( m_data->originMode == OriginCustom )
+    {
+        increasing = m_data->value > m_data->origin;
     }
     else
     {
-        increasing = d_data->originMode == OriginMinimum;
+        increasing = m_data->originMode == OriginMinimum;
     }
 
     const QwtScaleMap map = scaleDraw()->scaleMap();
-    const int alarmPos = qRound( map.transform( d_data->alarmLevel ) );
-    const int valuePos = qRound( map.transform( d_data->value ) );
-
-    if ( d_data->orientation == Qt::Horizontal )
+    const int alarmPos = qRound( map.transform( m_data->alarmLevel ) );
+    const int valuePos = qRound( map.transform( m_data->value ) );
+
+    if ( m_data->orientation == Qt::Horizontal )
     {
         int v1, v2;
@@ -1004,2 +1007,4 @@
     return alarmRect;
 }
+
+#include "moc_qwt_thermo.cpp"
