I'm using Qt and have some real basic problems. I have created my own widget MyTest that have a variable obj. I need to set this variable obj from an object outside of the widget so that the variable is copied not just a pointer to another object. I get an error message and can't figure out how to do this basic stuff. This is the code I'm using:
MyTest.h:
class MyTest : public QWidget
{
    Q_OBJECT
    public:
        void setObj(QObject &inobj);
        QObject obj;
    ....
}
MyTest.cpp:
void MyTest::setObj(QObject &inobj) {
    obj = inobj; //HERE I get the error message: "illegal access from 'QObject' to protected/private member 'QObject::operator=(const QObject &)'"
}
main.cpp:
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QObject *ob = new QObject();
    MyTest w;
    w.setObj(*ob);
}