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

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    1111#include <qpaintengine.h>
    1212#include <qpainterpath.h>
    13 #include <qpixmap.h>
    1413
    1514class QwtNullPaintDevice::PrivateData
    1615{
    17 public:
     16  public:
    1817    PrivateData():
    1918        mode( QwtNullPaintDevice::NormalMode )
    … …  
    2423};
    2524
    26 class QwtNullPaintDevice::PaintEngine: public QPaintEngine
    27 {
    28 public:
     25class QwtNullPaintDevice::PaintEngine QWT_FINAL : public QPaintEngine
     26{
     27  public:
    2928    PaintEngine();
    3029
    31     virtual bool begin( QPaintDevice * );
    32     virtual bool end();
    33 
    34     virtual Type type () const;
    35     virtual void updateState(const QPaintEngineState &);
    36 
    37     virtual void drawRects(const QRect *, int );
    38     virtual void drawRects(const QRectF *, int );
    39 
    40     virtual void drawLines(const QLine *, int );
    41     virtual void drawLines(const QLineF *, int );
    42 
    43     virtual void drawEllipse(const QRectF &);
    44     virtual void drawEllipse(const QRect &);
    45 
    46     virtual void drawPath(const QPainterPath &);
    47 
    48     virtual void drawPoints(const QPointF *, int );
    49     virtual void drawPoints(const QPoint *, int );
    50 
    51     virtual void drawPolygon(const QPointF *, int , PolygonDrawMode );
    52     virtual void drawPolygon(const QPoint *, int , PolygonDrawMode );
    53 
    54     virtual void drawPixmap(const QRectF &,
    55         const QPixmap &, const QRectF &);
    56 
    57     virtual void drawTextItem(const QPointF &, const QTextItem &);
    58 
    59     virtual void drawTiledPixmap(const QRectF &,
    60         const QPixmap &, const QPointF &s);
    61 
    62     virtual void drawImage(const QRectF &,
    63         const QImage &, const QRectF &, Qt::ImageConversionFlags );
    64 
    65 private:
    66     QwtNullPaintDevice *nullDevice();
     30    virtual bool begin( QPaintDevice* ) QWT_OVERRIDE;
     31    virtual bool end() QWT_OVERRIDE;
     32
     33    virtual Type type () const QWT_OVERRIDE;
     34    virtual void updateState(const QPaintEngineState&) QWT_OVERRIDE;
     35
     36    virtual void drawRects(const QRect*, int ) QWT_OVERRIDE;
     37    virtual void drawRects(const QRectF*, int ) QWT_OVERRIDE;
     38
     39    virtual void drawLines(const QLine*, int ) QWT_OVERRIDE;
     40    virtual void drawLines(const QLineF*, int ) QWT_OVERRIDE;
     41
     42    virtual void drawEllipse(const QRectF&) QWT_OVERRIDE;
     43    virtual void drawEllipse(const QRect&) QWT_OVERRIDE;
     44
     45    virtual void drawPath(const QPainterPath&) QWT_OVERRIDE;
     46
     47    virtual void drawPoints(const QPointF*, int ) QWT_OVERRIDE;
     48    virtual void drawPoints(const QPoint*, int ) QWT_OVERRIDE;
     49
     50    virtual void drawPolygon(
     51        const QPointF*, int, PolygonDrawMode ) QWT_OVERRIDE;
     52
     53    virtual void drawPolygon(
     54        const QPoint*, int, PolygonDrawMode ) QWT_OVERRIDE;
     55
     56    virtual void drawPixmap(const QRectF&,
     57        const QPixmap&, const QRectF&) QWT_OVERRIDE;
     58
     59    virtual void drawTextItem(
     60        const QPointF&, const QTextItem&) QWT_OVERRIDE;
     61
     62    virtual void drawTiledPixmap(const QRectF&,
     63        const QPixmap&, const QPointF& s) QWT_OVERRIDE;
     64
     65    virtual void drawImage(const QRectF&, const QImage&,
     66        const QRectF&, Qt::ImageConversionFlags ) QWT_OVERRIDE;
     67
     68  private:
     69    QwtNullPaintDevice* nullDevice();
    6770};
    6871
    69 QwtNullPaintDevice::PaintEngine::PaintEngine():
    70     QPaintEngine( QPaintEngine::AllFeatures )
    71 {
    72 }
    73 
    74 bool QwtNullPaintDevice::PaintEngine::begin( QPaintDevice * )
     72QwtNullPaintDevice::PaintEngine::PaintEngine()
     73    : QPaintEngine( QPaintEngine::AllFeatures )
     74{
     75}
     76
     77bool QwtNullPaintDevice::PaintEngine::begin( QPaintDevice* )
    7578{
    7679    setActive( true );
    … …  
    8689QPaintEngine::Type QwtNullPaintDevice::PaintEngine::type() const
    8790{
    88     return QPaintEngine::User;
     91    /*
     92        How to avoid conflicts with other 3rd party pain engines ?
     93        At least we don't use QPaintEngine::User what is known to
     94        be the value of some print engines
     95     */
     96    return static_cast< QPaintEngine::Type >( QPaintEngine::MaxUser - 2 );
    8997}
    9098
    9199void QwtNullPaintDevice::PaintEngine::drawRects(
    92     const QRect *rects, int rectCount)
    93 {
    94     QwtNullPaintDevice *device = nullDevice();
     100    const QRect* rects, int rectCount)
     101{
     102    QwtNullPaintDevice* device = nullDevice();
    95103    if ( device == NULL )
    96104        return;
    … …  
    106114
    107115void QwtNullPaintDevice::PaintEngine::drawRects(
    108     const QRectF *rects, int rectCount)
    109 {
    110     QwtNullPaintDevice *device = nullDevice();
     116    const QRectF* rects, int rectCount)
     117{
     118    QwtNullPaintDevice* device = nullDevice();
    111119    if ( device == NULL )
    112120        return;
    … …  
    122130
    123131void QwtNullPaintDevice::PaintEngine::drawLines(
    124     const QLine *lines, int lineCount)
    125 {
    126     QwtNullPaintDevice *device = nullDevice();
     132    const QLine* lines, int lineCount)
     133{
     134    QwtNullPaintDevice* device = nullDevice();
    127135    if ( device == NULL )
    128136        return;
    … …  
    138146
    139147void QwtNullPaintDevice::PaintEngine::drawLines(
    140     const QLineF *lines, int lineCount)
    141 {
    142     QwtNullPaintDevice *device = nullDevice();
     148    const QLineF* lines, int lineCount)
     149{
     150    QwtNullPaintDevice* device = nullDevice();
    143151    if ( device == NULL )
    144152        return;
    … …  
    154162
    155163void QwtNullPaintDevice::PaintEngine::drawEllipse(
    156     const QRectF &rect)
    157 {
    158     QwtNullPaintDevice *device = nullDevice();
     164    const QRectF& rect)
     165{
     166    QwtNullPaintDevice* device = nullDevice();
    159167    if ( device == NULL )
    160168        return;
    … …  
    170178
    171179void QwtNullPaintDevice::PaintEngine::drawEllipse(
    172     const QRect &rect)
    173 {
    174     QwtNullPaintDevice *device = nullDevice();
     180    const QRect& rect)
     181{
     182    QwtNullPaintDevice* device = nullDevice();
    175183    if ( device == NULL )
    176184        return;
    … …  
    187195
    188196void QwtNullPaintDevice::PaintEngine::drawPath(
    189     const QPainterPath &path)
    190 {
    191     QwtNullPaintDevice *device = nullDevice();
     197    const QPainterPath& path)
     198{
     199    QwtNullPaintDevice* device = nullDevice();
    192200    if ( device == NULL )
    193201        return;
    … …  
    197205
    198206void QwtNullPaintDevice::PaintEngine::drawPoints(
    199     const QPointF *points, int pointCount)
    200 {
    201     QwtNullPaintDevice *device = nullDevice();
     207    const QPointF* points, int pointCount)
     208{
     209    QwtNullPaintDevice* device = nullDevice();
    202210    if ( device == NULL )
    203211        return;
    … …  
    213221
    214222void QwtNullPaintDevice::PaintEngine::drawPoints(
    215     const QPoint *points, int pointCount)
    216 {
    217     QwtNullPaintDevice *device = nullDevice();
     223    const QPoint* points, int pointCount)
     224{
     225    QwtNullPaintDevice* device = nullDevice();
    218226    if ( device == NULL )
    219227        return;
    … …  
    229237
    230238void QwtNullPaintDevice::PaintEngine::drawPolygon(
    231     const QPointF *points, int pointCount, PolygonDrawMode mode)
    232 {
    233     QwtNullPaintDevice *device = nullDevice();
     239    const QPointF* points, int pointCount, PolygonDrawMode mode)
     240{
     241    QwtNullPaintDevice* device = nullDevice();
    234242    if ( device == NULL )
    235243        return;
    … …  
    257265
    258266void QwtNullPaintDevice::PaintEngine::drawPolygon(
    259     const QPoint *points, int pointCount, PolygonDrawMode mode)
    260 {
    261     QwtNullPaintDevice *device = nullDevice();
     267    const QPoint* points, int pointCount, PolygonDrawMode mode)
     268{
     269    QwtNullPaintDevice* device = nullDevice();
    262270    if ( device == NULL )
    263271        return;
    … …  
    285293
    286294void QwtNullPaintDevice::PaintEngine::drawPixmap(
    287     const QRectF &rect, const QPixmap &pm, const QRectF &subRect )
    288 {
    289     QwtNullPaintDevice *device = nullDevice();
     295    const QRectF& rect, const QPixmap& pm, const QRectF& subRect )
     296{
     297    QwtNullPaintDevice* device = nullDevice();
    290298    if ( device == NULL )
    291299        return;
    … …  
    295303
    296304void QwtNullPaintDevice::PaintEngine::drawTextItem(
    297     const QPointF &pos, const QTextItem &textItem)
    298 {
    299     QwtNullPaintDevice *device = nullDevice();
     305    const QPointF& pos, const QTextItem& textItem)
     306{
     307    QwtNullPaintDevice* device = nullDevice();
    300308    if ( device == NULL )
    301309        return;
    … …  
    311319
    312320void QwtNullPaintDevice::PaintEngine::drawTiledPixmap(
    313     const QRectF &rect, const QPixmap &pixmap,
    314     const QPointF &subRect)
    315 {
    316     QwtNullPaintDevice *device = nullDevice();
     321    const QRectF& rect, const QPixmap& pixmap,
     322    const QPointF& subRect)
     323{
     324    QwtNullPaintDevice* device = nullDevice();
    317325    if ( device == NULL )
    318326        return;
    … …  
    328336
    329337void QwtNullPaintDevice::PaintEngine::drawImage(
    330     const QRectF &rect, const QImage &image,
    331     const QRectF &subRect, Qt::ImageConversionFlags flags)
    332 {
    333     QwtNullPaintDevice *device = nullDevice();
     338    const QRectF& rect, const QImage& image,
     339    const QRectF& subRect, Qt::ImageConversionFlags flags)
     340{
     341    QwtNullPaintDevice* device = nullDevice();
    334342    if ( device == NULL )
    335343        return;
    … …  
    339347
    340348void QwtNullPaintDevice::PaintEngine::updateState(
    341     const QPaintEngineState &engineState)
    342 {
    343     QwtNullPaintDevice *device = nullDevice();
     349    const QPaintEngineState& engineState)
     350{
     351    QwtNullPaintDevice* device = nullDevice();
    344352    if ( device == NULL )
    345353        return;
    … …  
    348356}
    349357
    350 inline QwtNullPaintDevice *QwtNullPaintDevice::PaintEngine::nullDevice()
     358inline QwtNullPaintDevice* QwtNullPaintDevice::PaintEngine::nullDevice()
    351359{
    352360    if ( !isActive() )
    353361        return NULL;
    354362
    355     return static_cast<QwtNullPaintDevice *>( paintDevice() );
     363    return static_cast< QwtNullPaintDevice* >( paintDevice() );
    356364}
    357365
    358366//! Constructor
    359367QwtNullPaintDevice::QwtNullPaintDevice():
    360     d_engine( NULL )
    361 {
    362     d_data = new PrivateData;
     368    m_engine( NULL )
     369{
     370    m_data = new PrivateData;
    363371}
    364372
    … …  
    366374QwtNullPaintDevice::~QwtNullPaintDevice()
    367375{
    368     delete d_engine;
    369     delete d_data;
     376    delete m_engine;
     377    delete m_data;
    370378}
    371379
    … …  
    378386void QwtNullPaintDevice::setMode( Mode mode )
    379387{
    380     d_data->mode = mode;
     388    m_data->mode = mode;
    381389}
    382390
    … …  
    384392    \return Render mode
    385393    \sa setMode()
    386 */
     394 */
    387395QwtNullPaintDevice::Mode QwtNullPaintDevice::mode() const
    388396{
    389     return d_data->mode;
     397    return m_data->mode;
    390398}
    391399
    392400//! See QPaintDevice::paintEngine()
    393 QPaintEngine *QwtNullPaintDevice::paintEngine() const
    394 {
    395     if ( d_engine == NULL )
    396     {
    397         QwtNullPaintDevice *that =
    398             const_cast< QwtNullPaintDevice * >( this );
    399 
    400         that->d_engine = new PaintEngine();
    401     }
    402 
    403     return d_engine;
     401QPaintEngine* QwtNullPaintDevice::paintEngine() const
     402{
     403    if ( m_engine == NULL )
     404    {
     405        QwtNullPaintDevice* that =
     406            const_cast< QwtNullPaintDevice* >( this );
     407
     408        that->m_engine = new PaintEngine();
     409    }
     410
     411    return m_engine;
    404412}
    405413
    … …  
    411419
    412420    \sa sizeMetrics()
    413 */
     421 */
    414422int QwtNullPaintDevice::metric( PaintDeviceMetric deviceMetric ) const
    415423{
    … …  
    456464            break;
    457465        }
     466#if QT_VERSION >= 0x050100
     467        case PdmDevicePixelRatio:
     468        {
     469            value = 1.0;
     470            break;
     471        }
     472#endif
    458473        default:
    459             value = 0;
    460     }
     474        {
     475            value = QPaintDevice::metric( deviceMetric );
     476        }
     477    }
     478
    461479    return value;
    462 
    463480}
    464481
    465482//! See QPaintEngine::drawRects()
    466483void QwtNullPaintDevice::drawRects(
    467     const QRect *rects, int rectCount)
     484    const QRect* rects, int rectCount)
    468485{
    469486    Q_UNUSED(rects);
    … …  
    473490//! See QPaintEngine::drawRects()
    474491void QwtNullPaintDevice::drawRects(
    475     const QRectF *rects, int rectCount)
     492    const QRectF* rects, int rectCount)
    476493{
    477494    Q_UNUSED(rects);
    … …  
    481498//! See QPaintEngine::drawLines()
    482499void QwtNullPaintDevice::drawLines(
    483     const QLine *lines, int lineCount)
     500    const QLine* lines, int lineCount)
    484501{
    485502    Q_UNUSED(lines);
    … …  
    489506//! See QPaintEngine::drawLines()
    490507void QwtNullPaintDevice::drawLines(
    491     const QLineF *lines, int lineCount)
     508    const QLineF* lines, int lineCount)
    492509{
    493510    Q_UNUSED(lines);
    … …  
    496513
    497514//! See QPaintEngine::drawEllipse()
    498 void QwtNullPaintDevice::drawEllipse( const QRectF &rect )
     515void QwtNullPaintDevice::drawEllipse( const QRectF& rect )
    499516{
    500517    Q_UNUSED(rect);
    … …  
    502519
    503520//! See QPaintEngine::drawEllipse()
    504 void QwtNullPaintDevice::drawEllipse( const QRect &rect )
     521void QwtNullPaintDevice::drawEllipse( const QRect& rect )
    505522{
    506523    Q_UNUSED(rect);
    … …  
    508525
    509526//! See QPaintEngine::drawPath()
    510 void QwtNullPaintDevice::drawPath( const QPainterPath &path )
     527void QwtNullPaintDevice::drawPath( const QPainterPath& path )
    511528{
    512529    Q_UNUSED(path);
    … …  
    515532//! See QPaintEngine::drawPoints()
    516533void QwtNullPaintDevice::drawPoints(
    517     const QPointF *points, int pointCount)
     534    const QPointF* points, int pointCount)
    518535{
    519536    Q_UNUSED(points);
    … …  
    523540//! See QPaintEngine::drawPoints()
    524541void QwtNullPaintDevice::drawPoints(
    525     const QPoint *points, int pointCount)
     542    const QPoint* points, int pointCount)
    526543{
    527544    Q_UNUSED(points);
    … …  
    531548//! See QPaintEngine::drawPolygon()
    532549void QwtNullPaintDevice::drawPolygon(
    533     const QPointF *points, int pointCount,
     550    const QPointF* points, int pointCount,
    534551    QPaintEngine::PolygonDrawMode mode)
    535552{
    … …  
    541558//! See QPaintEngine::drawPolygon()
    542559void QwtNullPaintDevice::drawPolygon(
    543     const QPoint *points, int pointCount,
     560    const QPoint* points, int pointCount,
    544561    QPaintEngine::PolygonDrawMode mode)
    545562{
    … …  
    550567
    551568//! See QPaintEngine::drawPixmap()
    552 void QwtNullPaintDevice::drawPixmap( const QRectF &rect,
    553     const QPixmap &pm, const QRectF &subRect )
     569void QwtNullPaintDevice::drawPixmap( const QRectF& rect,
     570    const QPixmap& pm, const QRectF& subRect )
    554571{
    555572    Q_UNUSED(rect);
    … …  
    560577//! See QPaintEngine::drawTextItem()
    561578void QwtNullPaintDevice::drawTextItem(
    562     const QPointF &pos, const QTextItem &textItem)
     579    const QPointF& pos, const QTextItem& textItem)
    563580{
    564581    Q_UNUSED(pos);
    … …  
    568585//! See QPaintEngine::drawTiledPixmap()
    569586void QwtNullPaintDevice::drawTiledPixmap(
    570     const QRectF &rect, const QPixmap &pixmap,
    571     const QPointF &subRect)
     587    const QRectF& rect, const QPixmap& pixmap,
     588    const QPointF& subRect)
    572589{
    573590    Q_UNUSED(rect);
    … …  
    578595//! See QPaintEngine::drawImage()
    579596void QwtNullPaintDevice::drawImage(
    580     const QRectF &rect, const QImage &image,
    581     const QRectF &subRect, Qt::ImageConversionFlags flags)
     597    const QRectF& rect, const QImage& image,
     598    const QRectF& subRect, Qt::ImageConversionFlags flags)
    582599{
    583600    Q_UNUSED(rect);
    … …  
    589606//! See QPaintEngine::updateState()
    590607void QwtNullPaintDevice::updateState(
    591     const QPaintEngineState &state )
     608    const QPaintEngineState& state )
    592609{
    593610    Q_UNUSED(state);
Note: See TracChangeset for help on using the changeset viewer.