Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_plot_zoomer.cpp


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

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    1111#include "qwt_plot.h"
    1212#include "qwt_scale_div.h"
     13#include "qwt_scale_map.h"
     14#include "qwt_interval.h"
    1315#include "qwt_picker_machine.h"
    14 #include <qalgorithms.h>
     16
     17#include <qstack.h>
    1518
    1619static QwtInterval qwtExpandedZoomInterval( double v1, double v2,
    … …  
    5053}
    5154
    52 static QRectF qwtExpandedZoomRect( const QRectF &zoomRect, const QSizeF &minSize,
     55static QRectF qwtExpandedZoomRect( const QRectF& zoomRect, const QSizeF& minSize,
    5356    const QwtTransform* transformX, const QwtTransform* transformY )
    5457{
    … …  
    7881class QwtPlotZoomer::PrivateData
    7982{
    80 public:
     83  public:
    8184    uint zoomRectIndex;
    82     QStack<QRectF> zoomStack;
     85    QStack< QRectF > zoomStack;
    8386
    8487    int maxStackDepth;
    … …  
    8689
    8790/*!
    88   \brief Create a zoomer for a plot canvas.
    89 
    90   The zoomer is set to those x- and y-axis of the parent plot of the
    91   canvas that are enabled. If both or no x-axis are enabled, the picker
    92   is set to QwtPlot::xBottom. If both or no y-axis are
    93   enabled, it is set to QwtPlot::yLeft.
    94 
    95   The zoomer is initialized with a QwtPickerDragRectMachine,
    96   the tracker mode is set to QwtPicker::ActiveOnly and the rubber band
    97   is set to QwtPicker::RectRubberBand
    98 
    99   \param canvas Plot canvas to observe, also the parent object
    100   \param doReplot Call QwtPlot::replot() for the attached plot before initializing
     91   \brief Create a zoomer for a plot canvas.
     92
     93   The zoomer is set to those x- and y-axis of the parent plot of the
     94   canvas that are enabled. If both or no x-axis are enabled, the picker
     95   is set to QwtAxis::XBottom. If both or no y-axis are
     96   enabled, it is set to QwtAxis::YLeft.
     97
     98   The zoomer is initialized with a QwtPickerDragRectMachine,
     99   the tracker mode is set to QwtPicker::ActiveOnly and the rubber band
     100   is set to QwtPicker::RectRubberBand
     101
     102   \param canvas Plot canvas to observe, also the parent object
     103   \param doReplot Call QwtPlot::replot() for the attached plot before initializing
    101104                  the zoomer with its scales. This might be necessary,
    102105                  when the plot is in a state with pending scale changes.
    103106
    104   \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase()
    105 */
    106 QwtPlotZoomer::QwtPlotZoomer( QWidget *canvas, bool doReplot ):
    107     QwtPlotPicker( canvas )
     107   \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase()
     108 */
     109QwtPlotZoomer::QwtPlotZoomer( QWidget* canvas, bool doReplot )
     110    : QwtPlotPicker( canvas )
    108111{
    109112    if ( canvas )
    … …  
    112115
    113116/*!
    114   \brief Create a zoomer for a plot canvas.
    115 
    116   The zoomer is initialized with a QwtPickerDragRectMachine,
    117   the tracker mode is set to QwtPicker::ActiveOnly and the rubber band
    118   is set to QwtPicker;;RectRubberBand
    119 
    120   \param xAxis X axis of the zoomer
    121   \param yAxis Y axis of the zoomer
    122   \param canvas Plot canvas to observe, also the parent object
    123   \param doReplot Call QwtPlot::replot() for the attached plot before initializing
     117   \brief Create a zoomer for a plot canvas.
     118
     119   The zoomer is initialized with a QwtPickerDragRectMachine,
     120   the tracker mode is set to QwtPicker::ActiveOnly and the rubber band
     121   is set to QwtPicker::RectRubberBand
     122
     123   \param xAxisId X axis of the zoomer
     124   \param yAxisId Y axis of the zoomer
     125   \param canvas Plot canvas to observe, also the parent object
     126   \param doReplot Call QwtPlot::replot() for the attached plot before initializing
    124127                  the zoomer with its scales. This might be necessary,
    125128                  when the plot is in a state with pending scale changes.
    126129
    127   \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase()
    128 */
    129 
    130 QwtPlotZoomer::QwtPlotZoomer( int xAxis, int yAxis,
    131         QWidget *canvas, bool doReplot ):
    132     QwtPlotPicker( xAxis, yAxis, canvas )
     130   \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase()
     131 */
     132
     133QwtPlotZoomer::QwtPlotZoomer( QwtAxisId xAxisId, QwtAxisId yAxisId,
     134        QWidget* canvas, bool doReplot )
     135    : QwtPlotPicker( xAxisId, yAxisId, canvas )
    133136{
    134137    if ( canvas )
    … …  
    139142void QwtPlotZoomer::init( bool doReplot )
    140143{
    141     d_data = new PrivateData;
    142 
    143     d_data->maxStackDepth = -1;
     144    m_data = new PrivateData;
     145
     146    m_data->maxStackDepth = -1;
    144147
    145148    setTrackerMode( ActiveOnly );
    … …  
    155158QwtPlotZoomer::~QwtPlotZoomer()
    156159{
    157     delete d_data;
    158 }
    159 
    160 /*!
    161   \brief Limit the number of recursive zoom operations to depth.
    162 
    163   A value of -1 set the depth to unlimited, 0 disables zooming.
    164   If the current zoom rectangle is below depth, the plot is unzoomed.
    165 
    166   \param depth Maximum for the stack depth
    167   \sa maxStackDepth()
    168   \note depth doesn't include the zoom base, so zoomStack().count() might be
     160    delete m_data;
     161}
     162
     163/*!
     164   \brief Limit the number of recursive zoom operations to depth.
     165
     166   A value of -1 set the depth to unlimited, 0 disables zooming.
     167   If the current zoom rectangle is below depth, the plot is unzoomed.
     168
     169   \param depth Maximum for the stack depth
     170   \sa maxStackDepth()
     171   \note depth doesn't include the zoom base, so zoomStack().count() might be
    169172              maxStackDepth() + 1.
    170 */
     173 */
    171174void QwtPlotZoomer::setMaxStackDepth( int depth )
    172175{
    173     d_data->maxStackDepth = depth;
     176    m_data->maxStackDepth = depth;
    174177
    175178    if ( depth >= 0 )
    176179    {
    177         // unzoom if the current depth is below d_data->maxStackDepth
     180        // unzoom if the current depth is below m_data->maxStackDepth
    178181
    179182        const int zoomOut =
    180             int( d_data->zoomStack.count() ) - 1 - depth; // -1 for the zoom base
     183            m_data->zoomStack.count() - 1 - depth; // -1 for the zoom base
    181184
    182185        if ( zoomOut > 0 )
    183186        {
    184187            zoom( -zoomOut );
    185             for ( int i = int( d_data->zoomStack.count() ) - 1;
    186                 i > int( d_data->zoomRectIndex ); i-- )
     188            for ( int i = m_data->zoomStack.count() - 1;
     189                i > int( m_data->zoomRectIndex ); i-- )
    187190            {
    188                 ( void )d_data->zoomStack.pop(); // remove trailing rects
     191                ( void )m_data->zoomStack.pop(); // remove trailing rects
    189192            }
    190193        }
    … …  
    193196
    194197/*!
    195   \return Maximal depth of the zoom stack.
    196   \sa setMaxStackDepth()
    197 */
     198   \return Maximal depth of the zoom stack.
     199   \sa setMaxStackDepth()
     200 */
    198201int QwtPlotZoomer::maxStackDepth() const
    199202{
    200     return d_data->maxStackDepth;
    201 }
    202 
    203 /*!
    204   \return The zoom stack. zoomStack()[0] is the zoom base,
     203    return m_data->maxStackDepth;
     204}
     205
     206/*!
     207   \return The zoom stack. zoomStack()[0] is the zoom base,
    205208          zoomStack()[1] the first zoomed rectangle.
    206209
    207   \sa setZoomStack(), zoomRectIndex()
    208 */
    209 const QStack<QRectF> &QwtPlotZoomer::zoomStack() const
    210 {
    211     return d_data->zoomStack;
    212 }
    213 
    214 /*!
    215   \return Initial rectangle of the zoomer
    216   \sa setZoomBase(), zoomRect()
    217 */
     210   \sa setZoomStack(), zoomRectIndex()
     211 */
     212const QStack< QRectF >& QwtPlotZoomer::zoomStack() const
     213{
     214    return m_data->zoomStack;
     215}
     216
     217/*!
     218   \return Initial rectangle of the zoomer
     219   \sa setZoomBase(), zoomRect()
     220 */
    218221QRectF QwtPlotZoomer::zoomBase() const
    219222{
    220     return d_data->zoomStack[0];
    221 }
    222 
    223 /*!
    224   Reinitialized the zoom stack with scaleRect() as base.
    225 
    226   \param doReplot Call QwtPlot::replot() for the attached plot before initializing
     223    return m_data->zoomStack[0];
     224}
     225
     226/*!
     227   Reinitialized the zoom stack with scaleRect() as base.
     228
     229   \param doReplot Call QwtPlot::replot() for the attached plot before initializing
    227230                  the zoomer with its scales. This might be necessary,
    228231                  when the plot is in a state with pending scale changes.
    229232
    230   \sa zoomBase(), scaleRect() QwtPlot::autoReplot(), QwtPlot::replot().
    231 */
     233   \sa zoomBase(), scaleRect() QwtPlot::autoReplot(), QwtPlot::replot().
     234 */
    232235void QwtPlotZoomer::setZoomBase( bool doReplot )
    233236{
    234     QwtPlot *plt = plot();
     237    QwtPlot* plt = plot();
    235238    if ( plt == NULL )
    236239        return;
    … …  
    239242        plt->replot();
    240243
    241     d_data->zoomStack.clear();
    242     d_data->zoomStack.push( scaleRect() );
    243     d_data->zoomRectIndex = 0;
     244    m_data->zoomStack.clear();
     245    m_data->zoomStack.push( scaleRect() );
     246    m_data->zoomRectIndex = 0;
    244247
    245248    rescale();
    … …  
    247250
    248251/*!
    249   \brief Set the initial size of the zoomer.
    250 
    251   base is united with the current scaleRect() and the zoom stack is
    252   reinitialized with it as zoom base. plot is zoomed to scaleRect().
    253 
    254   \param base Zoom base
    255 
    256   \sa zoomBase(), scaleRect()
    257 */
    258 void QwtPlotZoomer::setZoomBase( const QRectF &base )
    259 {
    260     const QwtPlot *plt = plot();
     252   \brief Set the initial size of the zoomer.
     253
     254   base is united with the current scaleRect() and the zoom stack is
     255   reinitialized with it as zoom base. plot is zoomed to scaleRect().
     256
     257   \param base Zoom base
     258
     259   \sa zoomBase(), scaleRect()
     260 */
     261void QwtPlotZoomer::setZoomBase( const QRectF& base )
     262{
     263    const QwtPlot* plt = plot();
    261264    if ( !plt )
    262265        return;
    … …  
    265268    const QRectF bRect = base | sRect;
    266269
    267     d_data->zoomStack.clear();
    268     d_data->zoomStack.push( bRect );
    269     d_data->zoomRectIndex = 0;
     270    m_data->zoomStack.clear();
     271    m_data->zoomStack.push( bRect );
     272    m_data->zoomRectIndex = 0;
    270273
    271274    if ( base != sRect )
    272275    {
    273         d_data->zoomStack.push( sRect );
    274         d_data->zoomRectIndex++;
     276        m_data->zoomStack.push( sRect );
     277        m_data->zoomRectIndex++;
    275278    }
    276279
    … …  
    279282
    280283/*!
    281   \return Rectangle at the current position on the zoom stack.
    282   \sa zoomRectIndex(), scaleRect().
    283 */
     284   \return Rectangle at the current position on the zoom stack.
     285   \sa zoomRectIndex(), scaleRect().
     286 */
    284287QRectF QwtPlotZoomer::zoomRect() const
    285288{
    286     return d_data->zoomStack[d_data->zoomRectIndex];
    287 }
    288 
    289 /*!
    290   \return Index of current position of zoom stack.
    291 */
     289    return m_data->zoomStack[m_data->zoomRectIndex];
     290}
     291
     292/*!
     293   \return Index of current position of zoom stack.
     294 */
    292295uint QwtPlotZoomer::zoomRectIndex() const
    293296{
    294     return d_data->zoomRectIndex;
    295 }
    296 
    297 /*!
    298   \brief Zoom in
    299 
    300   Clears all rectangles above the current position of the
    301   zoom stack and pushes the normalized rectangle on it.
    302 
    303   \note If the maximal stack depth is reached, zoom is ignored.
    304   \note The zoomed signal is emitted.
    305 */
    306 
    307 void QwtPlotZoomer::zoom( const QRectF &rect )
    308 {
    309     if ( d_data->maxStackDepth >= 0 &&
    310             int( d_data->zoomRectIndex ) >= d_data->maxStackDepth )
     297    return m_data->zoomRectIndex;
     298}
     299
     300/*!
     301   \brief Zoom in
     302
     303   Clears all rectangles above the current position of the
     304   zoom stack and pushes the normalized rectangle on it.
     305
     306   \note If the maximal stack depth is reached, zoom is ignored.
     307   \note The zoomed signal is emitted.
     308 */
     309
     310void QwtPlotZoomer::zoom( const QRectF& rect )
     311{
     312    if ( m_data->maxStackDepth >= 0 &&
     313        int( m_data->zoomRectIndex ) >= m_data->maxStackDepth )
    311314    {
    312315        return;
    … …  
    314317
    315318    const QRectF zoomRect = rect.normalized();
    316     if ( zoomRect != d_data->zoomStack[d_data->zoomRectIndex] )
    317     {
    318         for ( uint i = int( d_data->zoomStack.count() ) - 1;
    319            i > d_data->zoomRectIndex; i-- )
     319    if ( zoomRect != m_data->zoomStack[m_data->zoomRectIndex] )
     320    {
     321        for ( uint i = m_data->zoomStack.count() - 1;
     322            i > m_data->zoomRectIndex; i-- )
    320323        {
    321             ( void )d_data->zoomStack.pop();
     324            ( void )m_data->zoomStack.pop();
    322325        }
    323326
    324         d_data->zoomStack.push( zoomRect );
    325         d_data->zoomRectIndex++;
     327        m_data->zoomStack.push( zoomRect );
     328        m_data->zoomRectIndex++;
    326329
    327330        rescale();
    … …  
    332335
    333336/*!
    334   \brief Zoom in or out
    335 
    336   Activate a rectangle on the zoom stack with an offset relative
    337   to the current position. Negative values of offset will zoom out,
    338   positive zoom in. A value of 0 zooms out to the zoom base.
    339 
    340   \param offset Offset relative to the current position of the zoom stack.
    341   \note The zoomed signal is emitted.
    342   \sa zoomRectIndex()
    343 */
     337   \brief Zoom in or out
     338
     339   Activate a rectangle on the zoom stack with an offset relative
     340   to the current position. Negative values of offset will zoom out,
     341   positive zoom in. A value of 0 zooms out to the zoom base.
     342
     343   \param offset Offset relative to the current position of the zoom stack.
     344   \note The zoomed signal is emitted.
     345   \sa zoomRectIndex()
     346 */
    344347void QwtPlotZoomer::zoom( int offset )
    345348{
     349    int newIndex;
     350
    346351    if ( offset == 0 )
    347         d_data->zoomRectIndex = 0;
     352    {
     353        newIndex = 0;
     354    }
    348355    else
    349356    {
    350         int newIndex = d_data->zoomRectIndex + offset;
    351         newIndex = qMax( 0, newIndex );
    352         newIndex = qMin( int( d_data->zoomStack.count() ) - 1, newIndex );
    353 
    354         d_data->zoomRectIndex = uint( newIndex );
    355     }
    356 
    357     rescale();
    358 
    359     Q_EMIT zoomed( zoomRect() );
    360 }
    361 
    362 /*!
    363   \brief Assign a zoom stack
    364 
    365   In combination with other types of navigation it might be useful to
    366   modify to manipulate the complete zoom stack.
    367 
    368   \param zoomStack New zoom stack
    369   \param zoomRectIndex Index of the current position of zoom stack.
     357        newIndex = m_data->zoomRectIndex + offset;
     358        newIndex = qBound( 0, newIndex, m_data->zoomStack.count() - 1 );
     359    }
     360
     361    if ( newIndex != static_cast< int >( m_data->zoomRectIndex ) )
     362    {
     363        m_data->zoomRectIndex = newIndex;
     364        rescale();
     365        Q_EMIT zoomed( zoomRect() );
     366    }
     367}
     368
     369/*!
     370   \brief Assign a zoom stack
     371
     372   In combination with other types of navigation it might be useful to
     373   modify to manipulate the complete zoom stack.
     374
     375   \param zoomStack New zoom stack
     376   \param zoomRectIndex Index of the current position of zoom stack.
    370377                       In case of -1 the current position is at the top
    371378                       of the stack.
    372379
    373   \note The zoomed signal might be emitted.
    374   \sa zoomStack(), zoomRectIndex()
    375 */
     380   \note The zoomed signal might be emitted.
     381   \sa zoomStack(), zoomRectIndex()
     382 */
    376383void QwtPlotZoomer::setZoomStack(
    377     const QStack<QRectF> &zoomStack, int zoomRectIndex )
     384    const QStack< QRectF >& zoomStack, int zoomRectIndex )
    378385{
    379386    if ( zoomStack.isEmpty() )
    380387        return;
    381388
    382     if ( d_data->maxStackDepth >= 0 &&
    383         int( zoomStack.count() ) > d_data->maxStackDepth )
     389    if ( m_data->maxStackDepth >= 0 &&
     390        zoomStack.count() > m_data->maxStackDepth )
    384391    {
    385392        return;
    386393    }
    387394
    388     if ( zoomRectIndex < 0 || zoomRectIndex > int( zoomStack.count() ) )
     395    if ( zoomRectIndex < 0 || zoomRectIndex > zoomStack.count() )
    389396        zoomRectIndex = zoomStack.count() - 1;
    390397
    391398    const bool doRescale = zoomStack[zoomRectIndex] != zoomRect();
    392399
    393     d_data->zoomStack = zoomStack;
    394     d_data->zoomRectIndex = uint( zoomRectIndex );
     400    m_data->zoomStack = zoomStack;
     401    m_data->zoomRectIndex = uint( zoomRectIndex );
    395402
    396403    if ( doRescale )
    … …  
    402409
    403410/*!
    404   Adjust the observed plot to zoomRect()
    405 
    406   \note Initiates QwtPlot::replot()
    407 */
     411   Adjust the observed plot to zoomRect()
     412
     413   \note Initiates QwtPlot::replot()
     414 */
    408415
    409416void QwtPlotZoomer::rescale()
    410417{
    411     QwtPlot *plt = plot();
     418    QwtPlot* plt = plot();
    412419    if ( !plt )
    413420        return;
    414421
    415     const QRectF &rect = d_data->zoomStack[d_data->zoomRectIndex];
     422    const QRectF& rect = m_data->zoomStack[m_data->zoomRectIndex];
    416423    if ( rect != scaleRect() )
    417424    {
    … …  
    440447
    441448/*!
    442   Reinitialize the axes, and set the zoom base to their scales.
    443 
    444   \param xAxis X axis
    445   \param yAxis Y axis
    446 */
    447 
    448 void QwtPlotZoomer::setAxis( int xAxis, int yAxis )
    449 {
    450     if ( xAxis != QwtPlotPicker::xAxis() || yAxis != QwtPlotPicker::yAxis() )
    451     {
    452         QwtPlotPicker::setAxis( xAxis, yAxis );
     449   Reinitialize the axes, and set the zoom base to their scales.
     450
     451   \param xAxisId X axis
     452   \param yAxisId Y axis
     453 */
     454
     455void QwtPlotZoomer::setAxes( QwtAxisId xAxisId, QwtAxisId yAxisId )
     456{
     457    if ( xAxisId != QwtPlotPicker::xAxis() || yAxisId != QwtPlotPicker::yAxis() )
     458    {
     459        QwtPlotPicker::setAxes( xAxisId, yAxisId );
    453460        setZoomBase( scaleRect() );
    454461    }
    … …  
    464471   \note The mouse events can be changed, using
    465472         QwtEventPattern::setMousePattern: 2, 1
    466 */
    467 void QwtPlotZoomer::widgetMouseReleaseEvent( QMouseEvent *me )
     473 */
     474void QwtPlotZoomer::widgetMouseReleaseEvent( QMouseEvent* me )
    468475{
    469476    if ( mouseMatch( MouseSelect2, me ) )
    … …  
    486493   \note The keys codes can be changed, using
    487494         QwtEventPattern::setKeyPattern: 3, 4, 5
    488 */
    489 
    490 void QwtPlotZoomer::widgetKeyPressEvent( QKeyEvent *ke )
     495 */
     496
     497void QwtPlotZoomer::widgetKeyPressEvent( QKeyEvent* ke )
    491498{
    492499    if ( !isActive() )
    … …  
    504511
    505512/*!
    506   Move the current zoom rectangle.
    507 
    508   \param dx X offset
    509   \param dy Y offset
    510 
    511   \note The changed rectangle is limited by the zoom base
    512 */
     513   Move the current zoom rectangle.
     514
     515   \param dx X offset
     516   \param dy Y offset
     517
     518   \note The changed rectangle is limited by the zoom base
     519 */
    513520void QwtPlotZoomer::moveBy( double dx, double dy )
    514521{
    515     const QRectF &rect = d_data->zoomStack[d_data->zoomRectIndex];
     522    const QRectF& rect = m_data->zoomStack[m_data->zoomRectIndex];
    516523    moveTo( QPointF( rect.left() + dx, rect.top() + dy ) );
    517524}
    518525
    519526/*!
    520   Move the the current zoom rectangle.
    521 
    522   \param pos New position
    523 
    524   \sa QRectF::moveTo()
    525   \note The changed rectangle is limited by the zoom base
    526 */
    527 void QwtPlotZoomer::moveTo( const QPointF &pos )
     527   Move the the current zoom rectangle.
     528
     529   \param pos New position
     530
     531   \sa QRectF::moveTo()
     532   \note The changed rectangle is limited by the zoom base
     533 */
     534void QwtPlotZoomer::moveTo( const QPointF& pos )
    528535{
    529536    double x = pos.x();
    … …  
    542549    if ( x != zoomRect().left() || y != zoomRect().top() )
    543550    {
    544         d_data->zoomStack[d_data->zoomRectIndex].moveTo( x, y );
     551        m_data->zoomStack[m_data->zoomRectIndex].moveTo( x, y );
    545552        rescale();
    546553    }
    … …  
    548555
    549556/*!
    550   \brief Check and correct a selected rectangle
    551 
    552   Reject rectangles with a height or width < 2, otherwise
    553   expand the selected rectangle to a minimum size of 11x11
    554   and accept it.
    555 
    556   \return true If the rectangle is accepted, or has been changed
     557   \brief Check and correct a selected rectangle
     558
     559   Reject rectangles with a height or width < 2, otherwise
     560   expand the selected rectangle to a minimum size of 11x11
     561   and accept it.
     562
     563   \return true If the rectangle is accepted, or has been changed
    557564          to an accepted one.
    558 */
    559 
    560 bool QwtPlotZoomer::accept( QPolygon &pa ) const
     565 */
     566
     567bool QwtPlotZoomer::accept( QPolygon& pa ) const
    561568{
    562569    if ( pa.count() < 2 )
    563570        return false;
    564571
    565     QRect rect = QRect( pa[0], pa[int( pa.count() ) - 1] );
     572    QRect rect = QRect( pa.first(), pa.last() );
    566573    rect = rect.normalized();
    567574
    … …  
    584591
    585592/*!
    586   \brief Limit zooming by a minimum rectangle
    587 
    588   \return zoomBase().width() / 10e4, zoomBase().height() / 10e4
    589 */
     593   \brief Limit zooming by a minimum rectangle
     594
     595   \return zoomBase().width() / 10e4, zoomBase().height() / 10e4
     596 */
    590597QSizeF QwtPlotZoomer::minZoomSize() const
    591598{
    592     return QSizeF( d_data->zoomStack[0].width() / 10e4,
    593         d_data->zoomStack[0].height() / 10e4 );
    594 }
    595 
    596 /*!
    597   Rejects selections, when the stack depth is too deep, or
    598   the zoomed rectangle is minZoomSize().
    599 
    600   \sa minZoomSize(), maxStackDepth()
    601 */
     599    return QSizeF( m_data->zoomStack[0].width() / 10e4,
     600        m_data->zoomStack[0].height() / 10e4 );
     601}
     602
     603/*!
     604   Rejects selections, when the stack depth is too deep, or
     605   the zoomed rectangle is minZoomSize().
     606
     607   \sa minZoomSize(), maxStackDepth()
     608 */
    602609void QwtPlotZoomer::begin()
    603610{
    604     if ( d_data->maxStackDepth >= 0 )
    605     {
    606         if ( d_data->zoomRectIndex >= uint( d_data->maxStackDepth ) )
     611    if ( m_data->maxStackDepth >= 0 )
     612    {
     613        if ( m_data->zoomRectIndex >= uint( m_data->maxStackDepth ) )
    607614            return;
    608615    }
    … …  
    612619    {
    613620        const QSizeF sz =
    614             d_data->zoomStack[d_data->zoomRectIndex].size() * 0.9999;
     621            m_data->zoomStack[m_data->zoomRectIndex].size() * 0.9999;
    615622
    616623        if ( minSize.width() >= sz.width() &&
    … …  
    625632
    626633/*!
    627   Expand the selected rectangle to minZoomSize() and zoom in
    628   if accepted.
    629 
    630   \param ok If true, complete the selection and emit selected signals
     634   Expand the selected rectangle to minZoomSize() and zoom in
     635   if accepted.
     636
     637   \param ok If true, complete the selection and emit selected signals
    631638            otherwise discard the selection.
    632639
    633   \sa accept(), minZoomSize()
    634   \return True if the selection has been accepted, false otherwise
    635 */
     640   \sa accept(), minZoomSize()
     641   \return True if the selection has been accepted, false otherwise
     642 */
    636643bool QwtPlotZoomer::end( bool ok )
    637644{
    … …  
    640647        return false;
    641648
    642     QwtPlot *plot = QwtPlotZoomer::plot();
     649    QwtPlot* plot = QwtPlotZoomer::plot();
    643650    if ( !plot )
    644651        return false;
    645652
    646     const QPolygon &pa = selection();
     653    const QPolygon& pa = selection();
    647654    if ( pa.count() < 2 )
    648655        return false;
    649656
    650     QRect rect = QRect( pa[0], pa[int( pa.count() - 1 )] );
     657    QRect rect = QRect( pa.first(), pa.last() );
    651658    rect = rect.normalized();
    652659
    … …  
    663670    return true;
    664671}
     672
     673#include "moc_qwt_plot_zoomer.cpp"
Note: See TracChangeset for help on using the changeset viewer.