Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_knob.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_knob.cpp

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    1010#include "qwt_knob.h"
    1111#include "qwt_round_scale_draw.h"
    12 #include "qwt_math.h"
    1312#include "qwt_painter.h"
    1413#include "qwt_scale_map.h"
     14#include "qwt_math.h"
     15#include "qwt.h"
     16
    1517#include <qpainter.h>
    1618#include <qpalette.h>
    … …  
    1820#include <qstyleoption.h>
    1921#include <qevent.h>
     22#include <qmargins.h>
    2023#include <qmath.h>
    21 #include <qapplication.h>
    22 
    23 #if QT_VERSION < 0x040601
    24 #define qAtan2(y, x) ::atan2(y, x)
    25 #define qFabs(x) ::fabs(x)
    26 #define qFastCos(x) qCos(x)
    27 #define qFastSin(x) qSin(x)
    28 #endif
    29 
    30 static QSize qwtKnobSizeHint( const QwtKnob *knob, int min )
     24
     25static QSize qwtKnobSizeHint( const QwtKnob* knob, int min )
    3126{
    3227    int knobWidth = knob->knobWidth();
    … …  
    3530
    3631    // Add the scale radial thickness to the knobWidth
    37     const int extent = qCeil( knob->scaleDraw()->extent( knob->font() ) );
     32    const int extent = qwtCeil( knob->scaleDraw()->extent( knob->font() ) );
    3833    const int d = 2 * ( extent + 4 ) + knobWidth;
    3934
    40     int left, right, top, bottom;
    41     knob->getContentsMargins( &left, &top, &right, &bottom );
    42 
    43     return QSize( d + left + right, d + top + bottom );
     35    const QMargins m = knob->contentsMargins();
     36    return QSize( d + m.left() + m.right(), d + m.top() + m.bottom() );
    4437}
    4538
    … …  
    6558class QwtKnob::PrivateData
    6659{
    67 public:
    68     PrivateData():
    69         knobStyle( QwtKnob::Raised ),
    70         markerStyle( QwtKnob::Notch ),
    71         borderWidth( 2 ),
    72         borderDist( 4 ),
    73         scaleDist( 4 ),
    74         maxScaleTicks( 11 ),
    75         knobWidth( 0 ),
    76         alignment( Qt::AlignCenter ),
    77         markerSize( 8 ),
    78         totalAngle( 270.0 ),
    79         mouseOffset( 0.0 )
     60  public:
     61    PrivateData()
     62        : knobStyle( QwtKnob::Raised )
     63        , markerStyle( QwtKnob::Notch )
     64        , borderWidth( 2 )
     65        , borderDist( 4 )
     66        , scaleDist( 4 )
     67        , maxScaleTicks( 11 )
     68        , knobWidth( 0 )
     69        , alignment( Qt::AlignCenter )
     70        , markerSize( 8 )
     71        , totalAngle( 270.0 )
     72        , mouseOffset( 0.0 )
    8073    {
    8174    }
    … …  
    9891
    9992/*!
    100   \brief Constructor
    101 
    102   Construct a knob with an angle of 270°. The style is
    103   QwtKnob::Raised and the marker style is QwtKnob::Notch.
    104   The width of the knob is set to 50 pixels.
    105 
    106   \param parent Parent widget
    107 
    108   \sa setTotalAngle()
    109 */
    110 QwtKnob::QwtKnob( QWidget* parent ):
    111     QwtAbstractSlider( parent )
    112 {
    113     d_data = new PrivateData;
     93   \brief Constructor
     94
     95   Construct a knob with an angle of 270°. The style is
     96   QwtKnob::Raised and the marker style is QwtKnob::Notch.
     97   The width of the knob is set to 50 pixels.
     98
     99   \param parent Parent widget
     100
     101   \sa setTotalAngle()
     102 */
     103QwtKnob::QwtKnob( QWidget* parent )
     104    : QwtAbstractSlider( parent )
     105{
     106    m_data = new PrivateData;
    114107
    115108    setScaleDraw( new QwtRoundScaleDraw() );
    … …  
    127120QwtKnob::~QwtKnob()
    128121{
    129     delete d_data;
    130 }
    131 
    132 /*!
    133   \brief Set the knob type
    134 
    135   \param knobStyle Knob type
    136   \sa knobStyle(), setBorderWidth()
    137 */
     122    delete m_data;
     123}
     124
     125/*!
     126   \brief Set the knob type
     127
     128   \param knobStyle Knob type
     129   \sa knobStyle(), setBorderWidth()
     130 */
    138131void QwtKnob::setKnobStyle( KnobStyle knobStyle )
    139132{
    140     if ( d_data->knobStyle != knobStyle )
    141     {
    142         d_data->knobStyle = knobStyle;
     133    if ( m_data->knobStyle != knobStyle )
     134    {
     135        m_data->knobStyle = knobStyle;
    143136        update();
    144137    }
    … …  
    148141    \return Marker type of the knob
    149142    \sa setKnobStyle(), setBorderWidth()
    150 */
     143 */
    151144QwtKnob::KnobStyle QwtKnob::knobStyle() const
    152145{
    153     return d_data->knobStyle;
    154 }
    155 
    156 /*!
    157   \brief Set the marker type of the knob
    158 
    159   \param markerStyle Marker type
    160   \sa markerStyle(), setMarkerSize()
    161 */
     146    return m_data->knobStyle;
     147}
     148
     149/*!
     150   \brief Set the marker type of the knob
     151
     152   \param markerStyle Marker type
     153   \sa markerStyle(), setMarkerSize()
     154 */
    162155void QwtKnob::setMarkerStyle( MarkerStyle markerStyle )
    163156{
    164     if ( d_data->markerStyle != markerStyle )
    165     {
    166         d_data->markerStyle = markerStyle;
     157    if ( m_data->markerStyle != markerStyle )
     158    {
     159        m_data->markerStyle = markerStyle;
    167160        update();
    168161    }
    … …  
    170163
    171164/*!
    172   \return Marker type of the knob
    173   \sa setMarkerStyle(), setMarkerSize()
    174 */
     165   \return Marker type of the knob
     166   \sa setMarkerStyle(), setMarkerSize()
     167 */
    175168QwtKnob::MarkerStyle QwtKnob::markerStyle() const
    176169{
    177     return d_data->markerStyle;
    178 }
    179 
    180 /*!
    181   \brief Set the total angle by which the knob can be turned
    182   \param angle Angle in degrees.
    183 
    184   The angle has to be between [10, 360] degrees. Angles above
    185   360 ( so that the knob can be turned several times around its axis )
    186   have to be set using setNumTurns().
    187 
    188   The default angle is 270 degrees.
    189 
    190   \sa totalAngle(), setNumTurns()
    191 */
     170    return m_data->markerStyle;
     171}
     172
     173/*!
     174   \brief Set the total angle by which the knob can be turned
     175   \param angle Angle in degrees.
     176
     177   The angle has to be between [10, 360] degrees. Angles above
     178   360 ( so that the knob can be turned several times around its axis )
     179   have to be set using setNumTurns().
     180
     181   The default angle is 270 degrees.
     182
     183   \sa totalAngle(), setNumTurns()
     184 */
    192185void QwtKnob::setTotalAngle ( double angle )
    193186{
    194187    angle = qBound( 10.0, angle, 360.0 );
    195188
    196     if ( angle != d_data->totalAngle )
    197     {
    198         d_data->totalAngle = angle;
    199 
    200         scaleDraw()->setAngleRange( -0.5 * d_data->totalAngle,
    201             0.5 * d_data->totalAngle );
     189    if ( angle != m_data->totalAngle )
     190    {
     191        m_data->totalAngle = angle;
     192
     193        scaleDraw()->setAngleRange( -0.5 * m_data->totalAngle,
     194            0.5 * m_data->totalAngle );
    202195
    203196        updateGeometry();
    … …  
    207200
    208201/*!
    209   \return the total angle
    210   \sa setTotalAngle(), setNumTurns(), numTurns()
     202   \return the total angle
     203   \sa setTotalAngle(), setNumTurns(), numTurns()
    211204 */
    212205double QwtKnob::totalAngle() const
    213206{
    214     return d_data->totalAngle;
    215 }
    216 
    217 /*!
    218   \brief Set the number of turns
    219 
    220   When numTurns > 1 the knob can be turned several times around its axis
    221   - otherwise the total angle is floored to 360°.
    222 
    223   \sa numTurns(), totalAngle(), setTotalAngle()
    224 */
     207    return m_data->totalAngle;
     208}
     209
     210/*!
     211   \brief Set the number of turns
     212
     213   When numTurns > 1 the knob can be turned several times around its axis
     214   - otherwise the total angle is floored to 360°.
     215
     216   \sa numTurns(), totalAngle(), setTotalAngle()
     217 */
    225218
    226219void QwtKnob::setNumTurns( int numTurns )
    … …  
    228221    numTurns = qMax( numTurns, 1 );
    229222
    230     if ( numTurns == 1 && d_data->totalAngle <= 360.0 )
     223    if ( numTurns == 1 && m_data->totalAngle <= 360.0 )
    231224        return;
    232225
    233226    const double angle = numTurns * 360.0;
    234     if ( angle != d_data->totalAngle )
    235     {
    236         d_data->totalAngle = angle;
    237 
    238         scaleDraw()->setAngleRange( -0.5 * d_data->totalAngle,
    239             0.5 * d_data->totalAngle );
     227    if ( angle != m_data->totalAngle )
     228    {
     229        m_data->totalAngle = angle;
     230
     231        scaleDraw()->setAngleRange( -0.5 * m_data->totalAngle,
     232            0.5 * m_data->totalAngle );
    240233
    241234        updateGeometry();
    … …  
    245238
    246239/*!
    247   \return Number of turns.
    248 
    249   When the total angle is below 360° numTurns() is ceiled to 1.
    250   \sa setNumTurns(), setTotalAngle(), totalAngle()
     240   \return Number of turns.
     241
     242   When the total angle is below 360° numTurns() is ceiled to 1.
     243   \sa setNumTurns(), setTotalAngle(), totalAngle()
    251244 */
    252245int QwtKnob::numTurns() const
    253246{
    254     return qCeil( d_data->totalAngle / 360.0 );
     247    return qwtCeil( m_data->totalAngle / 360.0 );
    255248}
    256249
    … …  
    263256
    264257   \sa scaleDraw()
    265 */
    266 void QwtKnob::setScaleDraw( QwtRoundScaleDraw *scaleDraw )
     258 */
     259void QwtKnob::setScaleDraw( QwtRoundScaleDraw* scaleDraw )
    267260{
    268261    setAbstractScaleDraw( scaleDraw );
    269     setTotalAngle( d_data->totalAngle );
     262    setTotalAngle( m_data->totalAngle );
    270263
    271264    updateGeometry();
    … …  
    276269   \return the scale draw of the knob
    277270   \sa setScaleDraw()
    278 */
    279 const QwtRoundScaleDraw *QwtKnob::scaleDraw() const
    280 {
    281     return static_cast<const QwtRoundScaleDraw *>( abstractScaleDraw() );
     271 */
     272const QwtRoundScaleDraw* QwtKnob::scaleDraw() const
     273{
     274    return static_cast< const QwtRoundScaleDraw* >( abstractScaleDraw() );
    282275}
    283276
    … …  
    285278   \return the scale draw of the knob
    286279   \sa setScaleDraw()
    287 */
    288 QwtRoundScaleDraw *QwtKnob::scaleDraw()
    289 {
    290     return static_cast<QwtRoundScaleDraw *>( abstractScaleDraw() );
    291 }
    292 
    293 /*!
    294   Calculate the bounding rectangle of the knob without the scale
    295 
    296   \return Bounding rectangle of the knob
    297   \sa knobWidth(), alignment(), QWidget::contentsRect()
     280 */
     281QwtRoundScaleDraw* QwtKnob::scaleDraw()
     282{
     283    return static_cast< QwtRoundScaleDraw* >( abstractScaleDraw() );
     284}
     285
     286/*!
     287   Calculate the bounding rectangle of the knob without the scale
     288
     289   \return Bounding rectangle of the knob
     290   \sa knobWidth(), alignment(), QWidget::contentsRect()
    298291 */
    299292QRect QwtKnob::knobRect() const
    … …  
    301294    const QRect cr = contentsRect();
    302295
    303     const int extent = qCeil( scaleDraw()->extent( font() ) );
    304     const int d = extent + d_data->scaleDist;
    305 
    306     int w = d_data->knobWidth;
     296    const int extent = qwtCeil( scaleDraw()->extent( font() ) );
     297    const int d = extent + m_data->scaleDist;
     298
     299    int w = m_data->knobWidth;
    307300    if ( w <= 0 )
    308301    {
    … …  
    315308    QRect r( 0, 0, w, w );
    316309
    317     if ( d_data->alignment & Qt::AlignLeft )
     310    if ( m_data->alignment & Qt::AlignLeft )
    318311    {
    319312        r.moveLeft( cr.left() + d );
    320313    }
    321     else if ( d_data->alignment & Qt::AlignRight )
     314    else if ( m_data->alignment & Qt::AlignRight )
    322315    {
    323316        r.moveRight( cr.right() - d );
    … …  
    328321    }
    329322
    330     if ( d_data->alignment & Qt::AlignTop )
     323    if ( m_data->alignment & Qt::AlignTop )
    331324    {
    332325        r.moveTop( cr.top() + d );
    333326    }
    334     else if ( d_data->alignment & Qt::AlignBottom )
     327    else if ( m_data->alignment & Qt::AlignBottom )
    335328    {
    336329        r.moveBottom( cr.bottom() - d );
    … …  
    345338
    346339/*!
    347   \brief Determine what to do when the user presses a mouse button.
    348 
    349   \param pos Mouse position
    350 
    351   \retval True, when pos is inside the circle of the knob.
    352   \sa scrolledTo()
    353 */
    354 bool QwtKnob::isScrollPosition( const QPoint &pos ) const
     340   \brief Determine what to do when the user presses a mouse button.
     341
     342   \param pos Mouse position
     343
     344   \retval True, when pos is inside the circle of the knob.
     345   \sa scrolledTo()
     346 */
     347bool QwtKnob::isScrollPosition( const QPoint& pos ) const
    355348{
    356349    const QRect kr = knobRect();
    … …  
    362355        const double valueAngle = qwtToDegrees( scaleMap().transform( value() ) );
    363356
    364         d_data->mouseOffset = qwtNormalizeDegrees( angle - valueAngle );
     357        m_data->mouseOffset = qwtNormalizeDegrees( angle - valueAngle );
    365358
    366359        return true;
    … …  
    371364
    372365/*!
    373   \brief Determine the value for a new position of the mouse
    374 
    375   \param pos Mouse position
    376 
    377   \return Value for the mouse position
    378   \sa isScrollPosition()
    379 */
    380 double QwtKnob::scrolledTo( const QPoint &pos ) const
     366   \brief Determine the value for a new position of the mouse
     367
     368   \param pos Mouse position
     369
     370   \return Value for the mouse position
     371   \sa isScrollPosition()
     372 */
     373double QwtKnob::scrolledTo( const QPoint& pos ) const
    381374{
    382375    double angle = QLineF( rect().center(), pos ).angle();
    383     angle = qwtNormalizeDegrees( angle - d_data->mouseOffset );
     376    angle = qwtNormalizeDegrees( angle - m_data->mouseOffset );
    384377
    385378    if ( scaleMap().pDist() > 360.0 )
    … …  
    389382        const double v = scaleMap().transform( value() );
    390383
    391         int numTurns = qFloor( ( v - scaleMap().p1() ) / 360.0 );
     384        int numTurns = qwtFloor( ( v - scaleMap().p1() ) / 360.0 );
    392385
    393386        double valueAngle = qwtNormalizeDegrees( v );
    … …  
    404397                qBound( scaleMap().p1(), angle, scaleMap().p2() );
    405398
    406             d_data->mouseOffset += ( boundedAngle - angle );
     399            m_data->mouseOffset += ( boundedAngle - angle );
    407400            angle = boundedAngle;
    408401        }
    … …  
    423416                boundedAngle = scaleMap().p1();
    424417
    425             d_data->mouseOffset += ( boundedAngle - angle );
     418            m_data->mouseOffset += ( boundedAngle - angle );
    426419        }
    427420
    … …  
    433426
    434427/*!
    435   Handle QEvent::StyleChange and QEvent::FontChange;
    436   \param event Change event
    437 */
    438 void QwtKnob::changeEvent( QEvent *event )
     428   Handle QEvent::StyleChange and QEvent::FontChange;
     429   \param event Change event
     430 */
     431void QwtKnob::changeEvent( QEvent* event )
    439432{
    440433    switch( event->type() )
    … …  
    453446
    454447/*!
    455   Repaint the knob
    456   \param event Paint event
    457 */
    458 void QwtKnob::paintEvent( QPaintEvent *event )
     448   Repaint the knob
     449   \param event Paint event
     450 */
     451void QwtKnob::paintEvent( QPaintEvent* event )
    459452{
    460453    const QRectF knobRect = this->knobRect();
    … …  
    464457
    465458    QStyleOption opt;
    466     opt.init(this);
     459    opt.initFrom(this);
    467460    style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
    468461
    … …  
    471464    if ( !knobRect.contains( event->region().boundingRect() ) )
    472465    {
    473         scaleDraw()->setRadius( 0.5 * knobRect.width() + d_data->scaleDist );
     466        scaleDraw()->setRadius( 0.5 * knobRect.width() + m_data->scaleDist );
    474467        scaleDraw()->moveCenter( knobRect.center() );
    475468
    … …  
    489482
    490483/*!
    491   \brief Draw the knob
    492 
    493   \param painter painter
    494   \param knobRect Bounding rectangle of the knob (without scale)
    495 */
    496 void QwtKnob::drawKnob( QPainter *painter, const QRectF &knobRect ) const
     484   \brief Draw the knob
     485
     486   \param painter painter
     487   \param knobRect Bounding rectangle of the knob (without scale)
     488 */
     489void QwtKnob::drawKnob( QPainter* painter, const QRectF& knobRect ) const
    497490{
    498491    double dim = qMin( knobRect.width(), knobRect.height() );
    499     dim -= d_data->borderWidth * 0.5;
     492    dim -= m_data->borderWidth * 0.5;
    500493
    501494    QRectF aRect( 0, 0, dim, dim );
    … …  
    503496
    504497    QPen pen( Qt::NoPen );
    505     if ( d_data->borderWidth > 0 )
     498    if ( m_data->borderWidth > 0 )
    506499    {
    507500        QColor c1 = palette().color( QPalette::Light );
    … …  
    514507        gradient.setColorAt( 1.0, c2 );
    515508
    516         pen = QPen( gradient, d_data->borderWidth );
     509        pen = QPen( gradient, m_data->borderWidth );
    517510    }
    518511
    519512    QBrush brush;
    520     switch( d_data->knobStyle )
     513    switch( m_data->knobStyle )
    521514    {
    522515        case QwtKnob::Raised:
    … …  
    542535
    543536            const QColor c = palette().color( QPalette::Button );
    544             gradient.setColorAt(0, c.lighter(110));
    545             gradient.setColorAt(qreal(0.5), c);
    546             gradient.setColorAt(qreal(0.501), c.darker(102));
    547             gradient.setColorAt(1, c.darker(115));
     537            gradient.setColorAt(0, c.lighter(110) );
     538            gradient.setColorAt( 0.5, c);
     539            gradient.setColorAt( 0.501, c.darker(102) );
     540            gradient.setColorAt(1, c.darker(115) );
    548541
    549542            brush = QBrush( gradient );
    … …  
    574567
    575568/*!
    576   \brief Draw the marker at the knob's front
    577 
    578   \param painter Painter
    579   \param rect Bounding rectangle of the knob without scale
    580   \param angle Angle of the marker in degrees
     569   \brief Draw the marker at the knob's front
     570
     571   \param painter Painter
     572   \param rect Bounding rectangle of the knob without scale
     573   \param angle Angle of the marker in degrees
    581574               ( clockwise, 0 at the 12 o'clock position )
    582 */
    583 void QwtKnob::drawMarker( QPainter *painter,
    584     const QRectF &rect, double angle ) const
    585 {
    586     if ( d_data->markerStyle == NoMarker || !isValid() )
     575 */
     576void QwtKnob::drawMarker( QPainter* painter,
     577    const QRectF& rect, double angle ) const
     578{
     579    if ( m_data->markerStyle == NoMarker || !isValid() )
    587580        return;
    588581
    … …  
    595588    const double margin = 4.0;
    596589
    597     double radius = 0.5 * ( rect.width() - d_data->borderWidth ) - margin;
     590    double radius = 0.5 * ( rect.width() - m_data->borderWidth ) - margin;
    598591    if ( radius < 1.0 )
    599592        radius = 1.0;
    600593
    601     int markerSize = d_data->markerSize;
     594    double markerSize = m_data->markerSize;
    602595    if ( markerSize <= 0 )
    603596        markerSize = qRound( 0.4 * radius );
    604597
    605     switch ( d_data->markerStyle )
     598    switch ( m_data->markerStyle )
    606599    {
    607600        case Notch:
    608601        case Nub:
    609602        {
    610             const double dotWidth =
    611                 qMin( double( markerSize ), radius);
     603            const double dotWidth = qwtMinF( markerSize, radius );
    612604
    613605            const double dotCenterDist = radius - 0.5 * dotWidth;
    … …  
    623615                QColor c2 = palette().color( QPalette::Mid );
    624616
    625                 if ( d_data->markerStyle == Notch )
     617                if ( m_data->markerStyle == Notch )
    626618                    qSwap( c1, c2 );
    627619
    … …  
    640632        case Dot:
    641633        {
    642             const double dotWidth =
    643                 qMin( double( markerSize ), radius);
     634            const double dotWidth = qwtMinF( markerSize, radius);
    644635
    645636            const double dotCenterDist = radius - 0.5 * dotWidth;
    … …  
    661652        case Tick:
    662653        {
    663             const double rb = qMax( radius - markerSize, 1.0 );
     654            const double rb = qwtMaxF( radius - markerSize, 1.0 );
    664655            const double re = radius;
    665656
    … …  
    676667        case Triangle:
    677668        {
    678             const double rb = qMax( radius - markerSize, 1.0 );
     669            const double rb = qwtMaxF( radius - markerSize, 1.0 );
    679670            const double re = radius;
    680671
    … …  
    701692
    702693/*!
    703   Draw the focus indicator
    704   \param painter Painter
    705 */
    706 void QwtKnob::drawFocusIndicator( QPainter *painter ) const
     694   Draw the focus indicator
     695   \param painter Painter
     696 */
     697void QwtKnob::drawFocusIndicator( QPainter* painter ) const
    707698{
    708699    const QRect cr = contentsRect();
    709700
    710     int w = d_data->knobWidth;
     701    int w = m_data->knobWidth;
    711702    if ( w <= 0 )
    712703    {
    … …  
    716707    {
    717708        const int extent = qCeil( scaleDraw()->extent( font() ) );
    718         w += 2 * ( extent + d_data->scaleDist );
     709        w += 2 * ( extent + m_data->scaleDist );
    719710    }
    720711
    … …  
    726717
    727718/*!
    728   \brief Set the alignment of the knob
    729 
    730   Similar to a QLabel::alignment() the flags decide how
    731   to align the knob inside of contentsRect().
    732 
    733   The default setting is Qt::AlignCenter
    734 
    735   \param alignment Or'd alignment flags
    736 
    737   \sa alignment(), setKnobWidth(), knobRect()
     719   \brief Set the alignment of the knob
     720
     721   Similar to a QLabel::alignment() the flags decide how
     722   to align the knob inside of contentsRect().
     723
     724   The default setting is Qt::AlignCenter
     725
     726   \param alignment Or'd alignment flags
     727
     728   \sa alignment(), setKnobWidth(), knobRect()
    738729 */
    739730void QwtKnob::setAlignment( Qt::Alignment alignment )
    740731{
    741     if ( d_data->alignment != alignment )
    742     {
    743         d_data->alignment = alignment;
     732    if ( m_data->alignment != alignment )
     733    {
     734        m_data->alignment = alignment;
    744735        update();
    745736    }
    … …  
    747738
    748739/*!
    749   \return Alignment of the knob inside of contentsRect()
    750   \sa setAlignment(), knobWidth(), knobRect()
     740   \return Alignment of the knob inside of contentsRect()
     741   \sa setAlignment(), knobWidth(), knobRect()
    751742 */
    752743Qt::Alignment QwtKnob::alignment() const
    753744{
    754     return d_data->alignment;
    755 }
    756 
    757 /*!
    758   \brief Change the knob's width.
    759 
    760   Setting a fixed value for the diameter of the knob
    761   is helpful for aligning several knobs in a row.
    762 
    763   \param width New width
    764 
    765   \sa knobWidth(), setAlignment()
    766   \note Modifies the sizePolicy()
    767 */
     745    return m_data->alignment;
     746}
     747
     748/*!
     749   \brief Change the knob's width.
     750
     751   Setting a fixed value for the diameter of the knob
     752   is helpful for aligning several knobs in a row.
     753
     754   \param width New width
     755
     756   \sa knobWidth(), setAlignment()
     757   \note Modifies the sizePolicy()
     758 */
    768759void QwtKnob::setKnobWidth( int width )
    769760{
    770761    width = qMax( width, 0 );
    771762
    772     if ( width != d_data->knobWidth )
     763    if ( width != m_data->knobWidth )
    773764    {
    774765        QSizePolicy::Policy policy;
    … …  
    780771        setSizePolicy( policy, policy );
    781772
    782         d_data->knobWidth = width;
     773        m_data->knobWidth = width;
    783774
    784775        updateGeometry();
    … …  
    790781int QwtKnob::knobWidth() const
    791782{
    792     return d_data->knobWidth;
    793 }
    794 
    795 /*!
    796   \brief Set the knob's border width
    797   \param borderWidth new border width
    798 */
     783    return m_data->knobWidth;
     784}
     785
     786/*!
     787   \brief Set the knob's border width
     788   \param borderWidth new border width
     789 */
    799790void QwtKnob::setBorderWidth( int borderWidth )
    800791{
    801     d_data->borderWidth = qMax( borderWidth, 0 );
     792    m_data->borderWidth = qMax( borderWidth, 0 );
    802793
    803794    updateGeometry();
    … …  
    808799int QwtKnob::borderWidth() const
    809800{
    810     return d_data->borderWidth;
    811 }
    812 
    813 /*!
    814   \brief Set the size of the marker
    815 
    816   When setting a size <= 0 the marker will
    817   automatically scaled to 40% of the radius of the knob.
    818 
    819   \sa markerSize(), markerStyle()
    820 */
     801    return m_data->borderWidth;
     802}
     803
     804/*!
     805   \brief Set the size of the marker
     806
     807   When setting a size <= 0 the marker will
     808   automatically scaled to 40% of the radius of the knob.
     809
     810   \sa markerSize(), markerStyle()
     811 */
    821812void QwtKnob::setMarkerSize( int size )
    822813{
    823     if ( d_data->markerSize != size )
    824     {
    825         d_data->markerSize = size;
     814    if ( m_data->markerSize != size )
     815    {
     816        m_data->markerSize = size;
    826817        update();
    827818    }
    … …  
    829820
    830821/*!
    831   \return Marker size
    832   \sa setMarkerSize()
     822   \return Marker size
     823   \sa setMarkerSize()
    833824 */
    834825int QwtKnob::markerSize() const
    835826{
    836     return d_data->markerSize;
    837 }
    838 
    839 /*!
    840   \return sizeHint()
    841 */
     827    return m_data->markerSize;
     828}
     829
     830/*!
     831   \return sizeHint()
     832 */
    842833QSize QwtKnob::sizeHint() const
    843834{
    844835    const QSize hint = qwtKnobSizeHint( this, 50 );
    845     return hint.expandedTo( QApplication::globalStrut() );
    846 }
    847 
    848 /*!
    849   \return Minimum size hint
    850   \sa sizeHint()
    851 */
     836    return qwtExpandedToGlobalStrut( hint );
     837}
     838
     839/*!
     840   \return Minimum size hint
     841   \sa sizeHint()
     842 */
    852843QSize QwtKnob::minimumSizeHint() const
    853844{
    854845    return qwtKnobSizeHint( this, 20 );
    855846}
     847
     848#include "moc_qwt_knob.cpp"
Note: See TracChangeset for help on using the changeset viewer.