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_plot_tradingcurve.cpp

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    1010#include "qwt_plot_tradingcurve.h"
    1111#include "qwt_scale_map.h"
    12 #include "qwt_clipper.h"
    1312#include "qwt_painter.h"
     13#include "qwt_text.h"
     14#include "qwt_graphic.h"
     15#include "qwt_math.h"
     16
    1417#include <qpainter.h>
    1518
    16 static inline bool qwtIsSampleInside( const QwtOHLCSample &sample,
     19static inline bool qwtIsSampleInside( const QwtOHLCSample& sample,
    1720    double tMin, double tMax, double vMin, double vMax )
    1821{
    … …  
    2831class QwtPlotTradingCurve::PrivateData
    2932{
    30 public:
    31     PrivateData():
    32         symbolStyle( QwtPlotTradingCurve::CandleStick ),
    33         symbolExtent( 0.6 ),
    34         minSymbolWidth( 2.0 ),
    35         maxSymbolWidth( -1.0 ),
    36         paintAttributes( QwtPlotTradingCurve::ClipSymbols )
     33  public:
     34    PrivateData()
     35        : symbolStyle( QwtPlotTradingCurve::CandleStick )
     36        , symbolExtent( 0.6 )
     37        , minSymbolWidth( 2.0 )
     38        , maxSymbolWidth( -1.0 )
     39        , paintAttributes( QwtPlotTradingCurve::ClipSymbols )
    3740    {
    3841        symbolBrush[0] = QBrush( Qt::white );
    … …  
    5255
    5356/*!
    54   Constructor
    55   \param title Title of the curve
    56 */
    57 QwtPlotTradingCurve::QwtPlotTradingCurve( const QwtText &title ):
    58     QwtPlotSeriesItem( title )
     57   Constructor
     58   \param title Title of the curve
     59 */
     60QwtPlotTradingCurve::QwtPlotTradingCurve( const QwtText& title )
     61    : QwtPlotSeriesItem( title )
    5962{
    6063    init();
    … …  
    6265
    6366/*!
    64   Constructor
    65   \param title Title of the curve
    66 */
    67 QwtPlotTradingCurve::QwtPlotTradingCurve( const QString &title ):
    68     QwtPlotSeriesItem( QwtText( title ) )
     67   Constructor
     68   \param title Title of the curve
     69 */
     70QwtPlotTradingCurve::QwtPlotTradingCurve( const QString& title )
     71    : QwtPlotSeriesItem( QwtText( title ) )
    6972{
    7073    init();
    … …  
    7477QwtPlotTradingCurve::~QwtPlotTradingCurve()
    7578{
    76     delete d_data;
     79    delete m_data;
    7780}
    7881
    … …  
    8386    setItemAttribute( QwtPlotItem::AutoScale, true );
    8487
    85     d_data = new PrivateData;
     88    m_data = new PrivateData;
    8689    setData( new QwtTradingChartData() );
    8790
    … …  
    9699
    97100/*!
    98   Specify an attribute how to draw the curve
    99 
    100   \param attribute Paint attribute
    101   \param on On/Off
    102   \sa testPaintAttribute()
    103 */
     101   Specify an attribute how to draw the curve
     102
     103   \param attribute Paint attribute
     104   \param on On/Off
     105   \sa testPaintAttribute()
     106 */
    104107void QwtPlotTradingCurve::setPaintAttribute(
    105108    PaintAttribute attribute, bool on )
    106109{
    107110    if ( on )
    108         d_data->paintAttributes |= attribute;
     111        m_data->paintAttributes |= attribute;
    109112    else
    110         d_data->paintAttributes &= ~attribute;
     113        m_data->paintAttributes &= ~attribute;
    111114}
    112115
    … …  
    114117    \return True, when attribute is enabled
    115118    \sa PaintAttribute, setPaintAttribute()
    116 */
     119 */
    117120bool QwtPlotTradingCurve::testPaintAttribute(
    118121    PaintAttribute attribute ) const
    119122{
    120     return ( d_data->paintAttributes & attribute );
    121 }
    122 
    123 /*!
    124   Initialize data with an array of samples.
    125   \param samples Vector of samples
    126 
    127   \sa QwtPlotSeriesItem::setData()
    128 */
     123    return ( m_data->paintAttributes & attribute );
     124}
     125
     126/*!
     127   Initialize data with an array of samples.
     128   \param samples Vector of samples
     129
     130   \sa QwtPlotSeriesItem::setData()
     131 */
    129132void QwtPlotTradingCurve::setSamples(
    130     const QVector<QwtOHLCSample> &samples )
     133    const QVector< QwtOHLCSample >& samples )
    131134{
    132135    setData( new QwtTradingChartData( samples ) );
    … …  
    134137
    135138/*!
    136   Assign a series of samples
    137 
    138   setSamples() is just a wrapper for setData() without any additional
    139   value - beside that it is easier to find for the developer.
    140 
    141   \param data Data
    142   \warning The item takes ownership of the data object, deleting
     139   Assign a series of samples
     140
     141   setSamples() is just a wrapper for setData() without any additional
     142   value - beside that it is easier to find for the developer.
     143
     144   \param data Data
     145   \warning The item takes ownership of the data object, deleting
    143146           it when its not used anymore.
    144 */
     147 */
    145148void QwtPlotTradingCurve::setSamples(
    146     QwtSeriesData<QwtOHLCSample> *data )
     149    QwtSeriesData< QwtOHLCSample >* data )
    147150{
    148151    setData( data );
    … …  
    150153
    151154/*!
    152   Set the symbol style
    153 
    154   \param style Symbol style
    155 
    156   \sa symbolStyle(), setSymbolExtent(),
     155   Set the symbol style
     156
     157   \param style Symbol style
     158
     159   \sa symbolStyle(), setSymbolExtent(),
    157160      setSymbolPen(), setSymbolBrush()
    158 */
     161 */
    159162void QwtPlotTradingCurve::setSymbolStyle( SymbolStyle style )
    160163{
    161     if ( style != d_data->symbolStyle )
    162     {
    163         d_data->symbolStyle = style;
     164    if ( style != m_data->symbolStyle )
     165    {
     166        m_data->symbolStyle = style;
    164167
    165168        legendChanged();
    … …  
    169172
    170173/*!
    171   \return Symbol style
    172   \sa setSymbolStyle(), symbolExtent(), symbolPen(), symbolBrush()
    173 */
     174   \return Symbol style
     175   \sa setSymbolStyle(), symbolExtent(), symbolPen(), symbolBrush()
     176 */
    174177QwtPlotTradingCurve::SymbolStyle QwtPlotTradingCurve::symbolStyle() const
    175178{
    176     return d_data->symbolStyle;
    177 }
    178 
    179 /*!
    180   Build and assign the symbol pen
    181 
    182   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
    183   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
    184   to hide this incompatibility.
    185 
    186   \param color Pen color
    187   \param width Pen width
    188   \param style Pen style
    189 
    190   \sa pen(), brush()
     179    return m_data->symbolStyle;
     180}
     181
     182/*!
     183   Build and assign the symbol pen
     184
     185   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
     186   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
     187   to hide this incompatibility.
     188
     189   \param color Pen color
     190   \param width Pen width
     191   \param style Pen style
     192
     193   \sa pen(), brush()
    191194 */
    192195void QwtPlotTradingCurve::setSymbolPen(
    193     const QColor &color, qreal width, Qt::PenStyle style )
     196    const QColor& color, qreal width, Qt::PenStyle style )
    194197{
    195198    setSymbolPen( QPen( color, width, style ) );
    … …  
    197200
    198201/*!
    199   \brief Set the symbol pen
    200 
    201   The symbol pen is used for rendering the lines of the
    202   bar or candlestick symbols
    203 
    204   \sa symbolPen(), setSymbolBrush()
    205 */
    206 void QwtPlotTradingCurve::setSymbolPen( const QPen &pen )
    207 {
    208     if ( pen != d_data->symbolPen )
    209     {
    210         d_data->symbolPen = pen;
     202   \brief Set the symbol pen
     203
     204   The symbol pen is used for rendering the lines of the
     205   bar or candlestick symbols
     206
     207   \sa symbolPen(), setSymbolBrush()
     208 */
     209void QwtPlotTradingCurve::setSymbolPen( const QPen& pen )
     210{
     211    if ( pen != m_data->symbolPen )
     212    {
     213        m_data->symbolPen = pen;
    211214
    212215        legendChanged();
    … …  
    216219
    217220/*!
    218   \return Symbol pen
    219   \sa setSymbolPen(), symbolBrush()
    220 */
     221   \return Symbol pen
     222   \sa setSymbolPen(), symbolBrush()
     223 */
    221224QPen QwtPlotTradingCurve::symbolPen() const
    222225{
    223     return d_data->symbolPen;
    224 }
    225 
    226 /*!
    227   Set the symbol brush
    228 
    229   \param direction Direction type
    230   \param brush Brush used to fill the body of all candlestick
     226    return m_data->symbolPen;
     227}
     228
     229/*!
     230   Set the symbol brush
     231
     232   \param direction Direction type
     233   \param brush Brush used to fill the body of all candlestick
    231234               symbols with the direction
    232235
    233   \sa symbolBrush(), setSymbolPen()
    234 */
     236   \sa symbolBrush(), setSymbolPen()
     237 */
    235238void QwtPlotTradingCurve::setSymbolBrush(
    236     Direction direction, const QBrush &brush )
     239    Direction direction, const QBrush& brush )
    237240{
    238241    // silencing -Wtautological-constant-out-of-range-compare
    … …  
    241244        return;
    242245
    243     if ( brush != d_data->symbolBrush[ index ] )
    244     {
    245         d_data->symbolBrush[ index ] = brush;
     246    if ( brush != m_data->symbolBrush[ index ] )
     247    {
     248        m_data->symbolBrush[ index ] = brush;
    246249
    247250        legendChanged();
    … …  
    251254
    252255/*!
    253   \param direction
    254   \return Brush used to fill the body of all candlestick
     256   \param direction
     257   \return Brush used to fill the body of all candlestick
    255258          symbols with the direction
    256259
    257   \sa setSymbolPen(), symbolBrush()
    258 */
     260   \sa setSymbolPen(), symbolBrush()
     261 */
    259262QBrush QwtPlotTradingCurve::symbolBrush( Direction direction ) const
    260263{
    … …  
    263266        return QBrush();
    264267
    265     return d_data->symbolBrush[ index ];
    266 }
    267 
    268 /*!
    269   \brief Set the extent of the symbol
    270 
    271   The width of the symbol is given in scale coordinates. When painting
    272   a symbol the width is scaled into paint device coordinates
    273   by scaledSymbolWidth(). The scaled width is bounded by
    274   minSymbolWidth(), maxSymbolWidth()
    275 
    276   \param extent Symbol width in scale coordinates
    277 
    278   \sa symbolExtent(), scaledSymbolWidth(),
     268    return m_data->symbolBrush[ index ];
     269}
     270
     271/*!
     272   \brief Set the extent of the symbol
     273
     274   The width of the symbol is given in scale coordinates. When painting
     275   a symbol the width is scaled into paint device coordinates
     276   by scaledSymbolWidth(). The scaled width is bounded by
     277   minSymbolWidth(), maxSymbolWidth()
     278
     279   \param extent Symbol width in scale coordinates
     280
     281   \sa symbolExtent(), scaledSymbolWidth(),
    279282      setMinSymbolWidth(), setMaxSymbolWidth()
    280 */
     283 */
    281284void QwtPlotTradingCurve::setSymbolExtent( double extent )
    282285{
    283     extent = qMax( 0.0, extent );
    284     if ( extent != d_data->symbolExtent )
    285     {
    286         d_data->symbolExtent = extent;
     286    extent = qwtMaxF( 0.0, extent );
     287    if ( extent != m_data->symbolExtent )
     288    {
     289        m_data->symbolExtent = extent;
    287290
    288291        legendChanged();
    … …  
    292295
    293296/*!
    294   \return Extent of a symbol in scale coordinates
    295   \sa setSymbolExtent(), scaledSymbolWidth(),
     297   \return Extent of a symbol in scale coordinates
     298   \sa setSymbolExtent(), scaledSymbolWidth(),
    296299      minSymbolWidth(), maxSymbolWidth()
    297 */
     300 */
    298301double QwtPlotTradingCurve::symbolExtent() const
    299302{
    300     return d_data->symbolExtent;
    301 }
    302 
    303 /*!
    304   Set a minimum for the symbol width
    305 
    306   \param width Width in paint device coordinates
    307   \sa minSymbolWidth(), setMaxSymbolWidth(), setSymbolExtent()
     303    return m_data->symbolExtent;
     304}
     305
     306/*!
     307   Set a minimum for the symbol width
     308
     309   \param width Width in paint device coordinates
     310   \sa minSymbolWidth(), setMaxSymbolWidth(), setSymbolExtent()
    308311 */
    309312void QwtPlotTradingCurve::setMinSymbolWidth( double width )
    310313{
    311     width = qMax( width, 0.0 );
    312     if ( width != d_data->minSymbolWidth )
    313     {
    314         d_data->minSymbolWidth = width;
     314    width = qwtMaxF( width, 0.0 );
     315    if ( width != m_data->minSymbolWidth )
     316    {
     317        m_data->minSymbolWidth = width;
    315318
    316319        legendChanged();
    … …  
    320323
    321324/*!
    322   \return Minmum for the symbol width
    323   \sa setMinSymbolWidth(), maxSymbolWidth(), symbolExtent()
     325   \return Minmum for the symbol width
     326   \sa setMinSymbolWidth(), maxSymbolWidth(), symbolExtent()
    324327 */
    325328double QwtPlotTradingCurve::minSymbolWidth() const
    326329{
    327     return d_data->minSymbolWidth;
    328 }
    329 
    330 /*!
    331   Set a maximum for the symbol width
    332 
    333   A value <= 0.0 means an unlimited width
    334 
    335   \param width Width in paint device coordinates
    336   \sa maxSymbolWidth(), setMinSymbolWidth(), setSymbolExtent()
     330    return m_data->minSymbolWidth;
     331}
     332
     333/*!
     334   Set a maximum for the symbol width
     335
     336   A value <= 0.0 means an unlimited width
     337
     338   \param width Width in paint device coordinates
     339   \sa maxSymbolWidth(), setMinSymbolWidth(), setSymbolExtent()
    337340 */
    338341void QwtPlotTradingCurve::setMaxSymbolWidth( double width )
    339342{
    340     if ( width != d_data->maxSymbolWidth )
    341     {
    342         d_data->maxSymbolWidth = width;
     343    if ( width != m_data->maxSymbolWidth )
     344    {
     345        m_data->maxSymbolWidth = width;
    343346
    344347        legendChanged();
    … …  
    348351
    349352/*!
    350   \return Maximum for the symbol width
    351   \sa setMaxSymbolWidth(), minSymbolWidth(), symbolExtent()
     353   \return Maximum for the symbol width
     354   \sa setMaxSymbolWidth(), minSymbolWidth(), symbolExtent()
    352355 */
    353356double QwtPlotTradingCurve::maxSymbolWidth() const
    354357{
    355     return d_data->maxSymbolWidth;
    356 }
    357 
    358 /*!
    359   \return Bounding rectangle of all samples.
    360   For an empty series the rectangle is invalid.
    361 */
     358    return m_data->maxSymbolWidth;
     359}
     360
     361/*!
     362   \return Bounding rectangle of all samples.
     363   For an empty series the rectangle is invalid.
     364 */
    362365QRectF QwtPlotTradingCurve::boundingRect() const
    363366{
    … …  
    370373
    371374/*!
    372   Draw an interval of the curve
    373 
    374   \param painter Painter
    375   \param xMap Maps x-values into pixel coordinates.
    376   \param yMap Maps y-values into pixel coordinates.
    377   \param canvasRect Contents rectangle of the canvas
    378   \param from Index of the first point to be painted
    379   \param to Index of the last point to be painted. If to < 0 the
     375   Draw an interval of the curve
     376
     377   \param painter Painter
     378   \param xMap Maps x-values into pixel coordinates.
     379   \param yMap Maps y-values into pixel coordinates.
     380   \param canvasRect Contents rectangle of the canvas
     381   \param from Index of the first point to be painted
     382   \param to Index of the last point to be painted. If to < 0 the
    380383         curve will be painted to its last point.
    381384
    382   \sa drawSymbols()
    383 */
    384 void QwtPlotTradingCurve::drawSeries( QPainter *painter,
    385     const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    386     const QRectF &canvasRect, int from, int to ) const
     385   \sa drawSymbols()
     386 */
     387void QwtPlotTradingCurve::drawSeries( QPainter* painter,
     388    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     389    const QRectF& canvasRect, int from, int to ) const
    387390{
    388391    if ( to < 0 )
    … …  
    397400    painter->save();
    398401
    399     if ( d_data->symbolStyle != QwtPlotTradingCurve::NoSymbol )
     402    if ( m_data->symbolStyle != QwtPlotTradingCurve::NoSymbol )
    400403        drawSymbols( painter, xMap, yMap, canvasRect, from, to );
    401404
    … …  
    404407
    405408/*!
    406   Draw symbols
    407 
    408   \param painter Painter
    409   \param xMap x map
    410   \param yMap y map
    411   \param canvasRect Contents rectangle of the canvas
    412   \param from Index of the first point to be painted
    413   \param to Index of the last point to be painted
    414 
    415   \sa drawSeries()
    416 */
    417 void QwtPlotTradingCurve::drawSymbols( QPainter *painter,
    418     const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    419     const QRectF &canvasRect, int from, int to ) const
     409   Draw symbols
     410
     411   \param painter Painter
     412   \param xMap x map
     413   \param yMap y map
     414   \param canvasRect Contents rectangle of the canvas
     415   \param from Index of the first point to be painted
     416   \param to Index of the last point to be painted
     417
     418   \sa drawSeries()
     419 */
     420void QwtPlotTradingCurve::drawSymbols( QPainter* painter,
     421    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     422    const QRectF& canvasRect, int from, int to ) const
    420423{
    421424    const QRectF tr = QwtScaleMap::invTransform( xMap, yMap, canvasRect );
    422425
    423     const QwtScaleMap *timeMap, *valueMap;
     426    const QwtScaleMap* timeMap, * valueMap;
    424427    double tMin, tMax, vMin, vMax;
    425428
    … …  
    447450
    448451    const bool inverted = timeMap->isInverting();
    449     const bool doClip = d_data->paintAttributes & ClipSymbols;
     452    const bool doClip = m_data->paintAttributes & ClipSymbols;
    450453    const bool doAlign = QwtPainter::roundingAlignment( painter );
    451454
    452455    double symbolWidth = scaledSymbolWidth( xMap, yMap, canvasRect );
    453456    if ( doAlign )
    454         symbolWidth = qFloor( 0.5 * symbolWidth ) * 2.0;
    455 
    456     QPen pen = d_data->symbolPen;
     457        symbolWidth = std::floor( 0.5 * symbolWidth ) * 2.0;
     458
     459    QPen pen = m_data->symbolPen;
    457460    pen.setCapStyle( Qt::FlatCap );
    458461
    … …  
    486489            }
    487490
    488             switch( d_data->symbolStyle )
     491            switch( m_data->symbolStyle )
    489492            {
    490493                case Bar:
    … …  
    496499                case CandleStick:
    497500                {
    498                     painter->setBrush( d_data->symbolBrush[ brushIndex ] );
     501                    painter->setBrush( m_data->symbolBrush[ brushIndex ] );
    499502                    drawCandleStick( painter, translatedSample,
    500503                        orient, symbolWidth );
    … …  
    503506                default:
    504507                {
    505                     if ( d_data->symbolStyle >= UserSymbol )
     508                    if ( m_data->symbolStyle >= UserSymbol )
    506509                    {
    507                         painter->setBrush( d_data->symbolBrush[ brushIndex ] );
    508                         drawUserSymbol( painter, d_data->symbolStyle,
     510                        painter->setBrush( m_data->symbolBrush[ brushIndex ] );
     511                        drawUserSymbol( painter, m_data->symbolStyle,
    509512                            translatedSample, orient, inverted, symbolWidth );
    510513                    }
    … …  
    516519
    517520/*!
    518   \brief Draw a symbol for a symbol style >= UserSymbol
    519 
    520   The implementation does nothing and is intended to be overloaded
    521 
    522   \param painter Qt painter, initialized with pen/brush
    523   \param symbolStyle Symbol style
    524   \param sample Samples already translated into paint device coordinates
    525   \param orientation Vertical or horizontal
    526   \param inverted True, when the opposite scale
     521   \brief Draw a symbol for a symbol style >= UserSymbol
     522
     523   The implementation does nothing and is intended to be overloaded
     524
     525   \param painter Qt painter, initialized with pen/brush
     526   \param symbolStyle Symbol style
     527   \param sample Samples already translated into paint device coordinates
     528   \param orientation Vertical or horizontal
     529   \param inverted True, when the opposite scale
    527530                  ( Qt::Vertical: x, Qt::Horizontal: y ) is increasing
    528531                  in the opposite direction as QPainter coordinates.
    529   \param symbolWidth Width of the symbol in paint device coordinates
    530 */
    531 void QwtPlotTradingCurve::drawUserSymbol( QPainter *painter,
    532     SymbolStyle symbolStyle, const QwtOHLCSample &sample,
     532   \param symbolWidth Width of the symbol in paint device coordinates
     533 */
     534void QwtPlotTradingCurve::drawUserSymbol( QPainter* painter,
     535    SymbolStyle symbolStyle, const QwtOHLCSample& sample,
    533536    Qt::Orientation orientation, bool inverted, double symbolWidth ) const
    534537{
    … …  
    542545
    543546/*!
    544   \brief Draw a bar
    545 
    546   \param painter Qt painter, initialized with pen/brush
    547   \param sample Sample, already translated into paint device coordinates
    548   \param orientation Vertical or horizontal
    549   \param inverted When inverted is false the open tick is painted
     547   \brief Draw a bar
     548
     549   \param painter Qt painter, initialized with pen/brush
     550   \param sample Sample, already translated into paint device coordinates
     551   \param orientation Vertical or horizontal
     552   \param inverted When inverted is false the open tick is painted
    550553                  to the left/top, otherwise it is painted right/bottom.
    551554                  The close tick is painted in the opposite direction
    … …  
    553556                  painted in the opposite d
    554557                  opposite direction.
    555   \param width Width or height of the candle, depending on the orientation
    556 
    557   \sa Bar
    558 */
    559 void QwtPlotTradingCurve::drawBar( QPainter *painter,
    560     const QwtOHLCSample &sample, Qt::Orientation orientation,
     558   \param width Width or height of the candle, depending on the orientation
     559
     560   \sa Bar
     561 */
     562void QwtPlotTradingCurve::drawBar( QPainter* painter,
     563    const QwtOHLCSample& sample, Qt::Orientation orientation,
    561564    bool inverted, double width ) const
    562565{
    … …  
    587590
    588591/*!
    589   \brief Draw a candle stick
    590 
    591   \param painter Qt painter, initialized with pen/brush
    592   \param sample Samples already translated into paint device coordinates
    593   \param orientation Vertical or horizontal
    594   \param width Width or height of the candle, depending on the orientation
    595 
    596   \sa CandleStick
    597 */
    598 void QwtPlotTradingCurve::drawCandleStick( QPainter *painter,
    599     const QwtOHLCSample &sample, Qt::Orientation orientation,
     592   \brief Draw a candle stick
     593
     594   \param painter Qt painter, initialized with pen/brush
     595   \param sample Samples already translated into paint device coordinates
     596   \param orientation Vertical or horizontal
     597   \param width Width or height of the candle, depending on the orientation
     598
     599   \sa CandleStick
     600 */
     601void QwtPlotTradingCurve::drawCandleStick( QPainter* painter,
     602    const QwtOHLCSample& sample, Qt::Orientation orientation,
    600603    double width ) const
    601604{
    602605    const double t = sample.time;
    603     const double v1 = qMin( sample.low, sample.high );
    604     const double v2 = qMin( sample.open, sample.close );
    605     const double v3 = qMax( sample.low, sample.high );
    606     const double v4 = qMax( sample.open, sample.close );
     606    const double v1 = qwtMinF( sample.low, sample.high );
     607    const double v2 = qwtMinF( sample.open, sample.close );
     608    const double v3 = qwtMaxF( sample.low, sample.high );
     609    const double v4 = qwtMaxF( sample.open, sample.close );
    607610
    608611    if ( orientation == Qt::Vertical )
    … …  
    629632
    630633/*!
    631   \return A rectangle filled with the color of the symbol pen
    632 
    633   \param index Index of the legend entry
     634   \return A rectangle filled with the color of the symbol pen
     635
     636   \param index Index of the legend entry
    634637                ( usually there is only one )
    635   \param size Icon size
    636 
    637   \sa setLegendIconSize(), legendData()
    638 */
     638   \param size Icon size
     639
     640   \sa setLegendIconSize(), legendData()
     641 */
    639642QwtGraphic QwtPlotTradingCurve::legendIcon( int index,
    640     const QSizeF &size ) const
     643    const QSizeF& size ) const
    641644{
    642645    Q_UNUSED( index );
    643     return defaultIcon( d_data->symbolPen.color(), size );
    644 }
    645 
    646 /*!
    647   Calculate the symbol width in paint coordinates
    648 
    649   The width is calculated by scaling the symbol extent into
    650   paint device coordinates bounded by the minimum/maximum
    651   symbol width.
    652 
    653   \param xMap Maps x-values into pixel coordinates.
    654   \param yMap Maps y-values into pixel coordinates.
    655   \param canvasRect Contents rectangle of the canvas
    656 
    657   \return Symbol width in paint coordinates
    658 
    659   \sa symbolExtent(), minSymbolWidth(), maxSymbolWidth()
    660 */
     646    return defaultIcon( m_data->symbolPen.color(), size );
     647}
     648
     649/*!
     650   Calculate the symbol width in paint coordinates
     651
     652   The width is calculated by scaling the symbol extent into
     653   paint device coordinates bounded by the minimum/maximum
     654   symbol width.
     655
     656   \param xMap Maps x-values into pixel coordinates.
     657   \param yMap Maps y-values into pixel coordinates.
     658   \param canvasRect Contents rectangle of the canvas
     659
     660   \return Symbol width in paint coordinates
     661
     662   \sa symbolExtent(), minSymbolWidth(), maxSymbolWidth()
     663 */
    661664double QwtPlotTradingCurve::scaledSymbolWidth(
    662     const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    663     const QRectF &canvasRect ) const
     665    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     666    const QRectF& canvasRect ) const
    664667{
    665668    Q_UNUSED( canvasRect );
    666669
    667     if ( d_data->maxSymbolWidth > 0.0 &&
    668         d_data->minSymbolWidth >= d_data->maxSymbolWidth )
    669     {
    670         return d_data->minSymbolWidth;
    671     }
    672 
    673     const QwtScaleMap *map =
     670    if ( m_data->maxSymbolWidth > 0.0 &&
     671        m_data->minSymbolWidth >= m_data->maxSymbolWidth )
     672    {
     673        return m_data->minSymbolWidth;
     674    }
     675
     676    const QwtScaleMap* map =
    674677        ( orientation() == Qt::Vertical ) ? &xMap : &yMap;
    675678
    676     const double pos = map->transform( map->s1() + d_data->symbolExtent );
     679    const double pos = map->transform( map->s1() + m_data->symbolExtent );
    677680
    678681    double width = qAbs( pos - map->p1() );
    679682
    680     width = qMax( width,  d_data->minSymbolWidth );
    681     if ( d_data->maxSymbolWidth > 0.0 )
    682         width = qMin( width, d_data->maxSymbolWidth );
     683    width = qwtMaxF( width,  m_data->minSymbolWidth );
     684    if ( m_data->maxSymbolWidth > 0.0 )
     685        width = qwtMinF( width, m_data->maxSymbolWidth );
    683686
    684687    return width;
Note: See TracChangeset for help on using the changeset viewer.