没有成员命名 'setRawData' in 'QwtPlotCurve' - 转换 Qt 4.7 为 Qt 5.8
No member named 'setRawData' in 'QwtPlotCurve' - Convert Qt 4.7 to Qt 5.8
我需要将QT遗产代码从4.7转换为5.8 ,我在QT Creator 4.2.1 Clang 7.0(Apple)64bit中有一个汇编错误。
查看.cpp文件
#include "mpiChartCurve.h"
#include <qwt_plot_curve.h>
mpiChartCurve::mpiChartCurve(QwtPlot *chart_):
m_chart(chart_),
m_curve(new QwtPlotCurve())
{
}
mpiChartCurve::~mpiChartCurve()
{
// be default qwt will delete the curve when it is destroyed
// only delete the curve when detach is called
}
void mpiChartCurve::detach()
{
m_curve->detach();
// hack for now? qwt doesn't seem to redraw properly until a curve is attached after a detachment, so attach dummy
QVector<double> x, y;
m_curve->setRawData(x.constData(), y.constData(), 0); // JDL convert Qt4 to Qt5 BROKE
m_curve->attach(m_chart);
m_curve->detach();
delete m_curve;
m_curve = 0;
}
void mpiChartCurve::attach()
{
if (!m_curve)
return;
m_curve->setRawData(m_xData.constData(),m_yData.constData(), count()); // JDL convert Qt4 to Qt5 BROKE
m_curve->attach(m_chart);
}
.cpp中的2个错误
../src/usercontrols/mpichartcurve.cpp:23:14:错误:in qwtplotcurve' in ofor:no成员'setRawdata' m_curve-> setRawdata(x.constdata(),y.constdata(),0);//JDL将QT4转换为QT5破裂 ~~~~~~~~ ^
../src/usercontrols/mpichartcurve.cpp:37:14:错误:in qwtplotcurve' no no note m_curve-> setRawdata(m_xdata.constdata(),m_ydata.constdata(),count());//JDL将QT4转换为QT5破裂 ~~~~~~~~ ^
2生成错误制作:*** [mpichartcurve.o]错误121:12:40:该过程"/usr/bin/make"已由代码2退出。构建/部署项目mypersonalindex时的错误(套件:桌面QT 5.8.0 clang 64bit)执行步骤时" make"
提到的QT5文档 setRawdata
QByteArray & setRawData(const char *data, uint size)
我确实在QBYTEARRAY的DOC中注意到此评论
(过时)操作员const char *()const
我的C 技能非常有限,您是否看到可以将其从QT4转换为QT5的任何次要调整。...那么替代品是什么?
setRawdata不是qwtplotcurve的成员函数。它是QbyTearray的成员功能,仅接受2个参数。将setrawdata更改为setRawsamples,setrawsamples是qwtplotcurve的成员函数,接受您要寻找的三个参数。
固定版本
#include "mpiChartCurve.h"
#include <qwt_plot_curve.h>
mpiChartCurve::mpiChartCurve(QwtPlot *chart_):
m_chart(chart_),
m_curve(new QwtPlotCurve())
{
}
mpiChartCurve::~mpiChartCurve()
{
// be default qwt will delete the curve when it is destroyed
// only delete the curve when detach is called
}
void mpiChartCurve::detach()
{
m_curve->detach();
// hack for now? qwt doesn't seem to redraw properly until a curve is attached after a detachment, so attach dummy
QVector<double> x, y;
m_curve->setRawSamples(x.constData(), y.constData(), 0); // JDL convert Qt4 to Qt5 BROKE
m_curve->attach(m_chart);
m_curve->detach();
delete m_curve;
m_curve = 0;
}
void mpiChartCurve::attach()
{
if (!m_curve)
return;
m_curve->setRawSamples(m_xData.constData(),m_yData.constData(), count()); // JDL convert Qt4 to Qt5 BROKE
m_curve->attach(m_chart);
}
- 将Qt Designer项目转换为C++代码
- Qt 将字符串转换为以 16 为基数的 int,但保留以 16 为基数的值
- Qt-工作线程崩溃时将cv::Mat转换为QImage
- Qt - 将空指针(原始数据)转换为 QImage 并将其显示在标签上
- 在Qt中将QString转换为ASCII值,反之亦然
- 如何在Windows上将Qt QString转换为LPCTSTR
- 将Qt qml文件转换为位图图像
- 将 CRC uint 转换为 QByteArray QT - C++
- QT 创建器只会将第一个单词从文本编辑转换为纯文本
- QT中不允许使用一行多个转换,例如qString到char*
- C++ QList 中项目的 QT 强制转换到子类
- 编译错误 QT - 无法从类型强制转换
- 在"QUrl"中没有名为"addQueryItem"的成员 - 将Qt 4.7转换为5.8
- 未声明的标识符"QVariant"将旧版Qt 4转换为5
- 如何将Qt转换为C++
- 如何将 Qt 转换为 C#
- Qt转换为ObjectiveC代码
- gsoap 和 qt 转换变量内存句柄
- Qt/C++-转换原始二进制数据并将其显示为图像(即QImage)
- Qt转换ISO日期到QDate