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

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    1111#include "qwt_painter.h"
    1212#include "qwt_math.h"
     13
    1314#include <qpainter.h>
    14 
    15 #if QT_VERSION < 0x040601
    16 #define qAtan2(y, x) ::atan2(y, x)
    17 #define qFastSin(x) qSin(x)
    18 #define qFastCos(x) qCos(x)
    19 #endif
     15#include <qmath.h>
    2016
    2117class QwtIntervalSymbol::PrivateData
    2218{
    23 public:
    24     PrivateData():
    25         style( QwtIntervalSymbol::NoSymbol ),
    26         width( 6 )
     19  public:
     20    PrivateData()
     21        : style( QwtIntervalSymbol::NoSymbol )
     22        , width( 6 )
    2723    {
    2824    }
    2925
    30     bool operator==( const PrivateData &other ) const
     26    bool operator==( const PrivateData& other ) const
    3127    {
    3228        return ( style == other.style )
    33             && ( width == other.width )
    34             && ( brush == other.brush )
    35             && ( pen == other.pen );
     29               && ( width == other.width )
     30               && ( brush == other.brush )
     31               && ( pen == other.pen );
    3632    }
    3733
    … …  
    4440
    4541/*!
    46   Constructor
    47 
    48   \param style Style of the symbol
    49   \sa setStyle(), style(), Style
    50 */
     42   Constructor
     43
     44   \param style Style of the symbol
     45   \sa setStyle(), style(), Style
     46 */
    5147QwtIntervalSymbol::QwtIntervalSymbol( Style style )
    5248{
    53     d_data = new PrivateData();
    54     d_data->style = style;
     49    m_data = new PrivateData();
     50    m_data->style = style;
    5551}
    5652
    5753//! Copy constructor
    58 QwtIntervalSymbol::QwtIntervalSymbol( const QwtIntervalSymbol &other )
    59 {
    60     d_data = new PrivateData();
    61     *d_data = *other.d_data;
     54QwtIntervalSymbol::QwtIntervalSymbol( const QwtIntervalSymbol& other )
     55{
     56    m_data = new PrivateData();
     57    *m_data = *other.m_data;
    6258}
    6359
    … …  
    6561QwtIntervalSymbol::~QwtIntervalSymbol()
    6662{
    67     delete d_data;
     63    delete m_data;
    6864}
    6965
    7066//! \brief Assignment operator
    71 QwtIntervalSymbol &QwtIntervalSymbol::operator=(
    72     const QwtIntervalSymbol &other )
    73 {
    74     *d_data = *other.d_data;
     67QwtIntervalSymbol& QwtIntervalSymbol::operator=(
     68    const QwtIntervalSymbol& other )
     69{
     70    *m_data = *other.m_data;
    7571    return *this;
    7672}
    … …  
    7874//! \brief Compare two symbols
    7975bool QwtIntervalSymbol::operator==(
    80     const QwtIntervalSymbol &other ) const
    81 {
    82     return *d_data == *other.d_data;
     76    const QwtIntervalSymbol& other ) const
     77{
     78    return *m_data == *other.m_data;
    8379}
    8480
    8581//! \brief Compare two symbols
    8682bool QwtIntervalSymbol::operator!=(
    87     const QwtIntervalSymbol &other ) const
    88 {
    89     return !( *d_data == *other.d_data );
    90 }
    91 
    92 /*!
    93   Specify the symbol style
    94 
    95   \param style Style
    96   \sa style(), Style
    97 */
     83    const QwtIntervalSymbol& other ) const
     84{
     85    return !( *m_data == *other.m_data );
     86}
     87
     88/*!
     89   Specify the symbol style
     90
     91   \param style Style
     92   \sa style(), Style
     93 */
    9894void QwtIntervalSymbol::setStyle( Style style )
    9995{
    100     d_data->style = style;
    101 }
    102 
    103 /*!
    104   \return Current symbol style
    105   \sa setStyle()
    106 */
     96    m_data->style = style;
     97}
     98
     99/*!
     100   \return Current symbol style
     101   \sa setStyle()
     102 */
    107103QwtIntervalSymbol::Style QwtIntervalSymbol::style() const
    108104{
    109     return d_data->style;
    110 }
    111 
    112 /*!
    113   Specify the width of the symbol
    114   It is used depending on the style.
    115 
    116   \param width Width
    117   \sa width(), setStyle()
    118 */
     105    return m_data->style;
     106}
     107
     108/*!
     109   Specify the width of the symbol
     110   It is used depending on the style.
     111
     112   \param width Width
     113   \sa width(), setStyle()
     114 */
    119115void QwtIntervalSymbol::setWidth( int width )
    120116{
    121     d_data->width = width;
    122 }
    123 
    124 /*!
    125   \return Width of the symbol.
    126   \sa setWidth(), setStyle()
    127 */
     117    m_data->width = width;
     118}
     119
     120/*!
     121   \return Width of the symbol.
     122   \sa setWidth(), setStyle()
     123 */
    128124int QwtIntervalSymbol::width() const
    129125{
    130     return d_data->width;
    131 }
    132 
    133 /*!
    134   \brief Assign a brush
    135 
    136   The brush is used for the Box style.
    137 
    138   \param brush Brush
    139   \sa brush()
    140 */
    141 void QwtIntervalSymbol::setBrush( const QBrush &brush )
    142 {
    143     d_data->brush = brush;
    144 }
    145 
    146 /*!
    147   \return Brush
    148   \sa setBrush()
    149 */
     126    return m_data->width;
     127}
     128
     129/*!
     130   \brief Assign a brush
     131
     132   The brush is used for the Box style.
     133
     134   \param brush Brush
     135   \sa brush()
     136 */
     137void QwtIntervalSymbol::setBrush( const QBrush& brush )
     138{
     139    m_data->brush = brush;
     140}
     141
     142/*!
     143   \return Brush
     144   \sa setBrush()
     145 */
    150146const QBrush& QwtIntervalSymbol::brush() const
    151147{
    152     return d_data->brush;
    153 }
    154 
    155 /*!
    156   Build and assign a pen
    157 
    158   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
    159   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
    160   to hide this incompatibility.
    161 
    162   \param color Pen color
    163   \param width Pen width
    164   \param style Pen style
    165 
    166   \sa pen(), brush()
    167  */
    168 void QwtIntervalSymbol::setPen( const QColor &color,
     148    return m_data->brush;
     149}
     150
     151/*!
     152   Build and assign a pen
     153
     154   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
     155   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
     156   to hide this incompatibility.
     157
     158   \param color Pen color
     159   \param width Pen width
     160   \param style Pen style
     161
     162   \sa pen(), brush()
     163 */
     164void QwtIntervalSymbol::setPen( const QColor& color,
    169165    qreal width, Qt::PenStyle style )
    170166{
    … …  
    173169
    174170/*!
    175   Assign a pen
    176 
    177   \param pen Pen
    178   \sa pen(), setBrush()
    179 */
    180 void QwtIntervalSymbol::setPen( const QPen &pen )
    181 {
    182     d_data->pen = pen;
    183 }
    184 
    185 /*!
    186   \return Pen
    187   \sa setPen(), brush()
    188 */
     171   Assign a pen
     172
     173   \param pen Pen
     174   \sa pen(), setBrush()
     175 */
     176void QwtIntervalSymbol::setPen( const QPen& pen )
     177{
     178    m_data->pen = pen;
     179}
     180
     181/*!
     182   \return Pen
     183   \sa setPen(), brush()
     184 */
    189185const QPen& QwtIntervalSymbol::pen() const
    190186{
    191     return d_data->pen;
    192 }
    193 
    194 /*!
    195   Draw a symbol depending on its style
    196 
    197   \param painter Painter
    198   \param orientation Orientation
    199   \param from Start point of the interval in target device coordinates
    200   \param to End point of the interval in target device coordinates
    201 
    202   \sa setStyle()
    203 */
    204 void QwtIntervalSymbol::draw( QPainter *painter, Qt::Orientation orientation,
    205     const QPointF &from, const QPointF &to ) const
    206 {
    207     const qreal pw = qMax( painter->pen().widthF(), qreal( 1.0 ) );
     187    return m_data->pen;
     188}
     189
     190/*!
     191   Draw a symbol depending on its style
     192
     193   \param painter Painter
     194   \param orientation Orientation
     195   \param from Start point of the interval in target device coordinates
     196   \param to End point of the interval in target device coordinates
     197
     198   \sa setStyle()
     199 */
     200void QwtIntervalSymbol::draw( QPainter* painter, Qt::Orientation orientation,
     201    const QPointF& from, const QPointF& to ) const
     202{
     203    const qreal pw = QwtPainter::effectivePenWidth( painter->pen() );
    208204
    209205    QPointF p1 = from;
    … …  
    215211    }
    216212
    217     switch ( d_data->style )
     213    switch ( m_data->style )
    218214    {
    219215        case QwtIntervalSymbol::Bar:
    220216        {
    221217            QwtPainter::drawLine( painter, p1, p2 );
    222             if ( d_data->width > pw )
     218            if ( m_data->width > pw )
    223219            {
    224220                if ( ( orientation == Qt::Horizontal )
    225221                    && ( p1.y() == p2.y() ) )
    226222                {
    227                     const double sw = d_data->width;
     223                    const double sw = m_data->width;
    228224
    229225                    const double y = p1.y() - sw / 2;
    … …  
    236232                    && ( p1.x() == p2.x() ) )
    237233                {
    238                     const double sw = d_data->width;
     234                    const double sw = m_data->width;
    239235
    240236                    const double x = p1.x() - sw / 2;
    … …  
    246242                else
    247243                {
    248                     const double sw = d_data->width;
     244                    const double sw = m_data->width;
    249245
    250246                    const double dx = p2.x() - p1.x();
    251247                    const double dy = p2.y() - p1.y();
    252                     const double angle = qAtan2( dy, dx ) + M_PI_2;
     248                    const double angle = std::atan2( dy, dx ) + M_PI_2;
    253249                    double dw2 = sw / 2.0;
    254250
    … …  
    268264        case QwtIntervalSymbol::Box:
    269265        {
    270             if ( d_data->width <= pw )
     266            if ( m_data->width <= pw )
    271267            {
    272268                QwtPainter::drawLine( painter, p1, p2 );
    … …  
    277273                    && ( p1.y() == p2.y() ) )
    278274                {
    279                     const double sw = d_data->width;
    280 
    281                     const double y = p1.y() - d_data->width / 2;
     275                    const double sw = m_data->width;
     276
     277                    const double y = p1.y() - m_data->width / 2;
    282278                    QwtPainter::drawRect( painter,
    283279                        p1.x(), y, p2.x() - p1.x(),  sw );
    … …  
    286282                    && ( p1.x() == p2.x() ) )
    287283                {
    288                     const double sw = d_data->width;
    289 
    290                     const double x = p1.x() - d_data->width / 2;
     284                    const double sw = m_data->width;
     285
     286                    const double x = p1.x() - m_data->width / 2;
    291287                    QwtPainter::drawRect( painter,
    292288                        x, p1.y(), sw, p2.y() - p1.y() );
    … …  
    294290                else
    295291                {
    296                     const double sw = d_data->width;
     292                    const double sw = m_data->width;
    297293
    298294                    const double dx = p2.x() - p1.x();
    299295                    const double dy = p2.y() - p1.y();
    300                     const double angle = qAtan2( dy, dx ) + M_PI_2;
     296                    const double angle = std::atan2( dy, dx ) + M_PI_2;
    301297                    double dw2 = sw / 2.0;
    302298
Note: See TracChangeset for help on using the changeset viewer.