Consider a scenario in which a button is defined in QML:
Page{
Container{
Button{
text:"click the button"
onclicked
{
//action performed by the button
}
}
}
}
The usual way is to handle click events inside QML with a signal handler (as done above). My question is: is it possible to handle the event in C++? In term of code, is it possible to perform something like this:
{
Button *b1 = root->findChild<Button*>("button_object");
QObject::connect(b1,SIGNAL(clicked()),this,SLOT(buttonActionToBePerformed()));
}
void buttonActionToBePerformed()
{
//button action to be performed is written here
}