I'm using Visual Studio 2019 Community x64, Qt version 5.15.2. I have the 'Charts' module installed and selected in Project -> Properties -> Qt Project Settings -> Qt Modules
My code:
#include <QCandlestickSet>
struct Bar
{
double open, close, high, low;
qint64 timestamp;
Bar() : open(0.0), close(0.0), high(0.0), low(0.0), timestamp(0)
{
}
QCandlestickSet * toCandle(void)
{
return new QCandlestickSet(this->open, this->high, this->low, this->close, this->timestamp);
}
};
I am getting the error:
Severity Code Description Project File Line Suppression State Error (active) E0020 identifier "QCandlestickSet" is undefined ProjectName ..\Bar.h 27
Any help would be appreciated.
Thank you in advance.
CodePudding user response:
As mentioned in the comments by G.M., everything QtChart related is held within a namespace called QtCharts.
Doing any of the following will fix this issue:
using QtCharts::QCandlestickSet;
OR
using namespace QtCharts;
OR
QtCharts::QCandlestickSet * toCandle(void)
{
return new QtCharts::QCandlestickSet(this->open, this->high, this->low, this->close, this->timestamp);
}
Although the namespace is not mentioned in the page relating to QCandlestickSet, it is mentioned on the QtCharts page