Qt 6.11 is out! See what's new in the release
blog
Qml + Qt Class communication
QML and Qt Quick
6
Posts
3
Posters
3.6k
Views
1
Watching
-
Hi!
I have the follow code:
//bike.qml
@
Bike
{
Component.onCompleted : getStuff()
}
@
// Bike.h
@
class Bike: public QObject
{
Q_OBJECT
public:
Q_INVOKABLE void getStuff();
}
@
// Bike.cpp
@
void Bike::getStuff()
{
// do something
}
@
In main I registered the class...The problem is.. On runtime it gives me a error "no variable founded" pointing to "getStuff" on QML file...
What i'm doing wrong?
[Edit: Added @-tags for code formatting; mlong]
-
But.. I want to use the function.. as i use the proprieties....
-
There's no "getStuff" invokable function or slot defined in your Bike class.
/edit: I meant declared, obviously. -
@chriadam : Ok... a small mistake... but that is not the problem... :-(
-
Ok :-D
Today, with a "fresh head" :) I resolved the problem!
Problem: A wrong Copy & past ... provokes a qmlRegisterType bad writed!