QCustomPlot Discussion and Comments

Qt Errors: Cannot queue arguments qobject::connect qcprangeReturn to overview

Not the exact error message, but when we'd connect something to QCPColorScale::dataRangeChanged, the signal wouldn't go through.

We were able to fix it by adding these two lines:


static const int id = qRegisterMetaType<QCPRange>();

Seemingly having Q_DECLARE_TYPEINFO(QCPRange, Q_MOVABLE_TYPE); isn't enough, and neither is Q_DECLARE_METATYPE, one ALSO has to have the qRegisterMetaType? Which was news to me, but then, that's what that one easily missed paragraph of the Qt Documentation said... https://doc.qt.io/qt-5/qmetatype.html#qRegisterMetaType-1

To use the type T in QVariant, using Q_DECLARE_METATYPE() is sufficient. To use the type T in queued signal and slot connections, qRegisterMetaType<T>() must be called before the first connection is established.

i'm not quite sure what the question is. this is just how qt works. it seems like you are connecting to a signal coming from the gui thread into a different thread (queued). i'm not quite sure why you would want to connect in a different thread like that for this, but those two things are what needs to be done to do that.