I have a class defined as this:
cdataentry.h:
#ifndef CDATAENTRY_H
#define CDATAENTRY_H
#include <QObject>
#include <QString>
#include <QVariant>
#include <QtOpcUa>
#include <QMetaType>
#include <cnodetype.h>
#include <cdatastatus.h>
/**
* @brief A class providing data and methods to describe a single OPCUA ua
* node in the user input table.
*/
class CDataEntry : public QObject
{
Q_OBJECT
public:
CDataEntry(const QString& np, QObject* parent = nullptr);
~CDataEntry();
QString nodePath() const;
private:
/**
* @brief Obsolute path to the node on the MDE server
*/
const QString m_nodePath;
};
Q_DECLARE_METATYPE(CDataEntry); // to be able to store it in QVariant.
#endif // CDATAENTRY_H
I am trying to store a QList<CDataEntry>
object in a QVariant
. For that end, I have provided the Q_DECLARE_METATYPE(CDataEntry);
The problem is that the code doesnt compile, what I get is:
error: no matching function for call to 'QVariant::QVariant(QList<CDataEntry>&)'
What am I missing here?
QList<QVariant>&
, so you will need to transform yourQList<CDataEntry>
into aQList<QVariant
first. – BotjeC:\Qt\5.12.3\mingw73_64\include/QtCore/qmetatype.h:804:20: error: use of deleted function 'CDataEntry::CDataEntry(const CDataEntry&)' return new (where) T(*static_cast<const T*>(t));
Do I need a default constructor or something? – Łukasz Przeniosło