Index: trunk/BNC/qwt/qwt_dial.cpp
===================================================================
--- trunk/BNC/qwt/qwt_dial.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_dial.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,17 +11,15 @@
 #include "qwt_dial_needle.h"
 #include "qwt_math.h"
-#include "qwt_scale_engine.h"
 #include "qwt_scale_map.h"
 #include "qwt_round_scale_draw.h"
 #include "qwt_painter.h"
+#include "qwt.h"
+
 #include <qpainter.h>
 #include <qpalette.h>
 #include <qpixmap.h>
 #include <qevent.h>
-#include <qalgorithms.h>
-#include <qmath.h>
 #include <qstyle.h>
 #include <qstyleoption.h>
-#include <qapplication.h>
 
 static inline double qwtAngleDist( double a1, double a2 )
@@ -77,15 +75,15 @@
 class QwtDial::PrivateData
 {
-public:
-    PrivateData():
-        frameShadow( Sunken ),
-        lineWidth( 0 ),
-        mode( RotateNeedle ),
-        origin( 90.0 ),
-        minScaleArc( 0.0 ),
-        maxScaleArc( 0.0 ),
-        needle( NULL ),
-        arcOffset( 0.0 ),
-        mouseOffset( 0.0 )
+  public:
+    PrivateData()
+        : frameShadow( Sunken )
+        , lineWidth( 0 )
+        , mode( RotateNeedle )
+        , origin( 90.0 )
+        , minScaleArc( 0.0 )
+        , maxScaleArc( 0.0 )
+        , needle( NULL )
+        , arcOffset( 0.0 )
+        , mouseOffset( 0.0 )
     {
     }
@@ -104,5 +102,5 @@
     double maxScaleArc;
 
-    QwtDialNeedle *needle;
+    QwtDialNeedle* needle;
 
     double arcOffset;
@@ -113,19 +111,19 @@
 
 /*!
-  \brief Constructor
-  \param parent Parent widget
-
-  Create a dial widget with no needle. The scale is initialized
-  to [ 0.0, 360.0 ] and 360 steps ( QwtAbstractSlider::setTotalSteps() ).
-  The origin of the scale is at 90°,
-
-  The value is set to 0.0.
-
-  The default mode is QwtDial::RotateNeedle.
-*/
-QwtDial::QwtDial( QWidget* parent ):
-    QwtAbstractSlider( parent )
-{
-    d_data = new PrivateData;
+   \brief Constructor
+   \param parent Parent widget
+
+   Create a dial widget with no needle. The scale is initialized
+   to [ 0.0, 360.0 ] and 360 steps ( QwtAbstractSlider::setTotalSteps() ).
+   The origin of the scale is at 90°,
+
+   The value is set to 0.0.
+
+   The default mode is QwtDial::RotateNeedle.
+ */
+QwtDial::QwtDial( QWidget* parent )
+    : QwtAbstractSlider( parent )
+{
+    m_data = new PrivateData;
 
     setFocusPolicy( Qt::TabFocus );
@@ -135,5 +133,5 @@
     {
         const QPalette::ColorGroup colorGroup =
-            static_cast<QPalette::ColorGroup>( i );
+            static_cast< QPalette::ColorGroup >( i );
 
         // Base: background color of the circle inside the frame.
@@ -161,20 +159,20 @@
 QwtDial::~QwtDial()
 {
-    delete d_data;
-}
-
-/*!
-  Sets the frame shadow value from the frame style.
-
-  \param shadow Frame shadow
-  \sa setLineWidth(), QFrame::setFrameShadow()
-*/
+    delete m_data;
+}
+
+/*!
+   Sets the frame shadow value from the frame style.
+
+   \param shadow Frame shadow
+   \sa setLineWidth(), QFrame::setFrameShadow()
+ */
 void QwtDial::setFrameShadow( Shadow shadow )
 {
-    if ( shadow != d_data->frameShadow )
+    if ( shadow != m_data->frameShadow )
     {
         invalidateCache();
 
-        d_data->frameShadow = shadow;
+        m_data->frameShadow = shadow;
         if ( lineWidth() > 0 )
             update();
@@ -183,18 +181,18 @@
 
 /*!
-  \return Frame shadow
-  /sa setFrameShadow(), lineWidth(), QFrame::frameShadow()
-*/
+   \return Frame shadow
+   /sa setFrameShadow(), lineWidth(), QFrame::frameShadow()
+ */
 QwtDial::Shadow QwtDial::frameShadow() const
 {
-    return d_data->frameShadow;
-}
-
-/*!
-  Sets the line width of the frame
-
-  \param lineWidth Line width
-  \sa setFrameShadow()
-*/
+    return m_data->frameShadow;
+}
+
+/*!
+   Sets the line width of the frame
+
+   \param lineWidth Line width
+   \sa setFrameShadow()
+ */
 void QwtDial::setLineWidth( int lineWidth )
 {
@@ -202,9 +200,9 @@
         lineWidth = 0;
 
-    if ( d_data->lineWidth != lineWidth )
+    if ( m_data->lineWidth != lineWidth )
     {
         invalidateCache();
 
-        d_data->lineWidth = lineWidth;
+        m_data->lineWidth = lineWidth;
         update();
     }
@@ -212,16 +210,16 @@
 
 /*!
-  \return Line width of the frame
-  \sa setLineWidth(), frameShadow(), lineWidth()
-*/
+   \return Line width of the frame
+   \sa setLineWidth(), frameShadow(), lineWidth()
+ */
 int QwtDial::lineWidth() const
 {
-    return d_data->lineWidth;
-}
-
-/*!
-  \return bounding rectangle of the circle inside the frame
-  \sa setLineWidth(), scaleInnerRect(), boundingRect()
-*/
+    return m_data->lineWidth;
+}
+
+/*!
+   \return bounding rectangle of the circle inside the frame
+   \sa setLineWidth(), scaleInnerRect(), boundingRect()
+ */
 QRect QwtDial::innerRect() const
 {
@@ -231,7 +229,7 @@
 
 /*!
-  \return bounding rectangle of the dial including the frame
-  \sa setLineWidth(), scaleInnerRect(), innerRect()
-*/
+   \return bounding rectangle of the dial including the frame
+   \sa setLineWidth(), scaleInnerRect(), innerRect()
+ */
 QRect QwtDial::boundingRect() const
 {
@@ -247,15 +245,15 @@
 
 /*!
-  \return rectangle inside the scale
-  \sa setLineWidth(), boundingRect(), innerRect()
-*/
+   \return rectangle inside the scale
+   \sa setLineWidth(), boundingRect(), innerRect()
+ */
 QRect QwtDial::scaleInnerRect() const
 {
     QRect rect = innerRect();
 
-    const QwtAbstractScaleDraw *sd = scaleDraw();
+    const QwtAbstractScaleDraw* sd = scaleDraw();
     if ( sd )
     {
-        int scaleDist = qCeil( sd->extent( font() ) );
+        int scaleDist = qwtCeil( sd->extent( font() ) );
         scaleDist++; // margin
 
@@ -267,22 +265,22 @@
 
 /*!
-  \brief Change the mode of the dial.
-  \param mode New mode
-
-  In case of QwtDial::RotateNeedle the needle is rotating, in case of
-  QwtDial::RotateScale, the needle points to origin()
-  and the scale is rotating.
-
-  The default mode is QwtDial::RotateNeedle.
-
-  \sa mode(), setValue(), setOrigin()
-*/
+   \brief Change the mode of the dial.
+   \param mode New mode
+
+   In case of QwtDial::RotateNeedle the needle is rotating, in case of
+   QwtDial::RotateScale, the needle points to origin()
+   and the scale is rotating.
+
+   The default mode is QwtDial::RotateNeedle.
+
+   \sa mode(), setValue(), setOrigin()
+ */
 void QwtDial::setMode( Mode mode )
 {
-    if ( mode != d_data->mode )
+    if ( mode != m_data->mode )
     {
         invalidateCache();
 
-        d_data->mode = mode;
+        m_data->mode = mode;
         sliderChange();
     }
@@ -290,18 +288,18 @@
 
 /*!
-  \return Mode of the dial.
-  \sa setMode(), origin(), setScaleArc(), value()
-*/
+   \return Mode of the dial.
+   \sa setMode(), origin(), setScaleArc(), value()
+ */
 QwtDial::Mode QwtDial::mode() const
 {
-    return d_data->mode;
-}
-
-/*!
-  Invalidate the internal caches used to speed up repainting
+    return m_data->mode;
+}
+
+/*!
+   Invalidate the internal caches used to speed up repainting
  */
 void QwtDial::invalidateCache()
 {
-    d_data->pixmapCache = QPixmap();
+    m_data->pixmapCache = QPixmap();
 }
 
@@ -309,6 +307,6 @@
    Paint the dial
    \param event Paint event
-*/
-void QwtDial::paintEvent( QPaintEvent *event )
+ */
+void QwtDial::paintEvent( QPaintEvent* event )
 {
     QPainter painter( this );
@@ -316,8 +314,8 @@
 
     QStyleOption opt;
-    opt.init(this);
+    opt.initFrom(this);
     style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
 
-    if ( d_data->mode == QwtDial::RotateScale )
+    if ( m_data->mode == QwtDial::RotateScale )
     {
         painter.save();
@@ -330,14 +328,14 @@
 
     const QRect r = contentsRect();
-    if ( r.size() != d_data->pixmapCache.size() )
-    {
-        d_data->pixmapCache = QwtPainter::backingStore( this, r.size() );
-        d_data->pixmapCache.fill( Qt::transparent );
-
-        QPainter p( &d_data->pixmapCache );
+    if ( r.size() != m_data->pixmapCache.size() )
+    {
+        m_data->pixmapCache = QwtPainter::backingStore( this, r.size() );
+        m_data->pixmapCache.fill( Qt::transparent );
+
+        QPainter p( &m_data->pixmapCache );
         p.setRenderHint( QPainter::Antialiasing, true );
         p.translate( -r.topLeft() );
 
-        if ( d_data->mode != QwtDial::RotateScale )
+        if ( m_data->mode != QwtDial::RotateScale )
             drawContents( &p );
 
@@ -345,11 +343,11 @@
             drawFrame( &p );
 
-        if ( d_data->mode != QwtDial::RotateNeedle )
+        if ( m_data->mode != QwtDial::RotateNeedle )
             drawNeedle( &p );
     }
 
-    painter.drawPixmap( r.topLeft(), d_data->pixmapCache );
-
-    if ( d_data->mode == QwtDial::RotateNeedle )
+    painter.drawPixmap( r.topLeft(), m_data->pixmapCache );
+
+    if ( m_data->mode == QwtDial::RotateNeedle )
         drawNeedle( &painter );
 
@@ -359,8 +357,8 @@
 
 /*!
-  Draw the focus indicator
-  \param painter Painter
-*/
-void QwtDial::drawFocusIndicator( QPainter *painter ) const
+   Draw the focus indicator
+   \param painter Painter
+ */
+void QwtDial::drawFocusIndicator( QPainter* painter ) const
 {
     QwtPainter::drawFocusRect( painter, this, boundingRect() );
@@ -368,32 +366,32 @@
 
 /*!
-  Draw the frame around the dial
-
-  \param painter Painter
-  \sa lineWidth(), frameShadow()
-*/
-void QwtDial::drawFrame( QPainter *painter )
+   Draw the frame around the dial
+
+   \param painter Painter
+   \sa lineWidth(), frameShadow()
+ */
+void QwtDial::drawFrame( QPainter* painter )
 {
     QwtPainter::drawRoundFrame( painter, boundingRect(),
-        palette(), lineWidth(), d_data->frameShadow );
-}
-
-/*!
-  \brief Draw the contents inside the frame
-
-  QPalette::Window is the background color outside of the frame.
-  QPalette::Base is the background color inside the frame.
-  QPalette::WindowText is the background color inside the scale.
-
-  \param painter Painter
-
-  \sa boundingRect(), innerRect(),
+        palette(), lineWidth(), m_data->frameShadow );
+}
+
+/*!
+   \brief Draw the contents inside the frame
+
+   QPalette::Window is the background color outside of the frame.
+   QPalette::Base is the background color inside the frame.
+   QPalette::WindowText is the background color inside the scale.
+
+   \param painter Painter
+
+   \sa boundingRect(), innerRect(),
     scaleInnerRect(), QWidget::setPalette()
-*/
-void QwtDial::drawContents( QPainter *painter ) const
+ */
+void QwtDial::drawContents( QPainter* painter ) const
 {
     if ( testAttribute( Qt::WA_NoSystemBackground ) ||
         palette().brush( QPalette::Base ) !=
-            palette().brush( QPalette::Window ) )
+        palette().brush( QPalette::Window ) )
     {
         const QRectF br = boundingRect();
@@ -408,5 +406,5 @@
     const QRectF insideScaleRect = scaleInnerRect();
     if ( palette().brush( QPalette::WindowText ) !=
-            palette().brush( QPalette::Base ) )
+        palette().brush( QPalette::Base ) )
     {
         painter->save();
@@ -430,23 +428,23 @@
 
 /*!
-  Draw the needle
-
-  \param painter Painter
-  \param center Center of the dial
-  \param radius Length for the needle
-  \param direction Direction of the needle in degrees, counter clockwise
-  \param colorGroup ColorGroup
-*/
-void QwtDial::drawNeedle( QPainter *painter, const QPointF &center,
+   Draw the needle
+
+   \param painter Painter
+   \param center Center of the dial
+   \param radius Length for the needle
+   \param direction Direction of the needle in degrees, counter clockwise
+   \param colorGroup ColorGroup
+ */
+void QwtDial::drawNeedle( QPainter* painter, const QPointF& center,
     double radius, double direction, QPalette::ColorGroup colorGroup ) const
 {
-    if ( d_data->needle )
+    if ( m_data->needle )
     {
         direction = 360.0 - direction; // counter clockwise
-        d_data->needle->draw( painter, center, radius, direction, colorGroup );
-    }
-}
-
-void QwtDial::drawNeedle( QPainter *painter ) const
+        m_data->needle->draw( painter, center, radius, direction, colorGroup );
+    }
+}
+
+void QwtDial::drawNeedle( QPainter* painter ) const
 {
     if ( !isValid() )
@@ -469,14 +467,14 @@
 
 /*!
-  Draw the scale
-
-  \param painter Painter
-  \param center Center of the dial
-  \param radius Radius of the scale
-*/
-void QwtDial::drawScale( QPainter *painter,
-    const QPointF &center, double radius ) const
-{
-    QwtRoundScaleDraw *sd = const_cast<QwtRoundScaleDraw *>( scaleDraw() );
+   Draw the scale
+
+   \param painter Painter
+   \param center Center of the dial
+   \param radius Radius of the scale
+ */
+void QwtDial::drawScale( QPainter* painter,
+    const QPointF& center, double radius ) const
+{
+    QwtRoundScaleDraw* sd = const_cast< QwtRoundScaleDraw* >( scaleDraw() );
     if ( sd == NULL )
         return;
@@ -491,5 +489,5 @@
 
     painter->setFont( font() );
-    painter->setPen( QPen( textColor, sd->penWidth() ) );
+    painter->setPen( QPen( textColor, sd->penWidthF() ) );
 
     painter->setBrush( Qt::red );
@@ -498,14 +496,14 @@
 
 /*!
-  Draw the contents inside the scale
-
-  Paints nothing.
-
-  \param painter Painter
-  \param center Center of the contents circle
-  \param radius Radius of the contents circle
-*/
-void QwtDial::drawScaleContents( QPainter *painter,
-    const QPointF &center, double radius ) const
+   Draw the contents inside the scale
+
+   Paints nothing.
+
+   \param painter Painter
+   \param center Center of the contents circle
+   \param radius Radius of the contents circle
+ */
+void QwtDial::drawScaleContents( QPainter* painter,
+    const QPointF& center, double radius ) const
 {
     Q_UNUSED(painter);
@@ -515,19 +513,19 @@
 
 /*!
-  Set a needle for the dial
-
-  \param needle Needle
-
-  \warning The needle will be deleted, when a different needle is
+   Set a needle for the dial
+
+   \param needle Needle
+
+   \warning The needle will be deleted, when a different needle is
            set or in ~QwtDial()
-*/
-void QwtDial::setNeedle( QwtDialNeedle *needle )
-{
-    if ( needle != d_data->needle )
-    {
-        if ( d_data->needle )
-            delete d_data->needle;
-
-        d_data->needle = needle;
+ */
+void QwtDial::setNeedle( QwtDialNeedle* needle )
+{
+    if ( needle != m_data->needle )
+    {
+        if ( m_data->needle )
+            delete m_data->needle;
+
+        m_data->needle = needle;
         update();
     }
@@ -535,44 +533,44 @@
 
 /*!
-  \return needle
-  \sa setNeedle()
-*/
-const QwtDialNeedle *QwtDial::needle() const
-{
-    return d_data->needle;
-}
-
-/*!
-  \return needle
-  \sa setNeedle()
-*/
-QwtDialNeedle *QwtDial::needle()
-{
-    return d_data->needle;
+   \return needle
+   \sa setNeedle()
+ */
+const QwtDialNeedle* QwtDial::needle() const
+{
+    return m_data->needle;
+}
+
+/*!
+   \return needle
+   \sa setNeedle()
+ */
+QwtDialNeedle* QwtDial::needle()
+{
+    return m_data->needle;
 }
 
 //! \return the scale draw
-QwtRoundScaleDraw *QwtDial::scaleDraw()
-{
-    return static_cast<QwtRoundScaleDraw *>( abstractScaleDraw() );
+QwtRoundScaleDraw* QwtDial::scaleDraw()
+{
+    return static_cast< QwtRoundScaleDraw* >( abstractScaleDraw() );
 }
 
 //! \return the scale draw
-const QwtRoundScaleDraw *QwtDial::scaleDraw() const
-{
-    return static_cast<const QwtRoundScaleDraw *>( abstractScaleDraw() );
-}
-
-/*!
-  Set an individual scale draw
-
-  The motivation for setting a scale draw is often
-  to overload QwtRoundScaleDraw::label() to return
-  individual tick labels.
-
-  \param scaleDraw Scale draw
-  \warning The previous scale draw is deleted
-*/
-void QwtDial::setScaleDraw( QwtRoundScaleDraw *scaleDraw )
+const QwtRoundScaleDraw* QwtDial::scaleDraw() const
+{
+    return static_cast< const QwtRoundScaleDraw* >( abstractScaleDraw() );
+}
+
+/*!
+   Set an individual scale draw
+
+   The motivation for setting a scale draw is often
+   to overload QwtRoundScaleDraw::label() to return
+   individual tick labels.
+
+   \param scaleDraw Scale draw
+   \warning The previous scale draw is deleted
+ */
+void QwtDial::setScaleDraw( QwtRoundScaleDraw* scaleDraw )
 {
     setAbstractScaleDraw( scaleDraw );
@@ -581,29 +579,29 @@
 
 /*!
-  Change the arc of the scale
-
-  \param minArc Lower limit
-  \param maxArc Upper limit
-
-  \sa minScaleArc(), maxScaleArc()
-*/
+   Change the arc of the scale
+
+   \param minArc Lower limit
+   \param maxArc Upper limit
+
+   \sa minScaleArc(), maxScaleArc()
+ */
 void QwtDial::setScaleArc( double minArc, double maxArc )
 {
     if ( minArc != 360.0 && minArc != -360.0 )
-        minArc = ::fmod( minArc, 360.0 );
+        minArc = std::fmod( minArc, 360.0 );
     if ( maxArc != 360.0 && maxArc != -360.0 )
-        maxArc = ::fmod( maxArc, 360.0 );
-
-    double minScaleArc = qMin( minArc, maxArc );
-    double maxScaleArc = qMax( minArc, maxArc );
+        maxArc = std::fmod( maxArc, 360.0 );
+
+    double minScaleArc = qwtMinF( minArc, maxArc );
+    double maxScaleArc = qwtMaxF( minArc, maxArc );
 
     if ( maxScaleArc - minScaleArc > 360.0 )
         maxScaleArc = minScaleArc + 360.0;
 
-    if ( ( minScaleArc != d_data->minScaleArc ) ||
-        ( maxScaleArc != d_data->maxScaleArc ) )
-    {
-        d_data->minScaleArc = minScaleArc;
-        d_data->maxScaleArc = maxScaleArc;
+    if ( ( minScaleArc != m_data->minScaleArc ) ||
+        ( maxScaleArc != m_data->maxScaleArc ) )
+    {
+        m_data->minScaleArc = minScaleArc;
+        m_data->maxScaleArc = maxScaleArc;
 
         invalidateCache();
@@ -613,79 +611,79 @@
 
 /*!
-  Set the lower limit for the scale arc
-
-  \param min Lower limit of the scale arc
-  \sa setScaleArc(), setMaxScaleArc()
+   Set the lower limit for the scale arc
+
+   \param min Lower limit of the scale arc
+   \sa setScaleArc(), setMaxScaleArc()
  */
 void QwtDial::setMinScaleArc( double min )
 {
-    setScaleArc( min, d_data->maxScaleArc );
-}
-
-/*!
-  \return Lower limit of the scale arc
-  \sa setScaleArc()
-*/
+    setScaleArc( min, m_data->maxScaleArc );
+}
+
+/*!
+   \return Lower limit of the scale arc
+   \sa setScaleArc()
+ */
 double QwtDial::minScaleArc() const
 {
-    return d_data->minScaleArc;
-}
-
-/*!
-  Set the upper limit for the scale arc
-
-  \param max Upper limit of the scale arc
-  \sa setScaleArc(), setMinScaleArc()
+    return m_data->minScaleArc;
+}
+
+/*!
+   Set the upper limit for the scale arc
+
+   \param max Upper limit of the scale arc
+   \sa setScaleArc(), setMinScaleArc()
  */
 void QwtDial::setMaxScaleArc( double max )
 {
-    setScaleArc( d_data->minScaleArc, max );
-}
-
-/*!
-  \return Upper limit of the scale arc
-  \sa setScaleArc()
-*/
+    setScaleArc( m_data->minScaleArc, max );
+}
+
+/*!
+   \return Upper limit of the scale arc
+   \sa setScaleArc()
+ */
 double QwtDial::maxScaleArc() const
 {
-    return d_data->maxScaleArc;
-}
-
-/*!
-  \brief Change the origin
-
-  The origin is the angle where scale and needle is relative to.
-
-  \param origin New origin
-  \sa origin()
-*/
+    return m_data->maxScaleArc;
+}
+
+/*!
+   \brief Change the origin
+
+   The origin is the angle where scale and needle is relative to.
+
+   \param origin New origin
+   \sa origin()
+ */
 void QwtDial::setOrigin( double origin )
 {
     invalidateCache();
 
-    d_data->origin = origin;
+    m_data->origin = origin;
     sliderChange();
 }
 
 /*!
-  The origin is the angle where scale and needle is relative to.
-
-  \return Origin of the dial
-  \sa setOrigin()
-*/
+   The origin is the angle where scale and needle is relative to.
+
+   \return Origin of the dial
+   \sa setOrigin()
+ */
 double QwtDial::origin() const
 {
-    return d_data->origin;
-}
-
-/*!
-  \return Size hint
-  \sa minimumSizeHint()
-*/
+    return m_data->origin;
+}
+
+/*!
+   \return Size hint
+   \sa minimumSizeHint()
+ */
 QSize QwtDial::sizeHint() const
 {
     int sh = 0;
     if ( scaleDraw() )
-        sh = qCeil( scaleDraw()->extent( font() ) );
+        sh = qwtCeil( scaleDraw()->extent( font() ) );
 
     const int d = 6 * sh + 2 * lineWidth();
@@ -693,5 +691,5 @@
     QSize hint( d, d );
     if ( !isReadOnly() )
-        hint = hint.expandedTo( QApplication::globalStrut() );
+        hint = qwtExpandedToGlobalStrut( hint );
 
     return hint;
@@ -699,12 +697,12 @@
 
 /*!
-  \return Minimum size hint
-  \sa sizeHint()
-*/
+   \return Minimum size hint
+   \sa sizeHint()
+ */
 QSize QwtDial::minimumSizeHint() const
 {
     int sh = 0;
     if ( scaleDraw() )
-        sh = qCeil( scaleDraw()->extent( font() ) );
+        sh = qwtCeil( scaleDraw()->extent( font() ) );
 
     const int d = 3 * sh + 2 * lineWidth();
@@ -714,12 +712,12 @@
 
 /*!
-  \brief Determine what to do when the user presses a mouse button.
-
-  \param pos Mouse position
-
-  \retval True, when the inner circle contains pos
-  \sa scrolledTo()
-*/
-bool QwtDial::isScrollPosition( const QPoint &pos ) const
+   \brief Determine what to do when the user presses a mouse button.
+
+   \param pos Mouse position
+
+   \retval True, when the inner circle contains pos
+   \sa scrolledTo()
+ */
+bool QwtDial::isScrollPosition( const QPoint& pos ) const
 {
     const QRegion region( innerRect(), QRegion::Ellipse );
@@ -727,5 +725,5 @@
     {
         double angle = QLineF( rect().center(), pos ).angle();
-        if ( d_data->mode == QwtDial::RotateScale )
+        if ( m_data->mode == QwtDial::RotateScale )
             angle = 360.0 - angle;
 
@@ -733,6 +731,6 @@
             qwtNormalizeDegrees( 90.0 - scaleMap().transform( value() ) );
 
-        d_data->mouseOffset = qwtNormalizeDegrees( angle - valueAngle );
-        d_data->arcOffset = scaleMap().p1();
+        m_data->mouseOffset = qwtNormalizeDegrees( angle - valueAngle );
+        m_data->arcOffset = scaleMap().p1();
 
         return true;
@@ -743,22 +741,22 @@
 
 /*!
-  \brief Determine the value for a new position of the
+   \brief Determine the value for a new position of the
          slider handle.
 
-  \param pos Mouse position
-
-  \return Value for the mouse position
-  \sa isScrollPosition()
-*/
-double QwtDial::scrolledTo( const QPoint &pos ) const
+   \param pos Mouse position
+
+   \return Value for the mouse position
+   \sa isScrollPosition()
+ */
+double QwtDial::scrolledTo( const QPoint& pos ) const
 {
     double angle = QLineF( rect().center(), pos ).angle();
-    if ( d_data->mode == QwtDial::RotateScale )
-    {
-        angle += scaleMap().p1() - d_data->arcOffset;
+    if ( m_data->mode == QwtDial::RotateScale )
+    {
+        angle += scaleMap().p1() - m_data->arcOffset;
         angle = 360.0 - angle;
     }
 
-    angle = qwtNormalizeDegrees( angle - d_data->mouseOffset );
+    angle = qwtNormalizeDegrees( angle - m_data->mouseOffset );
     angle = qwtNormalizeDegrees( 90.0 - angle );
 
@@ -779,5 +777,5 @@
             }
 
-            d_data->mouseOffset += ( boundedAngle - angle );
+            m_data->mouseOffset += ( boundedAngle - angle );
 
             angle = boundedAngle;
@@ -790,5 +788,5 @@
 
         if ( !wrapping() )
-            d_data->mouseOffset += ( boundedAngle - angle );
+            m_data->mouseOffset += ( boundedAngle - angle );
 
         angle = boundedAngle;
@@ -799,10 +797,10 @@
 
 /*!
-  Change Event handler
-  \param event Change event
-
-  Invalidates internal paint caches if necessary
-*/
-void QwtDial::changeEvent( QEvent *event )
+   Change Event handler
+   \param event Change event
+
+   Invalidates internal paint caches if necessary
+ */
+void QwtDial::changeEvent( QEvent* event )
 {
     switch( event->type() )
@@ -826,11 +824,17 @@
 
 /*!
-  Wheel Event handler
-  \param event Wheel event
-*/
-void QwtDial::wheelEvent( QWheelEvent *event )
-{
+   Wheel Event handler
+   \param event Wheel event
+ */
+void QwtDial::wheelEvent( QWheelEvent* event )
+{
+#if QT_VERSION < 0x050e00
+    const QPoint wheelPos = event->pos();
+#else
+    const QPoint wheelPos = event->position().toPoint();
+#endif
+
     const QRegion region( innerRect(), QRegion::Ellipse );
-    if ( region.contains( event->pos() ) )
+    if ( region.contains( wheelPos ) )
         QwtAbstractSlider::wheelEvent( event );
 }
@@ -838,6 +842,5 @@
 void QwtDial::setAngleRange( double angle, double span )
 {
-    QwtRoundScaleDraw *sd = const_cast<QwtRoundScaleDraw *>( scaleDraw() );
-    if ( sd  )
+    if ( QwtRoundScaleDraw* sd = scaleDraw() )
     {
         angle = qwtNormalizeDegrees( angle - 270.0 );
@@ -847,6 +850,6 @@
 
 /*!
-  Invalidate the internal caches and call
-  QwtAbstractSlider::scaleChange()
+   Invalidate the internal caches and call
+   QwtAbstractSlider::scaleChange()
  */
 void QwtDial::scaleChange()
@@ -858,14 +861,16 @@
 void QwtDial::sliderChange()
 {
-    setAngleRange( d_data->origin + d_data->minScaleArc,
-        d_data->maxScaleArc - d_data->minScaleArc );
+    setAngleRange( m_data->origin + m_data->minScaleArc,
+        m_data->maxScaleArc - m_data->minScaleArc );
 
     if ( mode() == RotateScale )
     {
         const double arc = scaleMap().transform( value() ) - scaleMap().p1();
-        setAngleRange( d_data->origin - arc,
-            d_data->maxScaleArc - d_data->minScaleArc );
+        setAngleRange( m_data->origin - arc,
+            m_data->maxScaleArc - m_data->minScaleArc );
     }
 
     QwtAbstractSlider::sliderChange();
 }
+
+#include "moc_qwt_dial.cpp"
