You CANNOT use QDeclarativeListProperty (or QQmlListProperty in Qt5) with any type other than those obtained from QObject. So int or QString will NEVER work.
If you need to exchange a QStringList or QList or anything that is an array of one of the basic types supported by QML, the easiest way to do this is to use QVariant on the C ++ side, for example:
#include <QObject>
In the QML side, they simply affect the JS Number array, the QML mechanism automatically converts it to QVariant to make it understandable for Qt:
KeyboardContainer.enableKeys = [12,48,26,49,10,3];
What all!
source share