After instantiating c++ object in QML its parent is null

Viewed 798

I can't catch why:

  1. Have a c++ constructor realization
Class::Constructor (QObject *parent) : QObject(parent)
{
...
qDebug() << parent;
}

The Class is inherited from QObject and contains Q_OBJECT macro as well.

  1. in main.cpp I have registered a QML type for Class: qmlRegisterType<>(Blablabla...)

  2. in QML separate module.qml I have an implementation:

import blablbla 1.0

Blablabla

{

id: abc

 console.log(parent)

}

Everything works fine, but console.log gives me the real parent object (not null), while qDebug() gives me null. What's about QObject hierarchy here?

P.S. the module.qml object is created via js QtCreateComponent -> createObject(parent, args)

0 Answers
Related