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_zoneitem.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_scale_map.h"
     13#include "qwt_text.h"
     14#include "qwt_interval.h"
     15
    1316#include <qpainter.h>
    1417
    1518class QwtPlotZoneItem::PrivateData
    1619{
    17 public:
    18     PrivateData():
    19         orientation( Qt::Vertical ),
    20         pen( Qt::NoPen )
     20  public:
     21    PrivateData()
     22        : orientation( Qt::Vertical )
     23        , pen( Qt::NoPen )
    2124    {
    2225        QColor c( Qt::darkGray );
    … …  
    4447
    4548   \sa QwtPlotItem::setItemAttribute(), QwtPlotItem::setZ()
    46 */
    47 QwtPlotZoneItem::QwtPlotZoneItem():
    48     QwtPlotItem( QwtText( "Zone" ) )
    49 {
    50     d_data = new PrivateData;
     49 */
     50QwtPlotZoneItem::QwtPlotZoneItem()
     51    : QwtPlotItem( QwtText( "Zone" ) )
     52{
     53    m_data = new PrivateData;
    5154
    5255    setItemAttribute( QwtPlotItem::AutoScale, false );
    … …  
    5962QwtPlotZoneItem::~QwtPlotZoneItem()
    6063{
    61     delete d_data;
     64    delete m_data;
    6265}
    6366
    … …  
    6972
    7073/*!
    71   Build and assign a pen
    72 
    73   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
    74   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
    75   to hide this incompatibility.
    76 
    77   \param color Pen color
    78   \param width Pen width
    79   \param style Pen style
    80 
    81   \sa pen(), brush()
    82  */
    83 void QwtPlotZoneItem::setPen( const QColor &color, qreal width, Qt::PenStyle style )
     74   Build and assign a pen
     75
     76   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
     77   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
     78   to hide this incompatibility.
     79
     80   \param color Pen color
     81   \param width Pen width
     82   \param style Pen style
     83
     84   \sa pen(), brush()
     85 */
     86void QwtPlotZoneItem::setPen( const QColor& color, qreal width, Qt::PenStyle style )
    8487{
    8588    setPen( QPen( color, width, style ) );
    … …  
    8790
    8891/*!
    89   \brief Assign a pen
    90 
    91   The pen is used to draw the border lines of the zone
    92 
    93   \param pen Pen
    94   \sa pen(), setBrush()
    95 */
    96 void QwtPlotZoneItem::setPen( const QPen &pen )
    97 {
    98     if ( d_data->pen != pen )
    99     {
    100         d_data->pen = pen;
     92   \brief Assign a pen
     93
     94   The pen is used to draw the border lines of the zone
     95
     96   \param pen Pen
     97   \sa pen(), setBrush()
     98 */
     99void QwtPlotZoneItem::setPen( const QPen& pen )
     100{
     101    if ( m_data->pen != pen )
     102    {
     103        m_data->pen = pen;
    101104        itemChanged();
    102105    }
    … …  
    104107
    105108/*!
    106   \return Pen used to draw the border lines
    107   \sa setPen(), brush()
    108 */
    109 const QPen &QwtPlotZoneItem::pen() const
    110 {
    111     return d_data->pen;
    112 }
    113 
    114 /*!
    115   \brief Assign a brush
    116 
    117   The brush is used to fill the zone
    118 
    119   \param brush Brush
    120   \sa pen(), setBrush()
    121 */
    122 void QwtPlotZoneItem::setBrush( const QBrush &brush )
    123 {
    124     if ( d_data->brush != brush )
    125     {
    126         d_data->brush = brush;
     109   \return Pen used to draw the border lines
     110   \sa setPen(), brush()
     111 */
     112const QPen& QwtPlotZoneItem::pen() const
     113{
     114    return m_data->pen;
     115}
     116
     117/*!
     118   \brief Assign a brush
     119
     120   The brush is used to fill the zone
     121
     122   \param brush Brush
     123   \sa pen(), setBrush()
     124 */
     125void QwtPlotZoneItem::setBrush( const QBrush& brush )
     126{
     127    if ( m_data->brush != brush )
     128    {
     129        m_data->brush = brush;
    127130        itemChanged();
    128131    }
    … …  
    130133
    131134/*!
    132   \return Brush used to fill the zone
    133   \sa setPen(), brush()
    134 */
    135 const QBrush &QwtPlotZoneItem::brush() const
    136 {
    137     return d_data->brush;
    138 }
    139 
    140 /*!
    141   \brief Set the orientation of the zone
    142 
    143   A horizontal zone highlights an interval of the y axis,
    144   a vertical zone of the x axis. It is unbounded in the
    145   opposite direction.
    146 
    147   \sa orientation(), QwtPlotItem::setAxes()
    148 */
     135   \return Brush used to fill the zone
     136   \sa setPen(), brush()
     137 */
     138const QBrush& QwtPlotZoneItem::brush() const
     139{
     140    return m_data->brush;
     141}
     142
     143/*!
     144   \brief Set the orientation of the zone
     145
     146   A horizontal zone highlights an interval of the y axis,
     147   a vertical zone of the x axis. It is unbounded in the
     148   opposite direction.
     149
     150   \sa orientation(), QwtPlotItem::setAxes()
     151 */
    149152void QwtPlotZoneItem::setOrientation( Qt::Orientation orientation )
    150153{
    151     if ( d_data->orientation != orientation )
    152     {
    153         d_data->orientation = orientation;
     154    if ( m_data->orientation != orientation )
     155    {
     156        m_data->orientation = orientation;
    154157        itemChanged();
    155158    }
    … …  
    157160
    158161/*!
    159   \return Orientation of the zone
    160   \sa setOrientation()
    161  */
    162 Qt::Orientation QwtPlotZoneItem::orientation()
    163 {
    164     return d_data->orientation;
    165 }
    166 
    167 /*!
    168   Set the interval of the zone
    169 
    170   For a horizontal zone the interval is related to the y axis,
    171   for a vertical zone it is related to the x axis.
    172 
    173   \param min Minimum of the interval
    174   \param max Maximum of the interval
    175 
    176   \sa interval(), setOrientation()
     162   \return Orientation of the zone
     163   \sa setOrientation()
     164 */
     165Qt::Orientation QwtPlotZoneItem::orientation() const
     166{
     167    return m_data->orientation;
     168}
     169
     170/*!
     171   Set the interval of the zone
     172
     173   For a horizontal zone the interval is related to the y axis,
     174   for a vertical zone it is related to the x axis.
     175
     176   \param min Minimum of the interval
     177   \param max Maximum of the interval
     178
     179   \sa interval(), setOrientation()
    177180 */
    178181void QwtPlotZoneItem::setInterval( double min, double max )
    … …  
    182185
    183186/*!
    184   Set the interval of the zone
    185 
    186   For a horizontal zone the interval is related to the y axis,
    187   for a vertical zone it is related to the x axis.
    188 
    189   \param interval Zone interval
    190 
    191   \sa interval(), setOrientation()
    192  */
    193 void QwtPlotZoneItem::setInterval( const QwtInterval &interval )
    194 {
    195     if ( d_data->interval != interval )
    196     {
    197         d_data->interval = interval;
     187   Set the interval of the zone
     188
     189   For a horizontal zone the interval is related to the y axis,
     190   for a vertical zone it is related to the x axis.
     191
     192   \param interval Zone interval
     193
     194   \sa interval(), setOrientation()
     195 */
     196void QwtPlotZoneItem::setInterval( const QwtInterval& interval )
     197{
     198    if ( m_data->interval != interval )
     199    {
     200        m_data->interval = interval;
    198201        itemChanged();
    199202    }
    … …  
    201204
    202205/*!
    203   \return Zone interval
    204   \sa setInterval(), orientation()
     206   \return Zone interval
     207   \sa setInterval(), orientation()
    205208 */
    206209QwtInterval QwtPlotZoneItem::interval() const
    207210{
    208     return d_data->interval;
    209 }
    210 
    211 /*!
    212   Draw the zone
    213 
    214   \param painter Painter
    215   \param xMap x Scale Map
    216   \param yMap y Scale Map
    217   \param canvasRect Contents rectangle of the canvas in painter coordinates
    218 */
    219 
    220 void QwtPlotZoneItem::draw( QPainter *painter,
    221     const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    222     const QRectF &canvasRect ) const
    223 {
    224     if ( !d_data->interval.isValid() )
     211    return m_data->interval;
     212}
     213
     214/*!
     215   Draw the zone
     216
     217   \param painter Painter
     218   \param xMap x Scale Map
     219   \param yMap y Scale Map
     220   \param canvasRect Contents rectangle of the canvas in painter coordinates
     221 */
     222
     223void QwtPlotZoneItem::draw( QPainter* painter,
     224    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     225    const QRectF& canvasRect ) const
     226{
     227    if ( !m_data->interval.isValid() )
    225228        return;
    226229
    227     QPen pen = d_data->pen;
     230    QPen pen = m_data->pen;
    228231    pen.setCapStyle( Qt::FlatCap );
    229232
    230233    const bool doAlign = QwtPainter::roundingAlignment( painter );
    231234
    232     if ( d_data->orientation == Qt::Horizontal )
    233     {
    234         double y1 = yMap.transform( d_data->interval.minValue() );
    235         double y2 = yMap.transform( d_data->interval.maxValue() );
     235    if ( m_data->orientation == Qt::Horizontal )
     236    {
     237        double y1 = yMap.transform( m_data->interval.minValue() );
     238        double y2 = yMap.transform( m_data->interval.maxValue() );
    236239
    237240        if ( doAlign )
    … …  
    244247        r = r.normalized();
    245248
    246         if ( ( d_data->brush.style() != Qt::NoBrush ) && ( y1 != y2 ) )
    247         {
    248             QwtPainter::fillRect( painter, r, d_data->brush );
    249         }
    250 
    251         if ( d_data->pen.style() != Qt::NoPen )
    252         {
    253             painter->setPen( d_data->pen );
     249        if ( ( m_data->brush.style() != Qt::NoBrush ) && ( y1 != y2 ) )
     250        {
     251            QwtPainter::fillRect( painter, r, m_data->brush );
     252        }
     253
     254        if ( m_data->pen.style() != Qt::NoPen )
     255        {
     256            painter->setPen( m_data->pen );
    254257
    255258            QwtPainter::drawLine( painter, r.left(), r.top(), r.right(), r.top() );
    … …  
    259262    else
    260263    {
    261         double x1 = xMap.transform( d_data->interval.minValue() );
    262         double x2 = xMap.transform( d_data->interval.maxValue() );
     264        double x1 = xMap.transform( m_data->interval.minValue() );
     265        double x2 = xMap.transform( m_data->interval.maxValue() );
    263266
    264267        if ( doAlign )
    … …  
    271274        r = r.normalized();
    272275
    273         if ( ( d_data->brush.style() != Qt::NoBrush ) && ( x1 != x2 ) )
    274         {
    275             QwtPainter::fillRect( painter, r, d_data->brush );
    276         }
    277 
    278         if ( d_data->pen.style() != Qt::NoPen )
    279         {
    280             painter->setPen( d_data->pen );
     276        if ( ( m_data->brush.style() != Qt::NoBrush ) && ( x1 != x2 ) )
     277        {
     278            QwtPainter::fillRect( painter, r, m_data->brush );
     279        }
     280
     281        if ( m_data->pen.style() != Qt::NoPen )
     282        {
     283            painter->setPen( m_data->pen );
    281284
    282285            QwtPainter::drawLine( painter, r.left(), r.top(), r.left(), r.bottom() );
    … …  
    287290
    288291/*!
    289   The bounding rectangle is build from the interval in one direction
    290   and something invalid for the opposite direction.
    291 
    292   \return An invalid rectangle with valid boundaries in one direction
    293 */
     292   The bounding rectangle is build from the interval in one direction
     293   and something invalid for the opposite direction.
     294
     295   \return An invalid rectangle with valid boundaries in one direction
     296 */
    294297QRectF QwtPlotZoneItem::boundingRect() const
    295298{
    296299    QRectF br = QwtPlotItem::boundingRect();
    297300
    298     const QwtInterval &intv = d_data->interval;
     301    const QwtInterval& intv = m_data->interval;
    299302
    300303    if ( intv.isValid() )
    301304    {
    302         if ( d_data->orientation == Qt::Horizontal )
     305        if ( m_data->orientation == Qt::Horizontal )
    303306        {
    304307            br.setTop( intv.minValue() );
Note: See TracChangeset for help on using the changeset viewer.