⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qwt_plot_curve.cpp

📁 软件无线电的平台
💻 CPP
📖 第 1 页 / 共 2 页
字号:
}/*!  \brief Assign a symbol to a curve indexed by key  \param key Key of the curve  \param s  \return \c TRUE if the curve exists*/bool QwtPlot::setCurveSymbol(long key, const QwtSymbol &s){    QwtPlotCurve *c = d_curves->find(key);    if ( !c )        return FALSE;    c->setSymbol(s);    updateLegendItem(key);    return TRUE;}/*!  \brief  Initialize the curve data by pointing to memory blocks which are not  managed by QwtPlot.  \param key Key of the curve  \param xData pointer to x data  \param yData pointer to y data  \param size size of x and y  \return \c TRUE if the curve exists  \warning setRawData is provided for efficiency.  The programmer should not  delete the data during the lifetime of the underlying QwtCPointerData class.  \sa QwtPlot::setCurveData(), QwtCurve::setRawData*/bool QwtPlot::setCurveRawData(long key,     const double *xData, const double *yData, int size){    QwtPlotCurve *c = d_curves->find(key);    if ( !c )        return FALSE;    c->setRawData(xData, yData, size);    return TRUE;}/*!  \param key  \param s  \todo Documentation*/bool QwtPlot::setCurveTitle(long key, const QString &s){    QwtPlotCurve *c = d_curves->find(key);    if ( !c )        return FALSE;    c->setTitle(s);    updateLegendItem(key);    return TRUE;}/*!  \brief Set curve data by copying x- and y-values from specified blocks.  Contrary to \b QwtPlot::setCurveRawData, this function makes a 'deep copy' of  the data.  \param key curve key  \param xData pointer to x values  \param yData pointer to y values  \param size size of xData and yData  \return \c TRUE if the curve exists  \sa setCurveRawData(), QwtCurve::setData*/bool QwtPlot::setCurveData(long key,     const double *xData, const double *yData, int size){    QwtPlotCurve *c = d_curves->find(key);    if ( !c )        return FALSE;    c->setData(xData, yData, size);    return TRUE;}    /*!  \brief Initialize curve data with x- and y-arrays (data is explicitly shared)  \param key curve key  \param xData array with x-values  \param yData array with y-values  \return \c TRUE if the curve exists*/bool QwtPlot::setCurveData(long key,     const QwtArray<double> &xData, const QwtArray<double> &yData){    QwtPlotCurve *c = d_curves->find(key);    if ( !c )        return FALSE;    c->setData(xData, yData);    return TRUE;}    /*!  \brief Initialize curve data with a array of points (explicitly shared)  \param key curve key  \param data Data  \return \c TRUE if the curve exists*/bool QwtPlot::setCurveData(long key, const QwtArray<QwtDoublePoint> &data){    QwtPlotCurve *c = d_curves->find(key);    if ( !c )        return FALSE;    c->setData(data);    return TRUE;}    /*!  \brief Initialize curve data with any QwtData object  \param key curve key  \param data Data  \return \c TRUE if the curve exists*/bool QwtPlot::setCurveData(long key, const QwtData &data){    QwtPlotCurve *c = d_curves->find(key);    if ( !c )        return FALSE;    c->setData(data);    return TRUE;}    /*!  \brief Change a curve's style  \param key Key of the curve  \param s display style of the curve  \param options style options  \return \c TRUE if the curve exists  \sa QwtCurve::setStyle() for a detailed description of valid styles.*/bool QwtPlot::setCurveStyle(long key, int s, int options){    QwtPlotCurve *c = d_curves->find(key);    if ( !c )        return FALSE;    c->setStyle(s, options);    updateLegendItem(key);    return TRUE;}/*!  \brief Set the style options of a curve indexed by key  \param key The curve's key  \param opt curve options  \return \c TRUE if the specified curve exists.  \sa QwtCurve::setOptions for a detailed description of valid options.*/bool QwtPlot::setCurveOptions(long key, int opt){    QwtPlotCurve *c = d_curves->find(key);    if ( !c )        return FALSE;    c->setOptions(opt);    return TRUE;}/*!  \brief Set the number of interpolated points of a curve indexed by key  \param key key of the curve  \param s size of the spline  \return \c TRUE if the curve exists*/bool QwtPlot::setCurveSplineSize(long key, int s){    QwtPlotCurve *c = d_curves->find(key);    if ( !c )        return FALSE;    c->setSplineSize(s);    return TRUE;}/*!  \brief Attach a curve to an x axis  \param key key of the curve  \param axis x axis to be attached*/bool QwtPlot::setCurveXAxis(long key, int axis){    QwtPlotCurve *c = d_curves->find(key);    if ( !c )        return FALSE;    c->setXAxis(axis);    return TRUE;}/*!  \brief Attach a curve to an y axis  \param key key of the curve  \param axis y axis to be attached*/bool QwtPlot::setCurveYAxis(long key, int axis){    QwtPlotCurve *c = d_curves->find(key);    if ( !c )        return FALSE;    c->setYAxis(axis);    return TRUE;}/*!  \brief Set the baseline for a specified curve  The baseline is needed for the curve style QwtCurve::Sticks,  \param key curve key  \param ref baseline offset from zero  \sa QwtCurve::setBaseline*/bool QwtPlot::setCurveBaseline(long key, double ref){    QwtPlotCurve *c = d_curves->find(key);    if ( !c )        return FALSE;    c->setBaseline(ref);    return TRUE;}/*!  \brief Return the baseline offset for a specified curve  \param key curve key  \return Baseline offset of the specified curve,          or 0 if the curve doesn't exist  \sa setCurveBaseline()*/double QwtPlot::curveBaseline(long key) const{    double rv = 0.0;    QwtPlotCurve *c;    if ((c = d_curves->find(key)))        rv = c->baseline();    return rv;}/*!  \brief Insert a QwtLegendItem for a specified curve  In case of legend()->isReadOnly the item will be a QwtLegendLabel,  otherwise a QwtLegendButton.  \param curveKey curve key  \sa QwtLegendButton, QwtLegendItem, QwtLegend, updateLegendItem(), printLegendItem()*/void QwtPlot::insertLegendItem(long curveKey){    if ( d_legend->isReadOnly() )    {        QwtLegendLabel *label =             new QwtLegendLabel(d_legend->contentsWidget());        d_legend->insertItem(label, curveKey);    }    else    {        QwtLegendButton *button =             new QwtLegendButton(d_legend->contentsWidget());        connect(button, SIGNAL(clicked()), SLOT(lgdClicked()));        d_legend->insertItem(button, curveKey);    }    updateLegendItem(curveKey);}/*!  \brief Update a QwtLegendButton for a specified curve  \param curveKey curve key  \sa QwtLegendButton, QwtLegend, insertLegendItem(), printLegendItem()*/void QwtPlot::updateLegendItem(long curveKey){    const QwtPlotCurve *curve = d_curves->find(curveKey);    if ( !curve )        return;    QWidget *item = d_legend->findItem(curveKey);    if (item && item->inherits("QwtLegendButton"))     {        QwtLegendButton *button = (QwtLegendButton *)item;        const bool doUpdate = button->isUpdatesEnabled();        button->setUpdatesEnabled(FALSE);        updateLegendItem(curve, button);        button->setUpdatesEnabled(doUpdate);        button->update();    }    if (item && item->inherits("QwtLegendLabel"))     {        QwtLegendLabel *label = (QwtLegendLabel *)item;        const bool doUpdate = label->isUpdatesEnabled();        label->setUpdatesEnabled(FALSE);        updateLegendItem(curve, label);        label->setUpdatesEnabled(doUpdate);        label->update();    }}void QwtPlot::updateLegendItem(    const QwtPlotCurve *curve, QwtLegendItem *item){    if ( !curve || !item )        return;    int policy = d_legend->displayPolicy();    if (policy == QwtLegend::Fixed) {        int mode = d_legend->identifierMode();        if (mode & QwtLegendButton::ShowLine) {        item->setCurvePen(curve->pen());        }        if (mode & QwtLegendButton::ShowSymbol) {        item->setSymbol(curve->symbol());        }        if (mode & QwtLegendButton::ShowText) {        item->setTitle(curve->title());        } else {        item->setTitle(QString::null);        }        item->setIdentifierMode(mode);    } else if (policy == QwtLegend::Auto) {        int mode = 0;        if (QwtCurve::NoCurve != curve->style()) {        item->setCurvePen(curve->pen());        mode |= QwtLegendButton::ShowLine;        }        if (QwtSymbol::None != curve->symbol().style()) {        item->setSymbol(curve->symbol());        mode |= QwtLegendButton::ShowSymbol;        }        if (curve->title()) { // !curve->title().isEmpty() ???        item->setTitle(curve->title());        mode |= QwtLegendButton::ShowText;        } else {        item->setTitle(QString::null);        }        item->setIdentifierMode(mode);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -