weaver4
8th April 2014, 15:32
I have a empty QScopedPointer defined in a header.
QScopedPointer<HardwareInterface> hwi;
I know that I can initilize it doing this in my class.
MainClass::MainClass(QObject *parent) :
QObject(parent), hwi(new HardwareInterface())
{
}
But is there another way to do it in the main-line of the code? For example maybe I need to get the values of parameters before I init it.
I have tried this,
hwi = QScopedPointer<HardwareInterface>(new HardwareInterface());
but I get this error:
/home/trey/Qt5.2.1/5.2.1/gcc_64/include/QtCore/qglobal.h:979: error: 'QScopedPointer<T, Cleanup>& QScopedPointer<T, Cleanup>::operator=(const QScopedPointer<T, Cleanup>&) [with T = HardwareInterface; Cleanup = QScopedPointerDeleter<HardwareInterface>]' is private
Class &operator=(const Class &) Q_DECL_EQ_DELETE;
^
whatever that means.
QScopedPointer<HardwareInterface> hwi;
I know that I can initilize it doing this in my class.
MainClass::MainClass(QObject *parent) :
QObject(parent), hwi(new HardwareInterface())
{
}
But is there another way to do it in the main-line of the code? For example maybe I need to get the values of parameters before I init it.
I have tried this,
hwi = QScopedPointer<HardwareInterface>(new HardwareInterface());
but I get this error:
/home/trey/Qt5.2.1/5.2.1/gcc_64/include/QtCore/qglobal.h:979: error: 'QScopedPointer<T, Cleanup>& QScopedPointer<T, Cleanup>::operator=(const QScopedPointer<T, Cleanup>&) [with T = HardwareInterface; Cleanup = QScopedPointerDeleter<HardwareInterface>]' is private
Class &operator=(const Class &) Q_DECL_EQ_DELETE;
^
whatever that means.