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_abstract_barchart.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_abstract_barchart.h"
    1111#include "qwt_scale_map.h"
     12#include "qwt_math.h"
    1213
    1314static inline double qwtTransformWidth(
    14     const QwtScaleMap &map, double value, double width )
     15    const QwtScaleMap& map, double value, double width )
    1516{
    1617    const double w2 = 0.5 * width;
    … …  
    2425class QwtPlotAbstractBarChart::PrivateData
    2526{
    26 public:
    27     PrivateData():
    28         layoutPolicy( QwtPlotAbstractBarChart::AutoAdjustSamples ),
    29         layoutHint( 0.5 ),
    30         spacing( 10 ),
    31         margin( 5 ),
    32         baseline( 0.0 )
     27  public:
     28    PrivateData()
     29        : layoutPolicy( QwtPlotAbstractBarChart::AutoAdjustSamples )
     30        , layoutHint( 0.5 )
     31        , spacing( 10 )
     32        , margin( 5 )
     33        , baseline( 0.0 )
    3334    {
    3435    }
    … …  
    4243
    4344/*!
    44   Constructor
    45   \param title Title of the chart
    46 */
    47 QwtPlotAbstractBarChart::QwtPlotAbstractBarChart( const QwtText &title ):
    48     QwtPlotSeriesItem( title )
    49 {
    50     d_data = new PrivateData;
     45   Constructor
     46   \param title Title of the chart
     47 */
     48QwtPlotAbstractBarChart::QwtPlotAbstractBarChart( const QwtText& title )
     49    : QwtPlotSeriesItem( title )
     50{
     51    m_data = new PrivateData;
    5152
    5253    setItemAttribute( QwtPlotItem::Legend, true );
    … …  
    5960QwtPlotAbstractBarChart::~QwtPlotAbstractBarChart()
    6061{
    61     delete d_data;
    62 }
    63 
    64 /*!
    65   The combination of layoutPolicy() and layoutHint() define how the width
    66   of the bars is calculated
    67 
    68   \param policy Layout policy
    69 
    70   \sa layoutPolicy(), layoutHint()
     62    delete m_data;
     63}
     64
     65/*!
     66   The combination of layoutPolicy() and layoutHint() define how the width
     67   of the bars is calculated
     68
     69   \param policy Layout policy
     70
     71   \sa layoutPolicy(), layoutHint()
    7172 */
    7273void QwtPlotAbstractBarChart::setLayoutPolicy( LayoutPolicy policy )
    7374{
    74     if ( policy != d_data->layoutPolicy )
    75     {
    76         d_data->layoutPolicy = policy;
    77         itemChanged();
    78     }
    79 }
    80 
    81 /*!
    82   The combination of layoutPolicy() and layoutHint() define how the width
    83   of the bars is calculated
    84 
    85   \return Layout policy of the chart item
    86   \sa setLayoutPolicy(), layoutHint()
     75    if ( policy != m_data->layoutPolicy )
     76    {
     77        m_data->layoutPolicy = policy;
     78        itemChanged();
     79    }
     80}
     81
     82/*!
     83   The combination of layoutPolicy() and layoutHint() define how the width
     84   of the bars is calculated
     85
     86   \return Layout policy of the chart item
     87   \sa setLayoutPolicy(), layoutHint()
    8788 */
    8889QwtPlotAbstractBarChart::LayoutPolicy QwtPlotAbstractBarChart::layoutPolicy() const
    8990{
    90     return d_data->layoutPolicy;
    91 }
    92 
    93 /*!
    94   The combination of layoutPolicy() and layoutHint() define how the width
    95   of the bars is calculated
    96 
    97   \param hint Layout hint
    98 
    99   \sa LayoutPolicy, layoutPolicy(), layoutHint()
     91    return m_data->layoutPolicy;
     92}
     93
     94/*!
     95   The combination of layoutPolicy() and layoutHint() define how the width
     96   of the bars is calculated
     97
     98   \param hint Layout hint
     99
     100   \sa LayoutPolicy, layoutPolicy(), layoutHint()
    100101 */
    101102void QwtPlotAbstractBarChart::setLayoutHint( double hint )
    102103{
    103     hint = qMax( 0.0, hint );
    104     if ( hint != d_data->layoutHint )
    105     {
    106         d_data->layoutHint = hint;
    107         itemChanged();
    108     }
    109 }
    110 
    111 /*!
    112   The combination of layoutPolicy() and layoutHint() define how the width
    113   of the bars is calculated
    114 
    115   \return Layout policy of the chart item
    116   \sa LayoutPolicy, setLayoutHint(), layoutPolicy()
    117 */
     104    hint = qwtMaxF( 0.0, hint );
     105    if ( hint != m_data->layoutHint )
     106    {
     107        m_data->layoutHint = hint;
     108        itemChanged();
     109    }
     110}
     111
     112/*!
     113   The combination of layoutPolicy() and layoutHint() define how the width
     114   of the bars is calculated
     115
     116   \return Layout policy of the chart item
     117   \sa LayoutPolicy, setLayoutHint(), layoutPolicy()
     118 */
    118119double QwtPlotAbstractBarChart::layoutHint() const
    119120{
    120     return d_data->layoutHint;
    121 }
    122 
    123 /*!
    124   \brief Set the spacing
    125 
    126   The spacing is the distance between 2 samples ( bars for QwtPlotBarChart or
    127   a group of bars for QwtPlotMultiBarChart ) in paint device coordinates.
    128 
    129   \sa spacing()
     121    return m_data->layoutHint;
     122}
     123
     124/*!
     125   \brief Set the spacing
     126
     127   The spacing is the distance between 2 samples ( bars for QwtPlotBarChart or
     128   a group of bars for QwtPlotMultiBarChart ) in paint device coordinates.
     129
     130   \sa spacing()
    130131 */
    131132void QwtPlotAbstractBarChart::setSpacing( int spacing )
    132133{
    133134    spacing = qMax( spacing, 0 );
    134     if ( spacing != d_data->spacing )
    135     {
    136         d_data->spacing = spacing;
    137         itemChanged();
    138     }
    139 }
    140 
    141 /*!
    142   \return Spacing between 2 samples ( bars or groups of bars )
    143   \sa setSpacing(), margin()
     135    if ( spacing != m_data->spacing )
     136    {
     137        m_data->spacing = spacing;
     138        itemChanged();
     139    }
     140}
     141
     142/*!
     143   \return Spacing between 2 samples ( bars or groups of bars )
     144   \sa setSpacing(), margin()
    144145 */
    145146int QwtPlotAbstractBarChart::spacing() const
    146147{
    147     return d_data->spacing;
    148 }
    149 /*!
    150   \brief Set the margin
    151 
    152   The margin is the distance between the outmost bars and the contentsRect()
    153   of the canvas. The default setting is 5 pixels.
    154 
    155   \param margin Margin
    156 
    157   \sa spacing(), margin()
     148    return m_data->spacing;
     149}
     150/*!
     151   \brief Set the margin
     152
     153   The margin is the distance between the outmost bars and the contentsRect()
     154   of the canvas. The default setting is 5 pixels.
     155
     156   \param margin Margin
     157
     158   \sa spacing(), margin()
    158159 */
    159160void QwtPlotAbstractBarChart::setMargin( int margin )
    160161{
    161162    margin = qMax( margin, 0 );
    162     if ( margin != d_data->margin )
    163     {
    164         d_data->margin = margin;
    165         itemChanged();
    166     }
    167 }
    168 
    169 /*!
    170   \return Margin between the outmost bars and the contentsRect()
    171   of the canvas.
    172 
    173   \sa setMargin(), spacing()
     163    if ( margin != m_data->margin )
     164    {
     165        m_data->margin = margin;
     166        itemChanged();
     167    }
     168}
     169
     170/*!
     171   \return Margin between the outmost bars and the contentsRect()
     172   of the canvas.
     173
     174   \sa setMargin(), spacing()
    174175 */
    175176int QwtPlotAbstractBarChart::margin() const
    176177{
    177     return d_data->margin;
     178    return m_data->margin;
    178179}
    179180
    … …  
    191192
    192193   \sa baseline(), QwtPlotSeriesItem::orientation()
    193 */
     194 */
    194195void QwtPlotAbstractBarChart::setBaseline( double value )
    195196{
    196     if ( value != d_data->baseline )
    197     {
    198         d_data->baseline = value;
     197    if ( value != m_data->baseline )
     198    {
     199        m_data->baseline = value;
    199200        itemChanged();
    200201    }
    … …  
    207208double QwtPlotAbstractBarChart::baseline() const
    208209{
    209     return d_data->baseline;
     210    return m_data->baseline;
    210211}
    211212
    … …  
    221222   \return Sample width
    222223   \sa layoutPolicy(), layoutHint()
    223 */
    224 double QwtPlotAbstractBarChart::sampleWidth( const QwtScaleMap &map,
     224 */
     225double QwtPlotAbstractBarChart::sampleWidth( const QwtScaleMap& map,
    225226    double canvasSize, double boundingSize, double value ) const
    226227{
    227228    double width;
    228229
    229     switch( d_data->layoutPolicy )
     230    switch( m_data->layoutPolicy )
    230231    {
    231232        case ScaleSamplesToAxes:
    232233        {
    233             width = qwtTransformWidth( map, value, d_data->layoutHint );
     234            width = qwtTransformWidth( map, value, m_data->layoutHint );
    234235            break;
    235236        }
    236237        case ScaleSampleToCanvas:
    237238        {
    238             width = canvasSize * d_data->layoutHint;
     239            width = canvasSize * m_data->layoutHint;
    239240            break;
    240241        }
    241242        case FixedSampleSize:
    242243        {
    243             width = d_data->layoutHint;
     244            width = m_data->layoutHint;
    244245            break;
    245246        }
    … …  
    256257
    257258            width = qwtTransformWidth( map, value, w );
    258             width -= d_data->spacing;
    259             width = qMax( width, d_data->layoutHint );
     259            width -= m_data->spacing;
     260            width = qwtMaxF( width, m_data->layoutHint );
    260261        }
    261262    }
    … …  
    281282   \param bottom Returns the bottom margin
    282283
    283    \return Margin
    284 
    285284   \sa layoutPolicy(), layoutHint(), QwtPlotItem::Margins
    286285       QwtPlot::getCanvasMarginsHint(), QwtPlot::updateCanvasMargins()
    287286 */
    288 void QwtPlotAbstractBarChart::getCanvasMarginHint( const QwtScaleMap &xMap,
    289     const QwtScaleMap &yMap, const QRectF &canvasRect,
    290     double &left, double &top, double &right, double &bottom ) const
     287void QwtPlotAbstractBarChart::getCanvasMarginHint( const QwtScaleMap& xMap,
     288    const QwtScaleMap& yMap, const QRectF& canvasRect,
     289    double& left, double& top, double& right, double& bottom ) const
    291290{
    292291    double hint = -1.0;
    … …  
    297296        {
    298297            if ( orientation() == Qt::Vertical )
    299                 hint = 0.5 * canvasRect.width() * d_data->layoutHint;
     298                hint = 0.5 * canvasRect.width() * m_data->layoutHint;
    300299            else
    301                 hint = 0.5 * canvasRect.height() * d_data->layoutHint;
     300                hint = 0.5 * canvasRect.height() * m_data->layoutHint;
    302301
    303302            break;
    … …  
    305304        case FixedSampleSize:
    306305        {
    307             hint = 0.5 * d_data->layoutHint;
     306            hint = 0.5 * m_data->layoutHint;
    308307            break;
    309308        }
    … …  
    324323            if ( layoutPolicy() == ScaleSamplesToAxes )
    325324            {
    326                 sampleWidthS = qMax( d_data->layoutHint, 0.0 );
     325                sampleWidthS = qwtMaxF( m_data->layoutHint, 0.0 );
    327326            }
    328327            else
    329328            {
    330                 spacing = d_data->spacing;
     329                spacing = m_data->spacing;
    331330
    332331                if ( numSamples > 1 )
    … …  
    352351
    353352            hint = 0.5 * sampleWidthP;
    354             hint += qMax( d_data->margin, 0 );
     353            hint += qMax( m_data->margin, 0 );
    355354        }
    356355    }
Note: See TracChangeset for help on using the changeset viewer.