QCustomPlot Discussion and Comments

New signals/slots system does not work with QCPAxisReturn to overview

When trying to use the new signals/slots system using a C++11 syntax with QCPAxis, I got the following linker error under MSVC 2015:

error LNK2019: unresolved external symbol "public: static struct QMetaObject const QCPAxis::staticMetaObject" (?staticMetaObject@QCPAxis@@2UQMetaObject@@B) referenced in function "public: static class QMetaObject::Connection __cdecl QObject::connect<void (__cdecl QCPAxis::*)(enum QCPAxis::ScaleType),class <lambda_04f333bb884fd37863226db952e12437> >(class QCPAxis const *,void (__cdecl QCPAxis::*)(enum QCPAxis::ScaleType),class QObject const *,class <lambda_04f333bb884fd37863226db952e12437>,enum Qt::ConnectionType)" (??$connect@P8QCPAxis@@EAAXW4ScaleType@1@@ZV<lambda_04f333bb884fd37863226db952e12437>@@@QObject@@SA?AVConnection@QMetaObject@@PEBVQCPAxis@@P83@EAAXW4ScaleType@3@@ZPEBV0@V<lambda_04f333bb884fd37863226db952e12437>@@W4ConnectionType@Qt@@@Z)

The following code was used:

connect(plot_->xAxis, &QCPAxis::scaleTypeChanged, [](QCPAxis::ScaleType scaleType)
{
	//do something there
});


connect(xAxis, &QCPAxis::scaleTypeChanged, [](QCPAxis::ScaleType scaleType)
{
    qDebug() << scaleType;
});
xAxis->setScaleType(QCPAxis::stLogarithmic);

This works for me on msvc2015

I forgot to define QCUSTOMPLOT_USE_LIBRARY, hence the linker error.