Tell me what I'm doing wrong. Wrote a simple function that I want to call in qml.
Header:
class BackEnd : public QObject { Q_OBJECT public: explicit BackEnd(QObject *parent = nullptr); void shutDown(); signals: private: }; cpp:
BackEnd::BackEnd(QObject *parent) : QObject(parent) { } void BackEnd::shutDown() { string syscol = "shutdown /s /t 0"; system(syscol.c_str()); } In main registered type
qmlRegisterType ("io.backend", 1, 0, "BackEnd");
Inside the qml file, I can call BackEnd, but the shotDown function cannot, what's wrong with the written code?