Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_wheel.cpp


Ignore:
Timestamp:
Nov 3, 2026, 10:53:35 AM (3 weeks ago)
Author:
stuerze
Message:

deprecated functions exchanged libs updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/qwt/qwt_wheel.cpp

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    1111#include "qwt_math.h"
    1212#include "qwt_painter.h"
     13#include "qwt.h"
     14
    1315#include <qevent.h>
    1416#include <qdrawutil.h>
    … …  
    1618#include <qstyle.h>
    1719#include <qstyleoption.h>
    18 #include <qapplication.h>
    19 #include <qdatetime.h>
    20 
    21 #if QT_VERSION < 0x040601
    22 #define qFabs(x) ::fabs(x)
    23 #define qFastSin(x) ::sin(x)
    24 #define qExp(x) ::exp(x)
    25 #endif
     20#include <qelapsedtimer.h>
     21#include <qmath.h>
    2622
    2723class QwtWheel::PrivateData
    2824{
    29 public:
    30     PrivateData():
    31         orientation( Qt::Horizontal ),
    32         viewAngle( 175.0 ),
    33         totalAngle( 360.0 ),
    34         tickCount( 10 ),
    35         wheelBorderWidth( 2 ),
    36         borderWidth( 2 ),
    37         wheelWidth( 20 ),
    38         isScrolling( false ),
    39         mouseOffset( 0.0 ),
    40         tracking( true ),
    41         pendingValueChanged( false ),
    42         updateInterval( 50 ),
    43         mass( 0.0 ),
    44         timerId( 0 ),
    45         speed( 0.0 ),
    46         mouseValue( 0.0 ),
    47         flyingValue( 0.0 ),
    48         minimum( 0.0 ),
    49         maximum( 100.0 ),
    50         singleStep( 1.0 ),
    51         pageStepCount( 1 ),
    52         stepAlignment( true ),
    53         value( 0.0 ),
    54         inverted( false ),
    55         wrapping( false )
     25  public:
     26    PrivateData()
     27        : orientation( Qt::Horizontal )
     28        , viewAngle( 175.0 )
     29        , totalAngle( 360.0 )
     30        , tickCount( 10 )
     31        , wheelBorderWidth( 2 )
     32        , borderWidth( 2 )
     33        , wheelWidth( 20 )
     34        , mouseOffset( 0.0 )
     35        , updateInterval( 50 )
     36        , mass( 0.0 )
     37        , timerId( 0 )
     38        , speed( 0.0 )
     39        , mouseValue( 0.0 )
     40        , flyingValue( 0.0 )
     41        , minimum( 0.0 )
     42        , maximum( 100.0 )
     43        , singleStep( 1.0 )
     44        , pageStepCount( 1 )
     45        , value( 0.0 )
     46        , isScrolling( false )
     47        , tracking( true )
     48        , stepAlignment( true )
     49        , pendingValueChanged( false )
     50        , inverted( false )
     51        , wrapping( false )
    5652    {
    5753    }
    … …  
    6561    int wheelWidth;
    6662
    67     bool isScrolling;
    6863    double mouseOffset;
    69 
    70     bool tracking;
    71     bool pendingValueChanged; // when not tracking
    7264
    7365    int updateInterval;
    … …  
    7668    // for the flying wheel effect
    7769    int timerId;
    78     QTime time;
     70    QElapsedTimer timer;
    7971    double speed;
    8072    double mouseValue;
    … …  
    8678    double singleStep;
    8779    int pageStepCount;
     80
     81    double value;
     82
     83    bool isScrolling;
     84    bool tracking;
    8885    bool stepAlignment;
    89 
    90     double value;
    91 
     86    bool pendingValueChanged; // when not tracking
    9287    bool inverted;
    9388    bool wrapping;
    … …  
    9590
    9691//! Constructor
    97 QwtWheel::QwtWheel( QWidget *parent ):
     92QwtWheel::QwtWheel( QWidget* parent ):
    9893    QWidget( parent )
    9994{
    100     d_data = new PrivateData;
     95    m_data = new PrivateData;
    10196
    10297    setFocusPolicy( Qt::StrongFocus );
    … …  
    108103QwtWheel::~QwtWheel()
    109104{
    110     delete d_data;
    111 }
    112 
    113 /*!
    114   \brief En/Disable tracking
    115 
    116   If tracking is enabled (the default), the wheel emits the valueChanged()
    117   signal while the wheel is moving. If tracking is disabled, the wheel
    118   emits the valueChanged() signal only when the wheel movement is terminated.
    119 
    120   The wheelMoved() signal is emitted regardless id tracking is enabled or not.
    121 
    122   \param enable On/Off
    123   \sa isTracking()
     105    delete m_data;
     106}
     107
     108/*!
     109   \brief En/Disable tracking
     110
     111   If tracking is enabled (the default), the wheel emits the valueChanged()
     112   signal while the wheel is moving. If tracking is disabled, the wheel
     113   emits the valueChanged() signal only when the wheel movement is terminated.
     114
     115   The wheelMoved() signal is emitted regardless id tracking is enabled or not.
     116
     117   \param enable On/Off
     118   \sa isTracking()
    124119 */
    125120void QwtWheel::setTracking( bool enable )
    126121{
    127     d_data->tracking = enable;
    128 }
    129 
    130 /*!
    131   \return True, when tracking is enabled
    132   \sa setTracking(), valueChanged(), wheelMoved()
    133 */
     122    m_data->tracking = enable;
     123}
     124
     125/*!
     126   \return True, when tracking is enabled
     127   \sa setTracking(), valueChanged(), wheelMoved()
     128 */
    134129bool QwtWheel::isTracking() const
    135130{
    136     return d_data->tracking;
    137 }
    138 
    139 /*!
    140   \brief Specify the update interval when the wheel is flying
    141 
    142   Default and minimum value is 50 ms.
    143 
    144   \param interval Interval in milliseconds
    145   \sa updateInterval(), setMass(), setTracking()
    146 */
     131    return m_data->tracking;
     132}
     133
     134/*!
     135   \brief Specify the update interval when the wheel is flying
     136
     137   Default and minimum value is 50 ms.
     138
     139   \param interval Interval in milliseconds
     140   \sa updateInterval(), setMass(), setTracking()
     141 */
    147142void QwtWheel::setUpdateInterval( int interval )
    148143{
    149     d_data->updateInterval = qMax( interval, 50 );
    150 }
    151 
    152 /*!
    153   \return Update interval when the wheel is flying
    154   \sa setUpdateInterval(), mass(), isTracking()
     144    m_data->updateInterval = qMax( interval, 50 );
     145}
     146
     147/*!
     148   \return Update interval when the wheel is flying
     149   \sa setUpdateInterval(), mass(), isTracking()
    155150 */
    156151int QwtWheel::updateInterval() const
    157152{
    158     return d_data->updateInterval;
     153    return m_data->updateInterval;
    159154}
    160155
    … …  
    165160
    166161   \param event Mouse event
    167 */
    168 void QwtWheel::mousePressEvent( QMouseEvent *event )
     162 */
     163void QwtWheel::mousePressEvent( QMouseEvent* event )
    169164{
    170165    stopFlying();
    171166
    172     d_data->isScrolling = wheelRect().contains( event->pos() );
    173 
    174     if ( d_data->isScrolling )
    175     {
    176         d_data->time.start();
    177         d_data->speed = 0.0;
    178         d_data->mouseValue = valueAt( event->pos() );
    179         d_data->mouseOffset = d_data->mouseValue - d_data->value;
    180         d_data->pendingValueChanged = false;
     167    m_data->isScrolling = wheelRect().contains( event->pos() );
     168
     169    if ( m_data->isScrolling )
     170    {
     171        m_data->timer.start();
     172        m_data->speed = 0.0;
     173        m_data->mouseValue = valueAt( event->pos() );
     174        m_data->mouseOffset = m_data->mouseValue - m_data->value;
     175        m_data->pendingValueChanged = false;
    181176
    182177        Q_EMIT wheelPressed();
    … …  
    190185
    191186   \param event Mouse event
    192 */
    193 void QwtWheel::mouseMoveEvent( QMouseEvent *event )
    194 {
    195     if ( !d_data->isScrolling )
     187 */
     188void QwtWheel::mouseMoveEvent( QMouseEvent* event )
     189{
     190    if ( !m_data->isScrolling )
    196191        return;
    197192
    198193    double mouseValue = valueAt( event->pos() );
    199194
    200     if ( d_data->mass > 0.0 )
    201     {
    202         double ms = d_data->time.restart();
     195    if ( m_data->mass > 0.0 )
     196    {
     197        double ms = m_data->timer.restart();
    203198
    204199        // the interval when mouse move events are posted are somehow
    … …  
    207202        ms = qMax( ms, 5.0 );
    208203
    209         d_data->speed = ( mouseValue - d_data->mouseValue ) / ms;
    210     }
    211 
    212     d_data->mouseValue = mouseValue;
    213 
    214     double value = boundedValue( mouseValue - d_data->mouseOffset );
    215     if ( d_data->stepAlignment )
     204        m_data->speed = ( mouseValue - m_data->mouseValue ) / ms;
     205    }
     206
     207    m_data->mouseValue = mouseValue;
     208
     209    double value = boundedValue( mouseValue - m_data->mouseOffset );
     210    if ( m_data->stepAlignment )
    216211        value = alignedValue( value );
    217212
    218     if ( value != d_data->value )
    219     {
    220         d_data->value = value;
     213    if ( value != m_data->value )
     214    {
     215        m_data->value = value;
    221216
    222217        update();
    223218
    224         Q_EMIT wheelMoved( d_data->value );
    225 
    226         if ( d_data->tracking )
    227             Q_EMIT valueChanged( d_data->value );
     219        Q_EMIT wheelMoved( m_data->value );
     220
     221        if ( m_data->tracking )
     222            Q_EMIT valueChanged( m_data->value );
    228223        else
    229             d_data->pendingValueChanged = true;
     224            m_data->pendingValueChanged = true;
    230225    }
    231226}
    … …  
    238233
    239234   \param event Mouse event
    240 */
    241 
    242 void QwtWheel::mouseReleaseEvent( QMouseEvent *event )
     235 */
     236
     237void QwtWheel::mouseReleaseEvent( QMouseEvent* event )
    243238{
    244239    Q_UNUSED( event );
    245240
    246     if ( !d_data->isScrolling )
     241    if ( !m_data->isScrolling )
    247242        return;
    248243
    249     d_data->isScrolling = false;
     244    m_data->isScrolling = false;
    250245
    251246    bool startFlying = false;
    252247
    253     if ( d_data->mass > 0.0 )
    254     {
    255         const int ms = d_data->time.elapsed();
    256         if ( ( qFabs( d_data->speed ) > 0.0 ) && ( ms < 50 ) )
     248    if ( m_data->mass > 0.0 )
     249    {
     250        const qint64 ms = m_data->timer.elapsed();
     251        if ( ( std::fabs( m_data->speed ) > 0.0 ) && ( ms < 50 ) )
    257252            startFlying = true;
    258253    }
    … …  
    260255    if ( startFlying )
    261256    {
    262         d_data->flyingValue =
    263             boundedValue( d_data->mouseValue - d_data->mouseOffset );
    264 
    265         d_data->timerId = startTimer( d_data->updateInterval );
     257        m_data->flyingValue =
     258            boundedValue( m_data->mouseValue - m_data->mouseOffset );
     259
     260        m_data->timerId = startTimer( m_data->updateInterval );
    266261    }
    267262    else
    268263    {
    269         if ( d_data->pendingValueChanged )
    270             Q_EMIT valueChanged( d_data->value );
    271     }
    272 
    273     d_data->pendingValueChanged = false;
    274     d_data->mouseOffset = 0.0;
     264        if ( m_data->pendingValueChanged )
     265            Q_EMIT valueChanged( m_data->value );
     266    }
     267
     268    m_data->pendingValueChanged = false;
     269    m_data->mouseOffset = 0.0;
    275270
    276271    Q_EMIT wheelReleased();
    … …  
    278273
    279274/*!
    280   \brief Qt timer event
    281 
    282   The flying wheel effect is implemented using a timer
    283 
    284   \param event Timer event
    285 
    286   \sa updateInterval()
    287  */
    288 void QwtWheel::timerEvent( QTimerEvent *event )
    289 {
    290     if ( event->timerId() != d_data->timerId )
     275   \brief Qt timer event
     276
     277   The flying wheel effect is implemented using a timer
     278
     279   \param event Timer event
     280
     281   \sa updateInterval()
     282 */
     283void QwtWheel::timerEvent( QTimerEvent* event )
     284{
     285    if ( event->timerId() != m_data->timerId )
    291286    {
    292287        QWidget::timerEvent( event );
    … …  
    294289    }
    295290
    296     d_data->speed *= qExp( -d_data->updateInterval * 0.001 / d_data->mass );
    297 
    298     d_data->flyingValue += d_data->speed * d_data->updateInterval;
    299     d_data->flyingValue = boundedValue( d_data->flyingValue );
    300 
    301     double value = d_data->flyingValue;
    302     if ( d_data->stepAlignment )
     291    m_data->speed *= std::exp( -m_data->updateInterval * 0.001 / m_data->mass );
     292
     293    m_data->flyingValue += m_data->speed * m_data->updateInterval;
     294    m_data->flyingValue = boundedValue( m_data->flyingValue );
     295
     296    double value = m_data->flyingValue;
     297    if ( m_data->stepAlignment )
    303298        value = alignedValue( value );
    304299
    305     if ( qFabs( d_data->speed ) < 0.001 * d_data->singleStep )
    306     {
    307         // stop if d_data->speed < one step per second
     300    if ( std::fabs( m_data->speed ) < 0.001 * m_data->singleStep )
     301    {
     302        // stop if m_data->speed < one step per second
    308303        stopFlying();
    309304    }
    310305
    311     if ( value != d_data->value )
    312     {
    313         d_data->value = value;
     306    if ( value != m_data->value )
     307    {
     308        m_data->value = value;
    314309        update();
    315310
    316         if ( d_data->tracking || d_data->timerId == 0 )
    317             Q_EMIT valueChanged( d_data->value );
    318     }
    319 }
    320 
    321 
    322 /*!
    323   \brief Handle wheel events
    324 
    325   In/Decrement the value
    326 
    327   \param event Wheel event
    328 */
    329 void QwtWheel::wheelEvent( QWheelEvent *event )
    330 {
    331     if ( !wheelRect().contains( event->pos() ) )
     311        if ( m_data->tracking || m_data->timerId == 0 )
     312            Q_EMIT valueChanged( m_data->value );
     313    }
     314}
     315
     316
     317/*!
     318   \brief Handle wheel events
     319
     320   In/Decrement the value
     321
     322   \param event Wheel event
     323 */
     324void QwtWheel::wheelEvent( QWheelEvent* event )
     325{
     326#if QT_VERSION < 0x050e00
     327    const QPoint wheelPos = event->pos();
     328    const int wheelDelta = event->delta();
     329#else
     330    const QPoint wheelPos = event->position().toPoint();
     331
     332    const QPoint delta = event->angleDelta();
     333    const int wheelDelta = ( qAbs( delta.x() ) > qAbs( delta.y() ) )
     334        ? delta.x() : delta.y();
     335#endif
     336
     337    if ( !wheelRect().contains( wheelPos ) )
    332338    {
    333339        event->ignore();
    … …  
    335341    }
    336342
    337     if ( d_data->isScrolling )
     343    if ( m_data->isScrolling )
    338344        return;
    339345
    … …  
    342348    double increment = 0.0;
    343349
    344     if ( ( event->modifiers() & Qt::ControlModifier) ||
     350    if ( ( event->modifiers() & Qt::ControlModifier ) ||
    345351        ( event->modifiers() & Qt::ShiftModifier ) )
    346352    {
    347353        // one page regardless of delta
    348         increment = d_data->singleStep * d_data->pageStepCount;
    349         if ( event->delta() < 0 )
     354        increment = m_data->singleStep * m_data->pageStepCount;
     355        if ( wheelDelta < 0 )
    350356            increment = -increment;
    351357    }
    352358    else
    353359    {
    354         const int numSteps = event->delta() / 120;
    355         increment = d_data->singleStep * numSteps;
    356     }
    357 
    358     if ( d_data->orientation == Qt::Vertical && d_data->inverted )
     360        const int numSteps = wheelDelta / 120;
     361        increment = m_data->singleStep * numSteps;
     362    }
     363
     364    if ( m_data->orientation == Qt::Vertical && m_data->inverted )
    359365        increment = -increment;
    360366
    361     double value = boundedValue( d_data->value + increment );
    362 
    363     if ( d_data->stepAlignment )
     367    double value = boundedValue( m_data->value + increment );
     368
     369    if ( m_data->stepAlignment )
    364370        value = alignedValue( value );
    365371
    366     if ( value != d_data->value )
    367     {
    368         d_data->value = value;
     372    if ( value != m_data->value )
     373    {
     374        m_data->value = value;
    369375        update();
    370376
    371         Q_EMIT valueChanged( d_data->value );
    372         Q_EMIT wheelMoved( d_data->value );
    373     }
    374 }
    375 
    376 /*!
    377   Handle key events
    378 
    379   - Qt::Key_Home\n
     377        Q_EMIT valueChanged( m_data->value );
     378        Q_EMIT wheelMoved( m_data->value );
     379    }
     380}
     381
     382/*!
     383   Handle key events
     384
     385   - Qt::Key_Home\n
    380386    Step to minimum()
    381387
    382   - Qt::Key_End\n
     388   - Qt::Key_End\n
    383389    Step to maximum()
    384390
    385   - Qt::Key_Up\n
     391   - Qt::Key_Up\n
    386392    In case of a horizontal or not inverted vertical wheel the value
    387393    will be incremented by the step size. For an inverted vertical wheel
    388394    the value will be decremented by the step size.
    389395
    390   - Qt::Key_Down\n
     396   - Qt::Key_Down\n
    391397    In case of a horizontal or not inverted vertical wheel the value
    392398    will be decremented by the step size. For an inverted vertical wheel
    393399    the value will be incremented by the step size.
    394400
    395   - Qt::Key_PageUp\n
     401   - Qt::Key_PageUp\n
    396402    The value will be incremented by pageStepSize() * singleStepSize().
    397403
    398   - Qt::Key_PageDown\n
     404   - Qt::Key_PageDown\n
    399405    The value will be decremented by pageStepSize() * singleStepSize().
    400406
    401   \param event Key event
    402 */
    403 void QwtWheel::keyPressEvent( QKeyEvent *event )
    404 {
    405     if ( d_data->isScrolling )
     407   \param event Key event
     408 */
     409void QwtWheel::keyPressEvent( QKeyEvent* event )
     410{
     411    if ( m_data->isScrolling )
    406412    {
    407413        // don't interfere mouse scrolling
    … …  
    409415    }
    410416
    411     double value = d_data->value;
     417    double value = m_data->value;
    412418    double increment = 0.0;
    413419
    … …  
    416422        case Qt::Key_Down:
    417423        {
    418             if ( d_data->orientation == Qt::Vertical && d_data->inverted )
    419                 increment = d_data->singleStep;
     424            if ( m_data->orientation == Qt::Vertical && m_data->inverted )
     425                increment = m_data->singleStep;
    420426            else
    421                 increment = -d_data->singleStep;
     427                increment = -m_data->singleStep;
    422428
    423429            break;
    … …  
    425431        case Qt::Key_Up:
    426432        {
    427             if ( d_data->orientation == Qt::Vertical && d_data->inverted )
    428                 increment = -d_data->singleStep;
     433            if ( m_data->orientation == Qt::Vertical && m_data->inverted )
     434                increment = -m_data->singleStep;
    429435            else
    430                 increment = d_data->singleStep;
     436                increment = m_data->singleStep;
    431437
    432438            break;
    … …  
    434440        case Qt::Key_Left:
    435441        {
    436             if ( d_data->orientation == Qt::Horizontal )
     442            if ( m_data->orientation == Qt::Horizontal )
    437443            {
    438                 if ( d_data->inverted )
    439                     increment = d_data->singleStep;
     444                if ( m_data->inverted )
     445                    increment = m_data->singleStep;
    440446                else
    441                     increment = -d_data->singleStep;
     447                    increment = -m_data->singleStep;
    442448            }
    443449            break;
    … …  
    445451        case Qt::Key_Right:
    446452        {
    447             if ( d_data->orientation == Qt::Horizontal )
     453            if ( m_data->orientation == Qt::Horizontal )
    448454            {
    449                 if ( d_data->inverted )
    450                     increment = -d_data->singleStep;
     455                if ( m_data->inverted )
     456                    increment = -m_data->singleStep;
    451457                else
    452                     increment = d_data->singleStep;
     458                    increment = m_data->singleStep;
    453459            }
    454460            break;
    … …  
    456462        case Qt::Key_PageUp:
    457463        {
    458             increment = d_data->pageStepCount * d_data->singleStep;
     464            increment = m_data->pageStepCount * m_data->singleStep;
    459465            break;
    460466        }
    461467        case Qt::Key_PageDown:
    462468        {
    463             increment = -d_data->pageStepCount * d_data->singleStep;
     469            increment = -m_data->pageStepCount * m_data->singleStep;
    464470            break;
    465471        }
    466472        case Qt::Key_Home:
    467473        {
    468             value = d_data->minimum;
     474            value = m_data->minimum;
    469475            break;
    470476        }
    471477        case Qt::Key_End:
    472478        {
    473             value = d_data->maximum;
     479            value = m_data->maximum;
    474480            break;
    475481        }
    476482        default:;
    477         {
    478             event->ignore();
    479         }
     483            {
     484                event->ignore();
     485            }
    480486    }
    481487
    … …  
    485491    if ( increment != 0.0 )
    486492    {
    487         value = boundedValue( d_data->value + increment );
    488 
    489         if ( d_data->stepAlignment )
     493        value = boundedValue( m_data->value + increment );
     494
     495        if ( m_data->stepAlignment )
    490496            value = alignedValue( value );
    491497    }
    492498
    493     if ( value != d_data->value )
    494     {
    495         d_data->value = value;
     499    if ( value != m_data->value )
     500    {
     501        m_data->value = value;
    496502        update();
    497503
    498         Q_EMIT valueChanged( d_data->value );
    499         Q_EMIT wheelMoved( d_data->value );
    500     }
    501 }
    502 
    503 /*!
    504   \brief Adjust the number of grooves in the wheel's surface.
    505 
    506   The number of grooves is limited to 6 <= count <= 50.
    507   Values outside this range will be clipped.
    508   The default value is 10.
    509 
    510   \param count Number of grooves per 360 degrees
    511   \sa tickCount()
    512 */
     504        Q_EMIT valueChanged( m_data->value );
     505        Q_EMIT wheelMoved( m_data->value );
     506    }
     507}
     508
     509/*!
     510   \brief Adjust the number of grooves in the wheel's surface.
     511
     512   The number of grooves is limited to 6 <= count <= 50.
     513   Values outside this range will be clipped.
     514   The default value is 10.
     515
     516   \param count Number of grooves per 360 degrees
     517   \sa tickCount()
     518 */
    513519void QwtWheel::setTickCount( int count )
    514520{
    515521    count = qBound( 6, count, 50 );
    516522
    517     if ( count != d_data->tickCount )
    518     {
    519         d_data->tickCount = qBound( 6, count, 50 );
     523    if ( count != m_data->tickCount )
     524    {
     525        m_data->tickCount = qBound( 6, count, 50 );
    520526        update();
    521527    }
    … …  
    523529
    524530/*!
    525   \return Number of grooves in the wheel's surface.
    526   \sa setTickCnt()
    527 */
     531   \return Number of grooves in the wheel's surface.
     532   \sa setTickCnt()
     533 */
    528534int QwtWheel::tickCount() const
    529535{
    530     return d_data->tickCount;
    531 }
    532 
    533 /*!
    534   \brief Set the wheel border width of the wheel.
    535 
    536   The wheel border must not be smaller than 1
    537   and is limited in dependence on the wheel's size.
    538   Values outside the allowed range will be clipped.
    539 
    540   The wheel border defaults to 2.
    541 
    542   \param borderWidth Border width
    543   \sa internalBorder()
    544 */
     536    return m_data->tickCount;
     537}
     538
     539/*!
     540   \brief Set the wheel border width of the wheel.
     541
     542   The wheel border must not be smaller than 1
     543   and is limited in dependence on the wheel's size.
     544   Values outside the allowed range will be clipped.
     545
     546   The wheel border defaults to 2.
     547
     548   \param borderWidth Border width
     549   \sa internalBorder()
     550 */
    545551void QwtWheel::setWheelBorderWidth( int borderWidth )
    546552{
    547553    const int d = qMin( width(), height() ) / 3;
    548554    borderWidth = qMin( borderWidth, d );
    549     d_data->wheelBorderWidth = qMax( borderWidth, 1 );
     555    m_data->wheelBorderWidth = qMax( borderWidth, 1 );
    550556    update();
    551557}
    … …  
    554560   \return Wheel border width
    555561   \sa setWheelBorderWidth()
    556 */
     562 */
    557563int QwtWheel::wheelBorderWidth() const
    558564{
    559     return d_data->wheelBorderWidth;
    560 }
    561 
    562 /*!
    563   \brief Set the border width
    564 
    565   The border defaults to 2.
    566 
    567   \param width Border width
    568   \sa borderWidth()
    569 */
     565    return m_data->wheelBorderWidth;
     566}
     567
     568/*!
     569   \brief Set the border width
     570
     571   The border defaults to 2.
     572
     573   \param width Border width
     574   \sa borderWidth()
     575 */
    570576void QwtWheel::setBorderWidth( int width )
    571577{
    572     d_data->borderWidth = qMax( width, 0 );
     578    m_data->borderWidth = qMax( width, 0 );
    573579    update();
    574580}
    … …  
    577583   \return Border width
    578584   \sa setBorderWidth()
    579 */
     585 */
    580586int QwtWheel::borderWidth() const
    581587{
    582     return d_data->borderWidth;
     588    return m_data->borderWidth;
    583589}
    584590
    585591/*!
    586592   \return Rectangle of the wheel without the outer border
    587 */
     593 */
    588594QRect QwtWheel::wheelRect() const
    589595{
    590     const int bw = d_data->borderWidth;
     596    const int bw = m_data->borderWidth;
    591597    return contentsRect().adjusted( bw, bw, -bw, -bw );
    592598}
    593599
    594600/*!
    595   \brief Set the total angle which the wheel can be turned.
    596 
    597   One full turn of the wheel corresponds to an angle of
    598   360 degrees. A total angle of n*360 degrees means
    599   that the wheel has to be turned n times around its axis
    600   to get from the minimum value to the maximum value.
    601 
    602   The default setting of the total angle is 360 degrees.
    603 
    604   \param angle total angle in degrees
    605   \sa totalAngle()
    606 */
     601   \brief Set the total angle which the wheel can be turned.
     602
     603   One full turn of the wheel corresponds to an angle of
     604   360 degrees. A total angle of n*360 degrees means
     605   that the wheel has to be turned n times around its axis
     606   to get from the minimum value to the maximum value.
     607
     608   The default setting of the total angle is 360 degrees.
     609
     610   \param angle total angle in degrees
     611   \sa totalAngle()
     612 */
    607613void QwtWheel::setTotalAngle( double angle )
    608614{
    … …  
    610616        angle = 0.0;
    611617
    612     d_data->totalAngle = angle;
     618    m_data->totalAngle = angle;
    613619    update();
    614620}
    615621
    616622/*!
    617   \return Total angle which the wheel can be turned.
    618   \sa setTotalAngle()
    619 */
     623   \return Total angle which the wheel can be turned.
     624   \sa setTotalAngle()
     625 */
    620626double QwtWheel::totalAngle() const
    621627{
    622     return d_data->totalAngle;
    623 }
    624 
    625 /*!
    626   \brief Set the wheel's orientation.
    627 
    628   The default orientation is Qt::Horizontal.
    629 
    630   \param orientation Qt::Horizontal or Qt::Vertical.
    631   \sa orientation()
    632 */
     628    return m_data->totalAngle;
     629}
     630
     631/*!
     632   \brief Set the wheel's orientation.
     633
     634   The default orientation is Qt::Horizontal.
     635
     636   \param orientation Qt::Horizontal or Qt::Vertical.
     637   \sa orientation()
     638 */
    633639void QwtWheel::setOrientation( Qt::Orientation orientation )
    634640{
    635     if ( d_data->orientation == orientation )
     641    if ( m_data->orientation == orientation )
    636642        return;
    637643
    … …  
    645651    }
    646652
    647     d_data->orientation = orientation;
     653    m_data->orientation = orientation;
    648654    update();
    649655}
    650656
    651657/*!
    652   \return Orientation
    653   \sa setOrientation()
    654 */
     658   \return Orientation
     659   \sa setOrientation()
     660 */
    655661Qt::Orientation QwtWheel::orientation() const
    656662{
    657     return d_data->orientation;
    658 }
    659 
    660 /*!
    661   \brief Specify the visible portion of the wheel.
    662 
    663   You may use this function for fine-tuning the appearance of
    664   the wheel. The default value is 175 degrees. The value is
    665   limited from 10 to 175 degrees.
    666 
    667   \param angle Visible angle in degrees
    668   \sa viewAngle(), setTotalAngle()
    669 */
     663    return m_data->orientation;
     664}
     665
     666/*!
     667   \brief Specify the visible portion of the wheel.
     668
     669   You may use this function for fine-tuning the appearance of
     670   the wheel. The default value is 175 degrees. The value is
     671   limited from 10 to 175 degrees.
     672
     673   \param angle Visible angle in degrees
     674   \sa viewAngle(), setTotalAngle()
     675 */
    670676void QwtWheel::setViewAngle( double angle )
    671677{
    672     d_data->viewAngle = qBound( 10.0, angle, 175.0 );
     678    m_data->viewAngle = qBound( 10.0, angle, 175.0 );
    673679    update();
    674680}
    675681
    676682/*!
    677   \return Visible portion of the wheel
    678   \sa setViewAngle(), totalAngle()
    679 */
     683   \return Visible portion of the wheel
     684   \sa setViewAngle(), totalAngle()
     685 */
    680686double QwtWheel::viewAngle() const
    681687{
    682     return d_data->viewAngle;
    683 }
    684 
    685 /*!
    686   Determine the value corresponding to a specified point
    687 
    688   \param pos Position
    689   \return Value corresponding to pos
    690 */
    691 double QwtWheel::valueAt( const QPoint &pos ) const
     688    return m_data->viewAngle;
     689}
     690
     691/*!
     692   Determine the value corresponding to a specified point
     693
     694   \param pos Position
     695   \return Value corresponding to pos
     696 */
     697double QwtWheel::valueAt( const QPoint& pos ) const
    692698{
    693699    const QRectF rect = wheelRect();
    694700
    695701    double w, dx;
    696     if ( d_data->orientation == Qt::Vertical )
     702    if ( m_data->orientation == Qt::Vertical )
    697703    {
    698704        w = rect.height();
    … …  
    708714        return 0.0;
    709715
    710     if ( d_data->inverted )
     716    if ( m_data->inverted )
    711717    {
    712718        dx = w - dx;
    … …  
    715721    // w pixels is an arc of viewAngle degrees,
    716722    // so we convert change in pixels to change in angle
    717     const double ang = dx * d_data->viewAngle / w;
     723    const double ang = dx * m_data->viewAngle / w;
    718724
    719725    // value range maps to totalAngle degrees,
    720726    // so convert the change in angle to a change in value
    721     const double val = ang * ( maximum() - minimum() ) / d_data->totalAngle;
     727    const double val = ang * ( maximum() - minimum() ) / m_data->totalAngle;
    722728
    723729    return val;
    … …  
    727733   \brief Qt Paint Event
    728734   \param event Paint event
    729 */
    730 void QwtWheel::paintEvent( QPaintEvent *event )
     735 */
     736void QwtWheel::paintEvent( QPaintEvent* event )
    731737{
    732738    QPainter painter( this );
    … …  
    734740
    735741    QStyleOption opt;
    736     opt.init(this);
     742    opt.initFrom(this);
    737743    style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
    738744
    739745    qDrawShadePanel( &painter,
    740         contentsRect(), palette(), true, d_data->borderWidth );
     746        contentsRect(), palette(), true, m_data->borderWidth );
    741747
    742748    drawWheelBackground( &painter, wheelRect() );
    … …  
    752758   \param painter Painter
    753759   \param rect Geometry for the wheel
    754 */
     760 */
    755761void QwtWheel::drawWheelBackground(
    756     QPainter *painter, const QRectF &rect )
     762    QPainter* painter, const QRectF& rect )
    757763{
    758764    painter->save();
    … …  
    762768    //  draw shaded background
    763769    QLinearGradient gradient( rect.topLeft(),
    764         ( d_data->orientation == Qt::Horizontal ) ? rect.topRight() : rect.bottomLeft() );
     770        ( m_data->orientation == Qt::Horizontal ) ? rect.topRight() : rect.bottomLeft() );
    765771    gradient.setColorAt( 0.0, pal.color( QPalette::Button ) );
    766772    gradient.setColorAt( 0.2, pal.color( QPalette::Midlight ) );
    … …  
    773779
    774780    const QPen lightPen( palette().color( QPalette::Light ),
    775         d_data->wheelBorderWidth, Qt::SolidLine, Qt::FlatCap );
     781        m_data->wheelBorderWidth, Qt::SolidLine, Qt::FlatCap );
    776782    const QPen darkPen( pal.color( QPalette::Dark ),
    777         d_data->wheelBorderWidth, Qt::SolidLine, Qt::FlatCap );
    778 
    779     const double bw2 = 0.5 * d_data->wheelBorderWidth;
    780 
    781     if ( d_data->orientation == Qt::Horizontal )
     783        m_data->wheelBorderWidth, Qt::SolidLine, Qt::FlatCap );
     784
     785    const double bw2 = 0.5 * m_data->wheelBorderWidth;
     786
     787    if ( m_data->orientation == Qt::Horizontal )
    782788    {
    783789        painter->setPen( lightPen );
    … …  
    808814   \param painter Painter
    809815   \param rect Geometry for the wheel
    810 */
    811 void QwtWheel::drawTicks( QPainter *painter, const QRectF &rect )
    812 {
    813     const double range = d_data->maximum - d_data->minimum;
    814 
    815     if ( range == 0.0 || d_data->totalAngle == 0.0 )
     816 */
     817void QwtWheel::drawTicks( QPainter* painter, const QRectF& rect )
     818{
     819    const double range = m_data->maximum - m_data->minimum;
     820
     821    if ( range == 0.0 || m_data->totalAngle == 0.0 )
    816822    {
    817823        return;
    … …  
    823829        0, Qt::SolidLine, Qt::FlatCap );
    824830
    825     const double cnvFactor = qAbs( d_data->totalAngle / range );
    826     const double halfIntv = 0.5 * d_data->viewAngle / cnvFactor;
     831    const double cnvFactor = qAbs( m_data->totalAngle / range );
     832    const double halfIntv = 0.5 * m_data->viewAngle / cnvFactor;
    827833    const double loValue = value() - halfIntv;
    828834    const double hiValue = value() + halfIntv;
    829     const double tickWidth = 360.0 / double( d_data->tickCount ) / cnvFactor;
    830     const double sinArc = qFastSin( d_data->viewAngle * M_PI / 360.0 );
    831 
    832     if ( d_data->orientation == Qt::Horizontal )
     835    const double tickWidth = 360.0 / double( m_data->tickCount ) / cnvFactor;
     836    const double sinArc = qFastSin( m_data->viewAngle * M_PI / 360.0 );
     837
     838    if ( m_data->orientation == Qt::Horizontal )
    833839    {
    834840        const double radius = rect.width() * 0.5;
    835841
    836         double l1 = rect.top() + d_data->wheelBorderWidth;
    837         double l2 = rect.bottom() - d_data->wheelBorderWidth - 1;
     842        double l1 = rect.top() + m_data->wheelBorderWidth;
     843        double l2 = rect.bottom() - m_data->wheelBorderWidth - 1;
    838844
    839845        // draw one point over the border if border > 1
    840         if ( d_data->wheelBorderWidth > 1 )
     846        if ( m_data->wheelBorderWidth > 1 )
    841847        {
    842848            l1--;
    … …  
    848854
    849855        // draw tick marks
    850         for ( double tickValue = ::ceil( loValue / tickWidth ) * tickWidth;
     856        for ( double tickValue = std::ceil( loValue / tickWidth ) * tickWidth;
    851857            tickValue < hiValue; tickValue += tickWidth )
    852858        {
    … …  
    857863
    858864            double tickPos;
    859             if ( d_data->inverted )
     865            if ( m_data->inverted )
    860866                tickPos = rect.left() + off;
    861867            else
    … …  
    865871            {
    866872                painter->setPen( darkPen );
    867                 painter->drawLine( QPointF( tickPos - 1 , l1 ),
     873                painter->drawLine( QPointF( tickPos - 1, l1 ),
    868874                    QPointF( tickPos - 1,  l2 ) );
    869875                painter->setPen( lightPen );
    … …  
    877883        const double radius = rect.height() * 0.5;
    878884
    879         double l1 = rect.left() + d_data->wheelBorderWidth;
    880         double l2 = rect.right() - d_data->wheelBorderWidth - 1;
    881 
    882         if ( d_data->wheelBorderWidth > 1 )
     885        double l1 = rect.left() + m_data->wheelBorderWidth;
     886        double l2 = rect.right() - m_data->wheelBorderWidth - 1;
     887
     888        if ( m_data->wheelBorderWidth > 1 )
    883889        {
    884890            l1--;
    … …  
    889895        const double minpos = rect.top() + 2;
    890896
    891         for ( double tickValue = ::ceil( loValue / tickWidth ) * tickWidth;
     897        for ( double tickValue = std::ceil( loValue / tickWidth ) * tickWidth;
    892898            tickValue < hiValue; tickValue += tickWidth )
    893899        {
    … …  
    899905            double tickPos;
    900906
    901             if ( d_data->inverted )
     907            if ( m_data->inverted )
    902908                tickPos = rect.bottom() - off;
    903909            else
    … …  
    918924
    919925/*!
    920   \brief Set the width of the wheel
    921 
    922   Corresponds to the wheel height for horizontal orientation,
    923   and the wheel width for vertical orientation.
    924 
    925   \param width the wheel's width
    926   \sa wheelWidth()
    927 */
     926   \brief Set the width of the wheel
     927
     928   Corresponds to the wheel height for horizontal orientation,
     929   and the wheel width for vertical orientation.
     930
     931   \param width the wheel's width
     932   \sa wheelWidth()
     933 */
    928934void QwtWheel::setWheelWidth( int width )
    929935{
    930     d_data->wheelWidth = width;
     936    m_data->wheelWidth = width;
    931937    update();
    932938}
    933939
    934940/*!
    935   \return Width of the wheel
    936   \sa setWheelWidth()
    937 */
     941   \return Width of the wheel
     942   \sa setWheelWidth()
     943 */
    938944int QwtWheel::wheelWidth() const
    939945{
    940     return d_data->wheelWidth;
    941 }
    942 
    943 /*!
    944   \return a size hint
    945 */
     946    return m_data->wheelWidth;
     947}
     948
     949/*!
     950   \return a size hint
     951 */
    946952QSize QwtWheel::sizeHint() const
    947953{
    948954    const QSize hint = minimumSizeHint();
    949     return hint.expandedTo( QApplication::globalStrut() );
    950 }
    951 
    952 /*!
    953   \return Minimum size hint
    954   \warning The return value is based on the wheel width.
    955 */
     955    return qwtExpandedToGlobalStrut( hint );
     956}
     957
     958/*!
     959   \return Minimum size hint
     960   \warning The return value is based on the wheel width.
     961 */
    956962QSize QwtWheel::minimumSizeHint() const
    957963{
    958     QSize sz( 3 * d_data->wheelWidth + 2 * d_data->borderWidth,
    959         d_data->wheelWidth + 2 * d_data->borderWidth );
    960     if ( d_data->orientation != Qt::Horizontal )
     964    QSize sz( 3 * m_data->wheelWidth + 2 * m_data->borderWidth,
     965        m_data->wheelWidth + 2 * m_data->borderWidth );
     966    if ( m_data->orientation != Qt::Horizontal )
    961967        sz.transpose();
    962968
    … …  
    965971
    966972/*!
    967   \brief Set the step size of the counter
    968 
    969   A value <= 0.0 disables stepping
    970 
    971   \param stepSize Single step size
    972   \sa singleStep(), setPageStepCount()
    973 */
     973   \brief Set the step size of the counter
     974
     975   A value <= 0.0 disables stepping
     976
     977   \param stepSize Single step size
     978   \sa singleStep(), setPageStepCount()
     979 */
    974980void QwtWheel::setSingleStep( double stepSize )
    975981{
    976     d_data->singleStep = qMax( stepSize, 0.0 );
    977 }
    978 
    979 /*!
    980   \return Single step size
    981   \sa setSingleStep()
     982    m_data->singleStep = qwtMaxF( stepSize, 0.0 );
     983}
     984
     985/*!
     986   \return Single step size
     987   \sa setSingleStep()
    982988 */
    983989double QwtWheel::singleStep() const
    984990{
    985     return d_data->singleStep;
    986 }
    987 
    988 /*!
    989   \brief En/Disable step alignment
    990 
    991   When step alignment is enabled value changes initiated by
    992   user input ( mouse, keyboard, wheel ) are aligned to
    993   the multiples of the single step.
    994 
    995   \param on On/Off
    996   \sa stepAlignment(), setSingleStep()
     991    return m_data->singleStep;
     992}
     993
     994/*!
     995   \brief En/Disable step alignment
     996
     997   When step alignment is enabled value changes initiated by
     998   user input ( mouse, keyboard, wheel ) are aligned to
     999   the multiples of the single step.
     1000
     1001   \param on On/Off
     1002   \sa stepAlignment(), setSingleStep()
    9971003 */
    9981004void QwtWheel::setStepAlignment( bool on )
    9991005{
    1000     if ( on != d_data->stepAlignment )
    1001     {
    1002         d_data->stepAlignment = on;
    1003     }
    1004 }
    1005 
    1006 /*!
    1007   \return True, when the step alignment is enabled
    1008   \sa setStepAlignment(), singleStep()
     1006    if ( on != m_data->stepAlignment )
     1007    {
     1008        m_data->stepAlignment = on;
     1009    }
     1010}
     1011
     1012/*!
     1013   \return True, when the step alignment is enabled
     1014   \sa setStepAlignment(), singleStep()
    10091015 */
    10101016bool QwtWheel::stepAlignment() const
    10111017{
    1012     return d_data->stepAlignment;
    1013 }
    1014 
    1015 /*!
    1016   \brief Set the page step count
    1017 
    1018   pageStepCount is a multiplicator for the single step size
    1019   that typically corresponds to the user pressing PageUp or PageDown.
    1020 
    1021   A value of 0 disables page stepping.
    1022 
    1023   The default value is 1.
    1024 
    1025   \param count Multiplicator for the single step size
    1026   \sa pageStepCount(), setSingleStep()
     1018    return m_data->stepAlignment;
     1019}
     1020
     1021/*!
     1022   \brief Set the page step count
     1023
     1024   pageStepCount is a multiplicator for the single step size
     1025   that typically corresponds to the user pressing PageUp or PageDown.
     1026
     1027   A value of 0 disables page stepping.
     1028
     1029   The default value is 1.
     1030
     1031   \param count Multiplicator for the single step size
     1032   \sa pageStepCount(), setSingleStep()
    10271033 */
    10281034void QwtWheel::setPageStepCount( int count )
    10291035{
    1030     d_data->pageStepCount = qMax( 0, count );
    1031 }
    1032 
    1033 /*!
    1034   \return Page step count
    1035   \sa setPageStepCount(), singleStep()
     1036    m_data->pageStepCount = qMax( 0, count );
     1037}
     1038
     1039/*!
     1040   \return Page step count
     1041   \sa setPageStepCount(), singleStep()
    10361042 */
    10371043int QwtWheel::pageStepCount() const
    10381044{
    1039     return d_data->pageStepCount;
    1040 }
    1041 
    1042 /*!
    1043   \brief Set the minimum and maximum values
    1044 
    1045   The maximum is adjusted if necessary to ensure that the range remains valid.
    1046   The value might be modified to be inside of the range.
    1047 
    1048   \param min Minimum value
    1049   \param max Maximum value
    1050 
    1051   \sa minimum(), maximum()
     1045    return m_data->pageStepCount;
     1046}
     1047
     1048/*!
     1049   \brief Set the minimum and maximum values
     1050
     1051   The maximum is adjusted if necessary to ensure that the range remains valid.
     1052   The value might be modified to be inside of the range.
     1053
     1054   \param min Minimum value
     1055   \param max Maximum value
     1056
     1057   \sa minimum(), maximum()
    10521058 */
    10531059void QwtWheel::setRange( double min, double max )
    10541060{
    1055     max = qMax( min, max );
    1056 
    1057     if ( d_data->minimum == min && d_data->maximum == max )
     1061    max = qwtMaxF( min, max );
     1062
     1063    if ( m_data->minimum == min && m_data->maximum == max )
    10581064        return;
    10591065
    1060     d_data->minimum = min;
    1061     d_data->maximum = max;
    1062 
    1063     if ( d_data->value < min || d_data->value > max )
    1064     {
    1065         d_data->value = qBound( min, d_data->value, max );
     1066    m_data->minimum = min;
     1067    m_data->maximum = max;
     1068
     1069    if ( m_data->value < min || m_data->value > max )
     1070    {
     1071        m_data->value = qBound( min, m_data->value, max );
    10661072
    10671073        update();
    1068         Q_EMIT valueChanged( d_data->value );
    1069     }
    1070 }
    1071 /*!
    1072   Set the minimum value of the range
    1073 
    1074   \param value Minimum value
    1075   \sa setRange(), setMaximum(), minimum()
    1076 
    1077   \note The maximum is adjusted if necessary to ensure that the range remains valid.
    1078 */
     1074        Q_EMIT valueChanged( m_data->value );
     1075    }
     1076}
     1077/*!
     1078   Set the minimum value of the range
     1079
     1080   \param value Minimum value
     1081   \sa setRange(), setMaximum(), minimum()
     1082
     1083   \note The maximum is adjusted if necessary to ensure that the range remains valid.
     1084 */
    10791085void QwtWheel::setMinimum( double value )
    10801086{
    … …  
    10831089
    10841090/*!
    1085   \return The minimum of the range
    1086   \sa setRange(), setMinimum(), maximum()
    1087 */
     1091   \return The minimum of the range
     1092   \sa setRange(), setMinimum(), maximum()
     1093 */
    10881094double QwtWheel::minimum() const
    10891095{
    1090     return d_data->minimum;
    1091 }
    1092 
    1093 /*!
    1094   Set the maximum value of the range
    1095 
    1096   \param value Maximum value
    1097   \sa setRange(), setMinimum(), maximum()
    1098 */
     1096    return m_data->minimum;
     1097}
     1098
     1099/*!
     1100   Set the maximum value of the range
     1101
     1102   \param value Maximum value
     1103   \sa setRange(), setMinimum(), maximum()
     1104 */
    10991105void QwtWheel::setMaximum( double value )
    11001106{
    … …  
    11031109
    11041110/*!
    1105   \return The maximum of the range
    1106   \sa setRange(), setMaximum(), minimum()
    1107 */
     1111   \return The maximum of the range
     1112   \sa setRange(), setMaximum(), minimum()
     1113 */
    11081114double QwtWheel::maximum() const
    11091115{
    1110     return d_data->maximum;
    1111 }
    1112 
    1113 /*!
    1114   \brief Set a new value without adjusting to the step raster
    1115 
    1116   \param value New value
    1117 
    1118   \sa value(), valueChanged()
    1119   \warning The value is clipped when it lies outside the range.
    1120 */
     1116    return m_data->maximum;
     1117}
     1118
     1119/*!
     1120   \brief Set a new value without adjusting to the step raster
     1121
     1122   \param value New value
     1123
     1124   \sa value(), valueChanged()
     1125   \warning The value is clipped when it lies outside the range.
     1126 */
    11211127void QwtWheel::setValue( double value )
    11221128{
    11231129    stopFlying();
    1124     d_data->isScrolling = false;
    1125 
    1126     value = qBound( d_data->minimum, value, d_data->maximum );
    1127 
    1128     if ( d_data->value != value )
    1129     {
    1130         d_data->value = value;
     1130    m_data->isScrolling = false;
     1131
     1132    value = qBound( m_data->minimum, value, m_data->maximum );
     1133
     1134    if ( m_data->value != value )
     1135    {
     1136        m_data->value = value;
    11311137
    11321138        update();
    1133         Q_EMIT valueChanged( d_data->value );
    1134     }
    1135 }
    1136 
    1137 /*!
    1138   \return Current value of the wheel
    1139   \sa setValue(), valueChanged()
     1139        Q_EMIT valueChanged( m_data->value );
     1140    }
     1141}
     1142
     1143/*!
     1144   \return Current value of the wheel
     1145   \sa setValue(), valueChanged()
    11401146 */
    11411147double QwtWheel::value() const
    11421148{
    1143     return d_data->value;
    1144 }
    1145 
    1146 /*!
    1147   \brief En/Disable inverted appearance
    1148 
    1149   An inverted wheel increases its values in the opposite direction.
    1150   The direction of an inverted horizontal wheel will be from right to left
    1151   an inverted vertical wheel will increase from bottom to top.
    1152 
    1153   \param on En/Disable inverted appearance
    1154   \sa isInverted()
     1149    return m_data->value;
     1150}
     1151
     1152/*!
     1153   \brief En/Disable inverted appearance
     1154
     1155   An inverted wheel increases its values in the opposite direction.
     1156   The direction of an inverted horizontal wheel will be from right to left
     1157   an inverted vertical wheel will increase from bottom to top.
     1158
     1159   \param on En/Disable inverted appearance
     1160   \sa isInverted()
    11551161
    11561162 */
    11571163void QwtWheel::setInverted( bool on )
    11581164{
    1159     if ( d_data->inverted != on )
    1160     {
    1161         d_data->inverted = on;
     1165    if ( m_data->inverted != on )
     1166    {
     1167        m_data->inverted = on;
    11621168        update();
    11631169    }
    … …  
    11651171
    11661172/*!
    1167   \return True, when the wheel is inverted
    1168   \sa setInverted()
     1173   \return True, when the wheel is inverted
     1174   \sa setInverted()
    11691175 */
    11701176bool QwtWheel::isInverted() const
    11711177{
    1172     return d_data->inverted;
    1173 }
    1174 
    1175 /*!
    1176   \brief En/Disable wrapping
    1177 
    1178   If wrapping is true stepping up from maximum() value will take
    1179   you to the minimum() value and vice versa.
    1180 
    1181   \param on En/Disable wrapping
    1182   \sa wrapping()
     1178    return m_data->inverted;
     1179}
     1180
     1181/*!
     1182   \brief En/Disable wrapping
     1183
     1184   If wrapping is true stepping up from maximum() value will take
     1185   you to the minimum() value and vice versa.
     1186
     1187   \param on En/Disable wrapping
     1188   \sa wrapping()
    11831189 */
    11841190void QwtWheel::setWrapping( bool on )
    11851191{
    1186     d_data->wrapping = on;
    1187 }
    1188 
    1189 /*!
    1190   \return True, when wrapping is set
    1191   \sa setWrapping()
     1192    m_data->wrapping = on;
     1193}
     1194
     1195/*!
     1196   \return True, when wrapping is set
     1197   \sa setWrapping()
    11921198 */
    11931199bool QwtWheel::wrapping() const
    11941200{
    1195     return d_data->wrapping;
    1196 }
    1197 
    1198 /*!
    1199   \brief Set the slider's mass for flywheel effect.
    1200 
    1201   If the slider's mass is greater then 0, it will continue
    1202   to move after the mouse button has been released. Its speed
    1203   decreases with time at a rate depending on the slider's mass.
    1204   A large mass means that it will continue to move for a
    1205   long time.
    1206 
    1207   Derived widgets may overload this function to make it public.
    1208 
    1209   \param mass New mass in kg
    1210 
    1211   \bug If the mass is smaller than 1g, it is set to zero.
     1201    return m_data->wrapping;
     1202}
     1203
     1204/*!
     1205   \brief Set the slider's mass for flywheel effect.
     1206
     1207   If the slider's mass is greater then 0, it will continue
     1208   to move after the mouse button has been released. Its speed
     1209   decreases with time at a rate depending on the slider's mass.
     1210   A large mass means that it will continue to move for a
     1211   long time.
     1212
     1213   Derived widgets may overload this function to make it public.
     1214
     1215   \param mass New mass in kg
     1216
     1217   \bug If the mass is smaller than 1g, it is set to zero.
    12121218       The maximal mass is limited to 100kg.
    1213   \sa mass()
    1214 */
     1219   \sa mass()
     1220 */
    12151221void QwtWheel::setMass( double mass )
    12161222{
    12171223    if ( mass < 0.001 )
    12181224    {
    1219         d_data->mass = 0.0;
     1225        m_data->mass = 0.0;
    12201226    }
    12211227    else
    12221228    {
    1223         d_data->mass = qMin( 100.0, mass );
    1224     }
    1225 
    1226     if ( d_data->mass <= 0.0 )
     1229        m_data->mass = qwtMinF( 100.0, mass );
     1230    }
     1231
     1232    if ( m_data->mass <= 0.0 )
    12271233        stopFlying();
    12281234}
    12291235
    12301236/*!
    1231   \return mass
    1232   \sa setMass()
    1233 */
     1237   \return mass
     1238   \sa setMass()
     1239 */
    12341240double QwtWheel::mass() const
    12351241{
    1236     return d_data->mass;
     1242    return m_data->mass;
    12371243}
    12381244
    … …  
    12401246void QwtWheel::stopFlying()
    12411247{
    1242     if ( d_data->timerId != 0 )
    1243     {
    1244         killTimer( d_data->timerId );
    1245         d_data->timerId = 0;
    1246         d_data->speed = 0.0;
     1248    if ( m_data->timerId != 0 )
     1249    {
     1250        killTimer( m_data->timerId );
     1251        m_data->timerId = 0;
     1252        m_data->speed = 0.0;
    12471253    }
    12481254}
    … …  
    12501256double QwtWheel::boundedValue( double value ) const
    12511257{
    1252     const double range = d_data->maximum - d_data->minimum;
    1253 
    1254     if ( d_data->wrapping && range >= 0.0 )
    1255     {
    1256         if ( value < d_data->minimum )
    1257         {
    1258             value += ::ceil( ( d_data->minimum - value ) / range ) * range;
    1259         }
    1260         else if ( value > d_data->maximum )
    1261         {
    1262             value -= ::ceil( ( value - d_data->maximum ) / range ) * range;
     1258    const double range = m_data->maximum - m_data->minimum;
     1259
     1260    if ( m_data->wrapping && range >= 0.0 )
     1261    {
     1262        if ( value < m_data->minimum )
     1263        {
     1264            value += std::ceil( ( m_data->minimum - value ) / range ) * range;
     1265        }
     1266        else if ( value > m_data->maximum )
     1267        {
     1268            value -= std::ceil( ( value - m_data->maximum ) / range ) * range;
    12631269        }
    12641270    }
    12651271    else
    12661272    {
    1267         value = qBound( d_data->minimum, value, d_data->maximum );
     1273        value = qBound( m_data->minimum, value, m_data->maximum );
    12681274    }
    12691275
    … …  
    12731279double QwtWheel::alignedValue( double value ) const
    12741280{
    1275     const double stepSize = d_data->singleStep;
     1281    const double stepSize = m_data->singleStep;
    12761282
    12771283    if ( stepSize > 0.0 )
    12781284    {
    1279         value = d_data->minimum +
    1280             qRound( ( value - d_data->minimum ) / stepSize ) * stepSize;
     1285        value = m_data->minimum +
     1286            qRound( ( value - m_data->minimum ) / stepSize ) * stepSize;
    12811287
    12821288        if ( stepSize > 1e-12 )
    … …  
    12871293                value = 0.0;
    12881294            }
    1289             else if ( qFuzzyCompare( value, d_data->maximum ) )
     1295            else if ( qFuzzyCompare( value, m_data->maximum ) )
    12901296            {
    12911297                // correct rounding error at the border
    1292                 value = d_data->maximum;
     1298                value = m_data->maximum;
    12931299            }
    12941300        }
    … …  
    12981304}
    12991305
     1306#include "moc_qwt_wheel.cpp"
Note: See TracChangeset for help on using the changeset viewer.