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

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    99
    1010#include "qwt_column_symbol.h"
     11#include "qwt_painter.h"
    1112#include "qwt_math.h"
    12 #include "qwt_painter.h"
     13
    1314#include <qpainter.h>
    1415#include <qpalette.h>
    1516
    16 static void qwtDrawBox( QPainter *p, const QRectF &rect,
    17     const QPalette &pal, double lw )
     17static void qwtDrawBox( QPainter* p, const QRectF& rect,
     18    const QPalette& pal, double lw )
    1819{
    1920    if ( lw > 0.0 )
    … …  
    3334        }
    3435
    35         lw = qMin( lw, rect.height() / 2.0 - 1.0 );
    36         lw = qMin( lw, rect.width() / 2.0 - 1.0 );
     36        lw = qwtMinF( lw, rect.height() / 2.0 - 1.0 );
     37        lw = qwtMinF( lw, rect.width() / 2.0 - 1.0 );
    3738
    3839        const QRectF outerRect = rect.adjusted( 0, 0, 1, 1 );
    3940        QPolygonF polygon( outerRect );
    4041
    41         if ( outerRect.width() > 2 * lw &&
    42                 outerRect.height() > 2 * lw )
     42        if ( outerRect.width() > 2 * lw && outerRect.height() > 2 * lw )
    4343        {
    4444            const QRectF innerRect = outerRect.adjusted( lw, lw, -lw, -lw );
    … …  
    5757}
    5858
    59 static void qwtDrawPanel( QPainter *painter, const QRectF &rect,
    60     const QPalette &pal, double lw )
     59static void qwtDrawPanel( QPainter* painter, const QRectF& rect,
     60    const QPalette& pal, double lw )
    6161{
    6262    if ( lw > 0.0 )
    … …  
    7676        }
    7777
    78         lw = qMin( lw, rect.height() / 2.0 - 1.0 );
    79         lw = qMin( lw, rect.width() / 2.0 - 1.0 );
     78        lw = qwtMinF( lw, rect.height() / 2.0 - 1.0 );
     79        lw = qwtMinF( lw, rect.width() / 2.0 - 1.0 );
    8080
    8181        const QRectF outerRect = rect.adjusted( 0, 0, 1, 1 );
    … …  
    111111class QwtColumnSymbol::PrivateData
    112112{
    113 public:
    114     PrivateData():
    115         style( QwtColumnSymbol::Box ),
    116         frameStyle( QwtColumnSymbol::Raised ),
    117         palette( Qt::gray ),
    118         lineWidth( 2 )
     113  public:
     114    PrivateData()
     115        : style( QwtColumnSymbol::Box )
     116        , frameStyle( QwtColumnSymbol::Raised )
     117        , palette( Qt::gray )
     118        , lineWidth( 2 )
    119119    {
    120120    }
    … …  
    128128
    129129/*!
    130   Constructor
    131 
    132   \param style Style of the symbol
    133   \sa setStyle(), style(), Style
    134 */
     130   Constructor
     131
     132   \param style Style of the symbol
     133   \sa setStyle(), style(), Style
     134 */
    135135QwtColumnSymbol::QwtColumnSymbol( Style style )
    136136{
    137     d_data = new PrivateData();
    138     d_data->style = style;
     137    m_data = new PrivateData();
     138    m_data->style = style;
    139139}
    140140
    … …  
    142142QwtColumnSymbol::~QwtColumnSymbol()
    143143{
    144     delete d_data;
    145 }
    146 
    147 /*!
    148   Specify the symbol style
    149 
    150   \param style Style
    151   \sa style(), setPalette()
    152 */
     144    delete m_data;
     145}
     146
     147/*!
     148   Specify the symbol style
     149
     150   \param style Style
     151   \sa style(), setPalette()
     152 */
    153153void QwtColumnSymbol::setStyle( Style style )
    154154{
    155     d_data->style = style;
    156 }
    157 
    158 /*!
    159   \return Current symbol style
    160   \sa setStyle()
    161 */
     155    m_data->style = style;
     156}
     157
     158/*!
     159   \return Current symbol style
     160   \sa setStyle()
     161 */
    162162QwtColumnSymbol::Style QwtColumnSymbol::style() const
    163163{
    164     return d_data->style;
    165 }
    166 
    167 /*!
    168   Assign a palette for the symbol
    169 
    170   \param palette Palette
    171   \sa palette(), setStyle()
    172 */
    173 void QwtColumnSymbol::setPalette( const QPalette &palette )
    174 {
    175     d_data->palette = palette;
    176 }
    177 
    178 /*!
    179   \return Current palette
    180   \sa setPalette()
    181 */
     164    return m_data->style;
     165}
     166
     167/*!
     168   Assign a palette for the symbol
     169
     170   \param palette Palette
     171   \sa palette(), setStyle()
     172 */
     173void QwtColumnSymbol::setPalette( const QPalette& palette )
     174{
     175    m_data->palette = palette;
     176}
     177
     178/*!
     179   \return Current palette
     180   \sa setPalette()
     181 */
    182182const QPalette& QwtColumnSymbol::palette() const
    183183{
    184     return d_data->palette;
     184    return m_data->palette;
    185185}
    186186
    … …  
    190190   \param frameStyle Frame style
    191191   \sa frameStyle(), setLineWidth(), setStyle()
    192 */
     192 */
    193193void QwtColumnSymbol::setFrameStyle( FrameStyle frameStyle )
    194194{
    195     d_data->frameStyle = frameStyle;
    196 }
    197 
    198 /*!
    199   \return Current frame style, that is used for the Box style.
    200   \sa setFrameStyle(), lineWidth(), setStyle()
    201 */
     195    m_data->frameStyle = frameStyle;
     196}
     197
     198/*!
     199   \return Current frame style, that is used for the Box style.
     200   \sa setFrameStyle(), lineWidth(), setStyle()
     201 */
    202202QwtColumnSymbol::FrameStyle QwtColumnSymbol::frameStyle() const
    203203{
    204     return d_data->frameStyle;
     204    return m_data->frameStyle;
    205205}
    206206
    … …  
    210210   \param width Width
    211211   \sa lineWidth(), setFrameStyle()
    212 */
     212 */
    213213void QwtColumnSymbol::setLineWidth( int width )
    214214{
    … …  
    216216        width = 0;
    217217
    218     d_data->lineWidth = width;
    219 }
    220 
    221 /*!
    222   \return Line width of the frame, that is used for the Box style.
    223   \sa setLineWidth(), frameStyle(), setStyle()
    224 */
     218    m_data->lineWidth = width;
     219}
     220
     221/*!
     222   \return Line width of the frame, that is used for the Box style.
     223   \sa setLineWidth(), frameStyle(), setStyle()
     224 */
    225225int QwtColumnSymbol::lineWidth() const
    226226{
    227     return d_data->lineWidth;
    228 }
    229 
    230 /*!
    231   Draw the symbol depending on its style.
    232 
    233   \param painter Painter
    234   \param rect Directed rectangle
    235 
    236   \sa drawBox()
    237 */
    238 void QwtColumnSymbol::draw( QPainter *painter,
    239     const QwtColumnRect &rect ) const
     227    return m_data->lineWidth;
     228}
     229
     230/*!
     231   Draw the symbol depending on its style.
     232
     233   \param painter Painter
     234   \param rect Directed rectangle
     235
     236   \sa drawBox()
     237 */
     238void QwtColumnSymbol::draw( QPainter* painter,
     239    const QwtColumnRect& rect ) const
    240240{
    241241    painter->save();
    242242
    243     switch ( d_data->style )
     243    switch ( m_data->style )
    244244    {
    245245        case QwtColumnSymbol::Box:
    … …  
    255255
    256256/*!
    257   Draw the symbol when it is in Box style.
    258 
    259   \param painter Painter
    260   \param rect Directed rectangle
    261 
    262   \sa draw()
    263 */
    264 void QwtColumnSymbol::drawBox( QPainter *painter,
    265     const QwtColumnRect &rect ) const
     257   Draw the symbol when it is in Box style.
     258
     259   \param painter Painter
     260   \param rect Directed rectangle
     261
     262   \sa draw()
     263 */
     264void QwtColumnSymbol::drawBox( QPainter* painter,
     265    const QwtColumnRect& rect ) const
    266266{
    267267    QRectF r = rect.toRect();
    … …  
    274274    }
    275275
    276     switch ( d_data->frameStyle )
     276    switch ( m_data->frameStyle )
    277277    {
    278278        case QwtColumnSymbol::Raised:
    279279        {
    280             qwtDrawPanel( painter, r, d_data->palette, d_data->lineWidth );
     280            qwtDrawPanel( painter, r, m_data->palette, m_data->lineWidth );
    281281            break;
    282282        }
    283283        case QwtColumnSymbol::Plain:
    284284        {
    285             qwtDrawBox( painter, r, d_data->palette, d_data->lineWidth );
     285            qwtDrawBox( painter, r, m_data->palette, m_data->lineWidth );
    286286            break;
    287287        }
    288288        default:
    289289        {
    290             painter->fillRect( r.adjusted( 0, 0, 1, 1 ), d_data->palette.window() );
    291         }
    292     }
    293 }
     290            painter->fillRect( r.adjusted( 0, 0, 1, 1 ), m_data->palette.window() );
     291        }
     292    }
     293}
     294
     295//! \return A normalized QRect built from the intervals
     296QRectF QwtColumnRect::toRect() const
     297{
     298    QRectF r( hInterval.minValue(), vInterval.minValue(),
     299        hInterval.maxValue() - hInterval.minValue(),
     300        vInterval.maxValue() - vInterval.minValue() );
     301
     302    r = r.normalized();
     303
     304    if ( hInterval.borderFlags() & QwtInterval::ExcludeMinimum )
     305        r.adjust( 1, 0, 0, 0 );
     306
     307    if ( hInterval.borderFlags() & QwtInterval::ExcludeMaximum )
     308        r.adjust( 0, 0, -1, 0 );
     309
     310    if ( vInterval.borderFlags() & QwtInterval::ExcludeMinimum )
     311        r.adjust( 0, 1, 0, 0 );
     312
     313    if ( vInterval.borderFlags() & QwtInterval::ExcludeMaximum )
     314        r.adjust( 0, 0, 0, -1 );
     315
     316    return r;
     317}
     318
Note: See TracChangeset for help on using the changeset viewer.