Ignore:
Timestamp:
May 10, 2017, 3:20:54 PM (7 years ago)
Author:
stoecker
Message:

update qwt and qwtpolar, many QT5 fixes (unfinished)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/qwt/qwt_plot_spectrocurve.cpp

    r4271 r8127  
    4242*/
    4343QwtPlotSpectroCurve::QwtPlotSpectroCurve( const QwtText &title ):
    44     QwtPlotSeriesItem<QwtPoint3D>( title )
     44    QwtPlotSeriesItem( title )
    4545{
    4646    init();
     
    5252*/
    5353QwtPlotSpectroCurve::QwtPlotSpectroCurve( const QString &title ):
    54     QwtPlotSeriesItem<QwtPoint3D>( QwtText( title ) )
     54    QwtPlotSeriesItem( QwtText( title ) )
    5555{
    5656    init();
     
    7272
    7373    d_data = new PrivateData;
    74     d_series = new QwtPoint3DSeriesData();
     74    setData( new QwtPoint3DSeriesData() );
    7575
    7676    setZ( 20.0 );
     
    9999
    100100/*!
    101     \brief Return the current paint attributes
     101    \return True, when attribute is enabled
    102102    \sa PaintAttribute, setPaintAttribute()
    103103*/
     
    113113void QwtPlotSpectroCurve::setSamples( const QVector<QwtPoint3D> &samples )
    114114{
    115     delete d_series;
    116     d_series = new QwtPoint3DSeriesData( samples );
    117     itemChanged();
    118 }
     115    setData( new QwtPoint3DSeriesData( samples ) );
     116}
     117
     118/*!
     119  Assign a series of samples
     120   
     121  setSamples() is just a wrapper for setData() without any additional
     122  value - beside that it is easier to find for the developer.
     123   
     124  \param data Data
     125  \warning The item takes ownership of the data object, deleting
     126           it when its not used anymore.
     127*/
     128void QwtPlotSpectroCurve::setSamples(
     129    QwtSeriesData<QwtPoint3D> *data )
     130{
     131    setData( data );
     132
    119133
    120134/*!
     
    137151    }
    138152
     153    legendChanged();
    139154    itemChanged();
    140155}
     
    162177    {
    163178        d_data->colorRange = interval;
     179
     180        legendChanged();
    164181        itemChanged();
    165182    }
     
    189206    {
    190207        d_data->penWidth = penWidth;
     208
     209        legendChanged();
    191210        itemChanged();
    192211    }
     
    208227  \param xMap Maps x-values into pixel coordinates.
    209228  \param yMap Maps y-values into pixel coordinates.
    210   \param canvasRect Contents rect of the canvas
     229  \param canvasRect Contents rectangle of the canvas
    211230  \param from Index of the first sample to be painted
    212231  \param to Index of the last sample to be painted. If to < 0 the
     
    228247        from = 0;
    229248
    230     if ( from >= to )
     249    if ( from > to )
    231250        return;
    232251
     
    240259  \param xMap Maps x-values into pixel coordinates.
    241260  \param yMap Maps y-values into pixel coordinates.
    242   \param canvasRect Contents rect of the canvas
     261  \param canvasRect Contents rectangle of the canvas
    243262  \param from Index of the first sample to be painted
    244263  \param to Index of the last sample to be painted. If to < 0 the
     
    260279        d_data->colorTable = d_data->colorMap->colorTable( d_data->colorRange );
    261280
     281    const QwtSeriesData<QwtPoint3D> *series = data();
     282
    262283    for ( int i = from; i <= to; i++ )
    263284    {
    264         const QwtPoint3D sample = d_series->sample( i );
     285        const QwtPoint3D sample = series->sample( i );
    265286
    266287        double xi = xMap.transform( sample.x() );
     
    283304                d_data->colorRange, sample.z() );
    284305
    285             painter->setPen( QPen( QColor( rgb ), d_data->penWidth ) );
     306            painter->setPen( QPen( QColor::fromRgba( rgb ), d_data->penWidth ) );
    286307        }
    287308        else
     
    290311                d_data->colorRange, sample.z() );
    291312
    292             painter->setPen( QPen( QColor( d_data->colorTable[index] ),
     313            painter->setPen( QPen( QColor::fromRgba( d_data->colorTable[index] ),
    293314                d_data->penWidth ) );
    294315        }
Note: See TracChangeset for help on using the changeset viewer.