class StyleClass : public QObject {
public:
typedef enum
{
STYLE_RADIAL,
STYLE_ENVELOPE,
STYLE_FILLED
} Styl
All this solutions can't enabled used this enum-class as parameter for signal/slot. This code compile, but not work in QML:
class DataEmitter : public QObject
{
Q_OBJECT
public:
...
signals:
void setStyle(StyleClass::EnStyle style);
}
...
emit setStyle(StyleClass.STYLE_RADIAL);
QML-part:
Connections {
target: dataEmitter
onSetStyle: {
myObject.style=style
}
}
And this code generate runtime error, as this:
IndicatorArea.qml:124: Error: Cannot assign [undefined] to int
For this code working, you must additional registry Qt metaobject type:
qRegisterMetaType("StyleClass.EnStyle");
More details written here: https://webhamster.ru/mytetrashare/index/mtb0/1535044840rbtgvfmjys (rus)