Hi,
I use this code to validate some properties of a set of Qt objects in ChaiScript:
/// initialize the engine
boost::shared_ptr<chaiscript::ChaiScript> chai;
chai.reset(new chaiscript::ChaiScript());
std::cout << "ChaiScript engine created!!!" << std::endl;
///
/// register elements
//
assert(ui->checkBox);
chai->add(chaiscript::var(ui->checkBox), "checkBox");
///
/// adapt elements
/// QCheckBox
chai->add(chaiscript::fun(&QCheckBox::isTristate), "isTristate");
chai->add(chaiscript::fun(&QCheckBox::isChecked), "isChecked");
/// validate some properties
try
{
chai->eval("print(\"Starting evaluation...\")");
int answer_i = 0;
bool answer_b = false;
//answer_b = chai->eval<bool>("checkBox.isTristate()");
answer_b = chai->eval<bool>("checkBox.isChecked()");
std::cout << "ChaiScript::: " << answer_b << " :: " << answer_i << std::endl;
}
catch(std::exception e)
{
std::cout << "ChaiScript@Exception::: " << e.what() << std::endl;
}
The problem is that the "isTristate()" call works, because this is a native method of QCheckBox. On the other hand, the "isChecked()" call fails, i think because this is an inherited method from the QAbstractButton class.
What i am doing wrong?
Thanks!!!