Is it possible to list context property names of QQmlContext?

457 views Asked by At

I am wondering if it's possible to get all context property names of specific QQmlContext.

So I can do something like:

QQmlContext *ctx = ...;

for (auto contextPropertyName: ctx->getPropertyNames()) {
   qDebug() << contextPropertyName << ctx->contextProperty(contextPropertyName);
}

I achieved similar functionality for QObject's with obj->metaObject()->propertyCount() and then obj->metaObject()->property(i).

1

There are 1 answers

0
Jean-Christophe Leducq On

You can find your properties using ctx->dynamicPropertyNames();