can't add an object to a QList
Solved
General and Desktop
-
Hi all -
So, what am I doing wrong here? I'm getting a build error:
error: 'QUdpSocket::QUdpSocket(const QUdpSocket&)' is private
Q_DISABLE_COPY(QUdpSocket)class UdpSocket : public QObject { Q_OBJECT private: QList<QUdpSocket> m_interfaceSockets; } void UdpSocket::pollNetworkInterfaces() { QUdpSocket *sock = new QUdpSocket; m_interfaceSockets.append(*sock); ..
-
You're trying to copy the object into the list. QObjects are not copyable.
To fix this you can change the list to be a list of pointers instead.