Index: trunk/BNC/qwt/qwt_slider.cpp
===================================================================
--- trunk/BNC/qwt/qwt_slider.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_slider.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,14 +12,15 @@
 #include "qwt_scale_draw.h"
 #include "qwt_scale_map.h"
+#include "qwt_math.h"
+#include "qwt.h"
+
 #include <qevent.h>
 #include <qdrawutil.h>
 #include <qpainter.h>
-#include <qalgorithms.h>
-#include <qmath.h>
 #include <qstyle.h>
 #include <qstyleoption.h>
-#include <qapplication.h>
-
-static QSize qwtHandleSize( const QSize &size,
+#include <qmargins.h>
+
+static QSize qwtHandleSize( const QSize& size,
     Qt::Orientation orientation, bool hasTrough )
 {
@@ -69,16 +70,16 @@
 class QwtSlider::PrivateData
 {
-public:
-    PrivateData():
-        repeatTimerId( 0 ),
-        updateInterval( 150 ),
-        stepsIncrement( 0 ),
-        pendingValueChange( false ),
-        borderWidth( 2 ),
-        spacing( 4 ),
-        scalePosition( QwtSlider::TrailingScale ),
-        hasTrough( true ),
-        hasGroove( false ),
-        mouseOffset( 0 )
+  public:
+    PrivateData()
+        : repeatTimerId( 0 )
+        , updateInterval( 150 )
+        , stepsIncrement( 0 )
+        , pendingValueChange( false )
+        , borderWidth( 2 )
+        , spacing( 4 )
+        , scalePosition( QwtSlider::TrailingScale )
+        , hasTrough( true )
+        , hasGroove( false )
+        , mouseOffset( 0 )
     {
     }
@@ -107,15 +108,15 @@
 };
 /*!
-  Construct vertical slider in QwtSlider::Trough style
-  with a scale to the left.
-
-  The scale is initialized to [0.0, 100.0] and the value set to 0.0.
-
-  \param parent Parent widget
-
-  \sa setOrientation(), setScalePosition(), setBackgroundStyle()
-*/
-QwtSlider::QwtSlider( QWidget *parent ):
-    QwtAbstractSlider( parent )
+   Construct vertical slider in QwtSlider::Trough style
+   with a scale to the left.
+
+   The scale is initialized to [0.0, 100.0] and the value set to 0.0.
+
+   \param parent Parent widget
+
+   \sa setOrientation(), setScalePosition(), setBackgroundStyle()
+ */
+QwtSlider::QwtSlider( QWidget* parent )
+    : QwtAbstractSlider( parent )
 {
     initSlider( Qt::Vertical );
@@ -123,16 +124,16 @@
 
 /*!
-  Construct a slider in QwtSlider::Trough style
-
-  When orientation is Qt::Vertical the scale will be aligned to
-  the left - otherwise at the the top of the slider.
-
-  The scale is initialized to [0.0, 100.0] and the value set to 0.0.
-
-  \param parent Parent widget
-  \param orientation Orientation of the slider.
-*/
-QwtSlider::QwtSlider( Qt::Orientation orientation, QWidget *parent ):
-    QwtAbstractSlider( parent )
+   Construct a slider in QwtSlider::Trough style
+
+   When orientation is Qt::Vertical the scale will be aligned to
+   the left - otherwise at the the top of the slider.
+
+   The scale is initialized to [0.0, 100.0] and the value set to 0.0.
+
+   \param parent Parent widget
+   \param orientation Orientation of the slider.
+ */
+QwtSlider::QwtSlider( Qt::Orientation orientation, QWidget* parent )
+    : QwtAbstractSlider( parent )
 {
     initSlider( orientation );
@@ -142,5 +143,5 @@
 QwtSlider::~QwtSlider()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -154,10 +155,10 @@
     setAttribute( Qt::WA_WState_OwnSizePolicy, false );
 
-    d_data = new QwtSlider::PrivateData;
-
-    d_data->orientation = orientation;
+    m_data = new QwtSlider::PrivateData;
+
+    m_data->orientation = orientation;
 
     scaleDraw()->setAlignment(
-        qwtScaleDrawAlignment( orientation, d_data->scalePosition ) );
+        qwtScaleDrawAlignment( orientation, m_data->scalePosition ) );
     scaleDraw()->setLength( 100 );
 
@@ -167,18 +168,18 @@
 
 /*!
-  \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 QwtSlider::setOrientation( Qt::Orientation orientation )
 {
-    if ( orientation == d_data->orientation )
+    if ( orientation == m_data->orientation )
         return;
 
-    d_data->orientation = orientation;
+    m_data->orientation = orientation;
 
     scaleDraw()->setAlignment(
-        qwtScaleDrawAlignment( orientation, d_data->scalePosition ) );
+        qwtScaleDrawAlignment( orientation, m_data->scalePosition ) );
 
     if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
@@ -196,26 +197,26 @@
 
 /*!
-  \return Orientation
-  \sa setOrientation()
-*/
+   \return Orientation
+   \sa setOrientation()
+ */
 Qt::Orientation QwtSlider::orientation() const
 {
-    return d_data->orientation;
-}
-
-/*!
-  \brief Change the position of the scale
-  \param scalePosition Position of the scale.
-
-  \sa ScalePosition, scalePosition()
-*/
+    return m_data->orientation;
+}
+
+/*!
+   \brief Change the position of the scale
+   \param scalePosition Position of the scale.
+
+   \sa ScalePosition, scalePosition()
+ */
 void QwtSlider::setScalePosition( ScalePosition scalePosition )
 {
-    if ( d_data->scalePosition == scalePosition )
+    if ( m_data->scalePosition == scalePosition )
         return;
 
-    d_data->scalePosition = scalePosition;
+    m_data->scalePosition = scalePosition;
     scaleDraw()->setAlignment(
-        qwtScaleDrawAlignment( d_data->orientation, scalePosition ) );
+        qwtScaleDrawAlignment( m_data->orientation, scalePosition ) );
 
     if ( testAttribute( Qt::WA_WState_Polished ) )
@@ -224,21 +225,21 @@
 
 /*!
-  \return Position of the scale
-  \sa setScalePosition()
+   \return Position of the scale
+   \sa setScalePosition()
  */
 QwtSlider::ScalePosition QwtSlider::scalePosition() const
 {
-    return d_data->scalePosition;
-}
-
-/*!
-  \brief Change the slider's border width
-
-  The border width is used for drawing the slider handle and the
-  trough.
-
-  \param width Border width
-  \sa borderWidth()
-*/
+    return m_data->scalePosition;
+}
+
+/*!
+   \brief Change the slider's border width
+
+   The border width is used for drawing the slider handle and the
+   trough.
+
+   \param width Border width
+   \sa borderWidth()
+ */
 void QwtSlider::setBorderWidth( int width )
 {
@@ -246,7 +247,7 @@
         width = 0;
 
-    if ( width != d_data->borderWidth )
-    {
-        d_data->borderWidth = width;
+    if ( width != m_data->borderWidth )
+    {
+        m_data->borderWidth = width;
 
         if ( testAttribute( Qt::WA_WState_Polished ) )
@@ -256,23 +257,23 @@
 
 /*!
-  \return the border width.
-  \sa setBorderWidth()
-*/
+   \return the border width.
+   \sa setBorderWidth()
+ */
 int QwtSlider::borderWidth() const
 {
-    return d_data->borderWidth;
-}
-
-/*!
-  \brief Change the spacing between trough and scale
-
-  A spacing of 0 means, that the backbone of the scale is covered
-  by the trough.
-
-  The default setting is 4 pixels.
-
-  \param spacing Number of pixels
-  \sa spacing();
-*/
+    return m_data->borderWidth;
+}
+
+/*!
+   \brief Change the spacing between trough and scale
+
+   A spacing of 0 means, that the backbone of the scale is covered
+   by the trough.
+
+   The default setting is 4 pixels.
+
+   \param spacing Number of pixels
+   \sa spacing();
+ */
 void QwtSlider::setSpacing( int spacing )
 {
@@ -280,7 +281,7 @@
         spacing = 0;
 
-    if ( spacing != d_data->spacing  )
-    {
-        d_data->spacing = spacing;
+    if ( spacing != m_data->spacing  )
+    {
+        m_data->spacing = spacing;
 
         if ( testAttribute( Qt::WA_WState_Polished ) )
@@ -290,27 +291,27 @@
 
 /*!
-  \return Number of pixels between slider and scale
-  \sa setSpacing()
-*/
+   \return Number of pixels between slider and scale
+   \sa setSpacing()
+ */
 int QwtSlider::spacing() const
 {
-    return d_data->spacing;
-}
-
-/*!
-  \brief Set the slider's handle size
-
-  When the size is empty the slider handle will be painted with a
-  default size depending on its orientation() and backgroundStyle().
-
-  \param size New size
-
-  \sa handleSize()
-*/
-void QwtSlider::setHandleSize( const QSize &size )
-{
-    if ( size != d_data->handleSize )
-    {
-        d_data->handleSize = size;
+    return m_data->spacing;
+}
+
+/*!
+   \brief Set the slider's handle size
+
+   When the size is empty the slider handle will be painted with a
+   default size depending on its orientation() and backgroundStyle().
+
+   \param size New size
+
+   \sa handleSize()
+ */
+void QwtSlider::setHandleSize( const QSize& size )
+{
+    if ( size != m_data->handleSize )
+    {
+        m_data->handleSize = size;
 
         if ( testAttribute( Qt::WA_WState_Polished ) )
@@ -320,28 +321,28 @@
 
 /*!
-  \return Size of the handle.
-  \sa setHandleSize()
-*/
+   \return Size of the handle.
+   \sa setHandleSize()
+ */
 QSize QwtSlider::handleSize() const
 {
-    return d_data->handleSize;
-}
-
-/*!
-  \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->handleSize;
+}
+
+/*!
+   \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 ~QwtSlider() or the next
                    call of setScaleDraw().
 
-  \sa scaleDraw()
-*/
-void QwtSlider::setScaleDraw( QwtScaleDraw *scaleDraw )
-{
-    const QwtScaleDraw *previousScaleDraw = this->scaleDraw();
+   \sa scaleDraw()
+ */
+void QwtSlider::setScaleDraw( QwtScaleDraw* scaleDraw )
+{
+    const QwtScaleDraw* previousScaleDraw = this->scaleDraw();
     if ( scaleDraw == NULL || scaleDraw == previousScaleDraw )
         return;
@@ -357,19 +358,19 @@
 
 /*!
-  \return the scale draw of the slider
-  \sa setScaleDraw()
-*/
-const QwtScaleDraw *QwtSlider::scaleDraw() const
-{
-    return static_cast<const QwtScaleDraw *>( abstractScaleDraw() );
-}
-
-/*!
-  \return the scale draw of the slider
-  \sa setScaleDraw()
-*/
-QwtScaleDraw *QwtSlider::scaleDraw()
-{
-    return static_cast<QwtScaleDraw *>( abstractScaleDraw() );
+   \return the scale draw of the slider
+   \sa setScaleDraw()
+ */
+const QwtScaleDraw* QwtSlider::scaleDraw() const
+{
+    return static_cast< const QwtScaleDraw* >( abstractScaleDraw() );
+}
+
+/*!
+   \return the scale draw of the slider
+   \sa setScaleDraw()
+ */
+QwtScaleDraw* QwtSlider::scaleDraw()
+{
+    return static_cast< QwtScaleDraw* >( abstractScaleDraw() );
 }
 
@@ -384,24 +385,24 @@
 
 /*!
-  \brief Specify the update interval for automatic scrolling
-
-  The minimal accepted value is 50 ms.
-
-  \param interval Update interval in milliseconds
-
-  \sa setUpdateInterval()
-*/
+   \brief Specify the update interval for automatic scrolling
+
+   The minimal accepted value is 50 ms.
+
+   \param interval Update interval in milliseconds
+
+   \sa setUpdateInterval()
+ */
 void QwtSlider::setUpdateInterval( int interval )
 {
-    d_data->updateInterval = qMax( interval, 50 );
-}
-
-/*!
-  \return Update interval in milliseconds for automatic scrolling
-  \sa setUpdateInterval()
+    m_data->updateInterval = qMax( interval, 50 );
+}
+
+/*!
+   \return Update interval in milliseconds for automatic scrolling
+   \sa setUpdateInterval()
  */
 int QwtSlider::updateInterval() const
 {
-    return d_data->updateInterval;
+    return m_data->updateInterval;
 }
 
@@ -411,13 +412,13 @@
    \param painter Painter
    \param sliderRect Bounding rectangle of the slider
-*/
+ */
 void QwtSlider::drawSlider(
-    QPainter *painter, const QRect &sliderRect ) const
+    QPainter* painter, const QRect& sliderRect ) const
 {
     QRect innerRect( sliderRect );
 
-    if ( d_data->hasTrough )
-    {
-        const int bw = d_data->borderWidth;
+    if ( m_data->hasTrough )
+    {
+        const int bw = m_data->borderWidth;
         innerRect = sliderRect.adjusted( bw, bw, -bw, -bw );
 
@@ -426,9 +427,9 @@
     }
 
-    const QSize handleSize = qwtHandleSize( d_data->handleSize,
-        d_data->orientation, d_data->hasTrough );
-
-    if ( d_data->hasGroove )
-    {
+    if ( m_data->hasGroove )
+    {
+        const QSize handleSize = qwtHandleSize( m_data->handleSize,
+            m_data->orientation, m_data->hasTrough );
+
         const int slotExtent = 4;
         const int slotMargin = 4;
@@ -456,5 +457,5 @@
 
         QBrush brush = palette().brush( QPalette::Dark );
-        qDrawShadePanel( painter, slotRect, palette(), true, 1 , &brush );
+        qDrawShadePanel( painter, slotRect, palette(), true, 1, &brush );
     }
 
@@ -464,14 +465,14 @@
 
 /*!
-  Draw the thumb at a position
-
-  \param painter Painter
-  \param handleRect Bounding rectangle of the handle
-  \param pos Position of the handle marker in widget coordinates
-*/
-void QwtSlider::drawHandle( QPainter *painter,
-    const QRect &handleRect, int pos ) const
-{
-    const int bw = d_data->borderWidth;
+   Draw the thumb at a position
+
+   \param painter Painter
+   \param handleRect Bounding rectangle of the handle
+   \param pos Position of the handle marker in widget coordinates
+ */
+void QwtSlider::drawHandle( QPainter* painter,
+    const QRect& handleRect, int pos ) const
+{
+    const int bw = m_data->borderWidth;
 
     qDrawShadePanel( painter,
@@ -493,12 +494,12 @@
 
 /*!
-  \brief Determine what to do when the user presses a mouse button.
-
-  \param pos Mouse position
-
-  \retval True, when handleRect() contains pos
-  \sa scrolledTo()
-*/
-bool QwtSlider::isScrollPosition( const QPoint &pos ) const
+   \brief Determine what to do when the user presses a mouse button.
+
+   \param pos Mouse position
+
+   \retval True, when handleRect() contains pos
+   \sa scrolledTo()
+ */
+bool QwtSlider::isScrollPosition( const QPoint& pos ) const
 {
     if ( handleRect().contains( pos ) )
@@ -507,5 +508,5 @@
             ? pos.x() : pos.y();
 
-        d_data->mouseOffset = v - transform( value() );
+        m_data->mouseOffset = v - transform( value() );
         return true;
     }
@@ -515,18 +516,18 @@
 
 /*!
-  \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 QwtSlider::scrolledTo( const QPoint &pos ) const
+   \param pos Mouse position
+
+   \return Value for the mouse position
+   \sa isScrollPosition()
+ */
+double QwtSlider::scrolledTo( const QPoint& pos ) const
 {
     int p = ( orientation() == Qt::Horizontal )
         ? pos.x() : pos.y();
 
-    p -= d_data->mouseOffset;
+    p -= m_data->mouseOffset;
 
     int min = transform( lowerBound() );
@@ -543,6 +544,6 @@
    Mouse press event handler
    \param event Mouse event
-*/
-void QwtSlider::mousePressEvent( QMouseEvent *event )
+ */
+void QwtSlider::mousePressEvent( QMouseEvent* event )
 {
     if ( isReadOnly() )
@@ -554,5 +555,5 @@
     const QPoint pos = event->pos();
 
-    if ( isValid() && d_data->sliderRect.contains( pos ) )
+    if ( isValid() && m_data->sliderRect.contains( pos ) )
     {
         if ( !handleRect().contains( pos ) )
@@ -560,22 +561,22 @@
             const int markerPos = transform( value() );
 
-            d_data->stepsIncrement = pageSteps();
-
-            if ( d_data->orientation == Qt::Horizontal )
+            m_data->stepsIncrement = pageSteps();
+
+            if ( m_data->orientation == Qt::Horizontal )
             {
                 if ( pos.x() < markerPos )
-                    d_data->stepsIncrement = -d_data->stepsIncrement;
+                    m_data->stepsIncrement = -m_data->stepsIncrement;
             }
             else
             {
                 if ( pos.y() < markerPos )
-                    d_data->stepsIncrement = -d_data->stepsIncrement;
+                    m_data->stepsIncrement = -m_data->stepsIncrement;
             }
 
             if ( isInverted() )
-                d_data->stepsIncrement = -d_data->stepsIncrement;
+                m_data->stepsIncrement = -m_data->stepsIncrement;
 
             const double v = value();
-            incrementValue( d_data->stepsIncrement );
+            incrementValue( m_data->stepsIncrement );
 
             if ( v != value() )
@@ -584,11 +585,11 @@
                     Q_EMIT valueChanged( value() );
                 else
-                    d_data->pendingValueChange = true;
+                    m_data->pendingValueChange = true;
 
                 Q_EMIT sliderMoved( value() );
             }
 
-            d_data->timerTick = false;
-            d_data->repeatTimerId = startTimer( qMax( 250, 2 * updateInterval() ) );
+            m_data->timerTick = false;
+            m_data->repeatTimerId = startTimer( qMax( 250, 2 * updateInterval() ) );
 
             return;
@@ -602,18 +603,18 @@
    Mouse release event handler
    \param event Mouse event
-*/
-void QwtSlider::mouseReleaseEvent( QMouseEvent *event )
-{
-    if ( d_data->repeatTimerId > 0 )
-    {
-        killTimer( d_data->repeatTimerId );
-        d_data->repeatTimerId = 0;
-        d_data->timerTick = false;
-        d_data->stepsIncrement = 0;
-    }
-
-    if ( d_data->pendingValueChange )
-    {
-        d_data->pendingValueChange = false;
+ */
+void QwtSlider::mouseReleaseEvent( QMouseEvent* event )
+{
+    if ( m_data->repeatTimerId > 0 )
+    {
+        killTimer( m_data->repeatTimerId );
+        m_data->repeatTimerId = 0;
+        m_data->timerTick = false;
+        m_data->stepsIncrement = 0;
+    }
+
+    if ( m_data->pendingValueChange )
+    {
+        m_data->pendingValueChange = false;
         Q_EMIT valueChanged( value() );
     }
@@ -629,8 +630,8 @@
 
    \param event Mouse event
-*/
-void QwtSlider::timerEvent( QTimerEvent *event )
-{
-    if ( event->timerId() != d_data->repeatTimerId )
+ */
+void QwtSlider::timerEvent( QTimerEvent* event )
+{
+    if ( event->timerId() != m_data->repeatTimerId )
     {
         QwtAbstractSlider::timerEvent( event );
@@ -640,11 +641,11 @@
     if ( !isValid() )
     {
-        killTimer( d_data->repeatTimerId );
-        d_data->repeatTimerId = 0;
+        killTimer( m_data->repeatTimerId );
+        m_data->repeatTimerId = 0;
         return;
     }
 
     const double v = value();
-    incrementValue( d_data->stepsIncrement );
+    incrementValue( m_data->stepsIncrement );
 
     if ( v != value() )
@@ -653,16 +654,16 @@
             Q_EMIT valueChanged( value() );
         else
-            d_data->pendingValueChange = true;
+            m_data->pendingValueChange = true;
 
         Q_EMIT sliderMoved( value() );
     }
 
-    if ( !d_data->timerTick )
+    if ( !m_data->timerTick )
     {
         // restart the timer with a shorter interval
-        killTimer( d_data->repeatTimerId );
-        d_data->repeatTimerId = startTimer( updateInterval() );
-
-        d_data->timerTick = true;
+        killTimer( m_data->repeatTimerId );
+        m_data->repeatTimerId = startTimer( updateInterval() );
+
+        m_data->timerTick = true;
     }
 }
@@ -671,6 +672,6 @@
    Qt paint event handler
    \param event Paint event
-*/
-void QwtSlider::paintEvent( QPaintEvent *event )
+ */
+void QwtSlider::paintEvent( QPaintEvent* event )
 {
     QPainter painter( this );
@@ -678,17 +679,17 @@
 
     QStyleOption opt;
-    opt.init(this);
+    opt.initFrom(this);
     style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
 
-    if ( d_data->scalePosition != QwtSlider::NoScale )
-    {
-        if ( !d_data->sliderRect.contains( event->rect() ) )
+    if ( m_data->scalePosition != QwtSlider::NoScale )
+    {
+        if ( !m_data->sliderRect.contains( event->rect() ) )
             scaleDraw()->draw( &painter, palette() );
     }
 
-    drawSlider( &painter, d_data->sliderRect );
+    drawSlider( &painter, m_data->sliderRect );
 
     if ( hasFocus() )
-        QwtPainter::drawFocusRect( &painter, this, d_data->sliderRect );
+        QwtPainter::drawFocusRect( &painter, this, m_data->sliderRect );
 }
 
@@ -696,10 +697,23 @@
    Qt resize event handler
    \param event Resize event
-*/
-void QwtSlider::resizeEvent( QResizeEvent *event )
-{
-    Q_UNUSED( event );
-
+ */
+void QwtSlider::resizeEvent( QResizeEvent* event )
+{
     layoutSlider( false );
+    QwtAbstractSlider::resizeEvent( event );
+}
+
+/*!
+   Qt event handler
+   \param event Event
+
+   \return true, if event was recognized and processed
+ */
+bool QwtSlider::event( QEvent* event )
+{
+    if ( event->type() == QEvent::PolishRequest )
+        layoutSlider( false );
+
+    return QwtAbstractSlider::event( event );
 }
 
@@ -707,6 +721,6 @@
    Handles QEvent::StyleChange and QEvent::FontChange events
    \param event Change event
-*/
-void QwtSlider::changeEvent( QEvent *event )
+ */
+void QwtSlider::changeEvent( QEvent* event )
 {
     if ( event->type() == QEvent::StyleChange ||
@@ -721,18 +735,18 @@
 
 /*!
-  Recalculate the slider's geometry and layout based on
-  the current geometry and fonts.
-
-  \param update_geometry  notify the layout system and call update
+   Recalculate the slider's geometry and layout based on
+   the current geometry and fonts.
+
+   \param update_geometry  notify the layout system and call update
          to redraw the scale
-*/
+ */
 void QwtSlider::layoutSlider( bool update_geometry )
 {
     int bw = 0;
-    if ( d_data->hasTrough )
-        bw = d_data->borderWidth;
-
-    const QSize handleSize = qwtHandleSize( d_data->handleSize,
-        d_data->orientation, d_data->hasTrough );
+    if ( m_data->hasTrough )
+        bw = m_data->borderWidth;
+
+    const QSize handleSize = qwtHandleSize( m_data->handleSize,
+        m_data->orientation, m_data->hasTrough );
 
     QRect sliderRect = contentsRect();
@@ -752,5 +766,5 @@
 
     int scaleMargin = 0;
-    if ( d_data->scalePosition != QwtSlider::NoScale )
+    if ( m_data->scalePosition != QwtSlider::NoScale )
     {
         int d1, d2;
@@ -762,5 +776,5 @@
     int scaleX, scaleY, scaleLength;
 
-    if ( d_data->orientation == Qt::Horizontal )
+    if ( m_data->orientation == Qt::Horizontal )
     {
         const int handleMargin = handleSize.width() / 2 - 1;
@@ -791,17 +805,17 @@
     // now align slider and scale according to the ScalePosition
 
-    if ( d_data->orientation == Qt::Horizontal )
+    if ( m_data->orientation == Qt::Horizontal )
     {
         const int h = handleSize.height() + 2 * bw;
 
-        if ( d_data->scalePosition == QwtSlider::TrailingScale )
+        if ( m_data->scalePosition == QwtSlider::TrailingScale )
         {
             sliderRect.setTop( sliderRect.bottom() + 1 - h );
-            scaleY = sliderRect.top() - d_data->spacing;
+            scaleY = sliderRect.top() - m_data->spacing;
         }
         else
         {
             sliderRect.setHeight( h );
-            scaleY = sliderRect.bottom() + 1 + d_data->spacing;
+            scaleY = sliderRect.bottom() + 1 + m_data->spacing;
         }
     }
@@ -810,17 +824,17 @@
         const int w = handleSize.width() + 2 * bw;
 
-        if ( d_data->scalePosition == QwtSlider::LeadingScale )
+        if ( m_data->scalePosition == QwtSlider::LeadingScale )
         {
             sliderRect.setWidth( w );
-            scaleX = sliderRect.right() + 1 + d_data->spacing;
+            scaleX = sliderRect.right() + 1 + m_data->spacing;
         }
         else
         {
             sliderRect.setLeft( sliderRect.right() + 1 - w );
-            scaleX = sliderRect.left() - d_data->spacing;
+            scaleX = sliderRect.left() - m_data->spacing;
         }
     }
 
-    d_data->sliderRect = sliderRect;
+    m_data->sliderRect = sliderRect;
 
     scaleDraw()->move( scaleX, scaleY );
@@ -829,5 +843,5 @@
     if ( update_geometry )
     {
-        d_data->sizeHintCache = QSize(); // invalidate
+        m_data->sizeHintCache = QSize(); // invalidate
         updateGeometry();
         update();
@@ -836,17 +850,17 @@
 
 /*!
-  En/Disable the trough
-
-  The slider can be cutomized by showing a trough for the
-  handle.
-
-  \param on When true, the groove is visible
-  \sa hasTrough(), setGroove()
+   En/Disable the trough
+
+   The slider can be customized by showing a trough for the
+   handle.
+
+   \param on When true, the groove is visible
+   \sa hasTrough(), setGroove()
  */
 void QwtSlider::setTrough( bool on )
 {
-    if ( d_data->hasTrough != on )
-    {
-        d_data->hasTrough = on;
+    if ( m_data->hasTrough != on )
+    {
+        m_data->hasTrough = on;
 
         if ( testAttribute( Qt::WA_WState_Polished ) )
@@ -856,26 +870,26 @@
 
 /*!
-  \return True, when the trough is visisble
-  \sa setTrough(), hasGroove()
+   \return True, when the trough is visible
+   \sa setTrough(), hasGroove()
  */
 bool QwtSlider::hasTrough() const
 {
-    return d_data->hasTrough;
-}
-
-/*!
-  En/Disable the groove
-
-  The slider can be cutomized by showing a groove for the
-  handle.
-
-  \param on When true, the groove is visible
-  \sa hasGroove(), setThrough()
+    return m_data->hasTrough;
+}
+
+/*!
+   En/Disable the groove
+
+   The slider can be customized by showing a groove for the
+   handle.
+
+   \param on When true, the groove is visible
+   \sa hasGroove(), setThrough()
  */
 void QwtSlider::setGroove( bool on )
 {
-    if ( d_data->hasGroove != on )
-    {
-        d_data->hasGroove = on;
+    if ( m_data->hasGroove != on )
+    {
+        m_data->hasGroove = on;
 
         if ( testAttribute( Qt::WA_WState_Polished ) )
@@ -885,41 +899,41 @@
 
 /*!
-  \return True, when the groove is visisble
-  \sa setGroove(), hasTrough()
+   \return True, when the groove is visible
+   \sa setGroove(), hasTrough()
  */
 bool QwtSlider::hasGroove() const
 {
-    return d_data->hasGroove;
-}
-
-/*!
-  \return minimumSizeHint()
-*/
+    return m_data->hasGroove;
+}
+
+/*!
+   \return minimumSizeHint()
+ */
 QSize QwtSlider::sizeHint() const
 {
     const QSize hint = minimumSizeHint();
-    return hint.expandedTo( QApplication::globalStrut() );
-}
-
-/*!
-  \return Minimum size hint
-  \sa sizeHint()
-*/
+    return qwtExpandedToGlobalStrut( hint );
+}
+
+/*!
+   \return Minimum size hint
+   \sa sizeHint()
+ */
 QSize QwtSlider::minimumSizeHint() const
 {
-    if ( !d_data->sizeHintCache.isEmpty() )
-        return d_data->sizeHintCache;
-
-    const QSize handleSize = qwtHandleSize( d_data->handleSize,
-        d_data->orientation, d_data->hasTrough );
+    if ( !m_data->sizeHintCache.isEmpty() )
+        return m_data->sizeHintCache;
+
+    const QSize handleSize = qwtHandleSize( m_data->handleSize,
+        m_data->orientation, m_data->hasTrough );
 
     int bw = 0;
-    if ( d_data->hasTrough )
-        bw = d_data->borderWidth;
+    if ( m_data->hasTrough )
+        bw = m_data->borderWidth;
 
     int sliderLength = 0;
     int scaleExtent = 0;
 
-    if ( d_data->scalePosition != QwtSlider::NoScale )
+    if ( m_data->scalePosition != QwtSlider::NoScale )
     {
         int d1, d2;
@@ -929,5 +943,5 @@
 
         int handleBorderDist;
-        if ( d_data->orientation == Qt::Horizontal )
+        if ( m_data->orientation == Qt::Horizontal )
             handleBorderDist = handleSize.width();
         else
@@ -941,6 +955,6 @@
         }
 
-        scaleExtent += d_data->spacing;
-        scaleExtent += qCeil( scaleDraw()->extent( font() ) );
+        scaleExtent += m_data->spacing;
+        scaleExtent += qwtCeil( scaleDraw()->extent( font() ) );
     }
 
@@ -950,5 +964,5 @@
     int h = 0;
 
-    if ( d_data->orientation == Qt::Horizontal )
+    if ( m_data->orientation == Qt::Horizontal )
     {
         w = sliderLength;
@@ -962,12 +976,11 @@
 
     // finally add margins
-    int left, right, top, bottom;
-    getContentsMargins( &left, &top, &right, &bottom );
-
-    w += left + right;
-    h += top + bottom;
-
-    d_data->sizeHintCache = QSize( w, h );
-    return d_data->sizeHintCache;
+    const QMargins m = contentsMargins();
+
+    w += m.left() + m.right();
+    h += m.top() + m.bottom();
+
+    m_data->sizeHintCache = QSize( w, h );
+    return m_data->sizeHintCache;
 }
 
@@ -982,6 +995,6 @@
     const int markerPos = transform( value() );
 
-    QPoint center = d_data->sliderRect.center();
-    if ( d_data->orientation == Qt::Horizontal )
+    QPoint center = m_data->sliderRect.center();
+    if ( m_data->orientation == Qt::Horizontal )
         center.setX( markerPos );
     else
@@ -989,6 +1002,6 @@
 
     QRect rect;
-    rect.setSize( qwtHandleSize( d_data->handleSize,
-        d_data->orientation, d_data->hasTrough ) );
+    rect.setSize( qwtHandleSize( m_data->handleSize,
+        m_data->orientation, m_data->hasTrough ) );
     rect.moveCenter( center );
 
@@ -997,8 +1010,10 @@
 
 /*!
- \return Bounding rectangle of the slider - without the scale
+   \return Bounding rectangle of the slider - without the scale
  */
 QRect QwtSlider::sliderRect() const
 {
-    return d_data->sliderRect;
-}
+    return m_data->sliderRect;
+}
+
+#include "moc_qwt_slider.cpp"
