Unsolved Button Onclicked - Event not fired.
-
Hi,
I had created a simple button in .qml file and created the function signature in .h file and defined the function in .CPP file.
The Debugger is working until the app is loaded. But, when I click the button, nothing happens, Event is not fired as well debugger is also not working. Am I missing some thing?Code Snippets:
search.qml file
Button
{
id: btnSubmit
x: 347
y: 526
width: 100
height: 50
text: qsTr("Submit")
anchors{
left: parent
top: parent
margins: 15 * scaleFactor
}
onClicked:{
QtCPPSearchVOne.funsearchMap();
}
}//Buttonsearch.h
public:
Q_INVOKABLE void funsearchMap();search.cpp*
void QtCPPSearchVOne::funsearchMap()
{
QString obj;
obj = QString::QString("Break Event Fired");
}Error message:
Property of object is not a functionThanks in advance.
-
Now its working.
wrongly used the namespace name in the .qml fle instead of id.QtCPPSearchVOne {
id: objQtCPPSearchVOne
Button
{
id: btnSubmit
onClicked:{
objQtCPPSearchVOne.funsearchMap()
}
}
}