Looks like you forgot to call the QObject constructor from mainObject().