Esempio n. 1
0
QVariant ListModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid()) {
        return QVariant();
    }

    QVariant result;
    withGvl([&] {
        RubyValue value;
        rescueNotify([&] {
            auto subscribe = RUBYQML_INTERN("[]");
            auto record = rb_funcall(mRubyModel, subscribe, 1, INT2NUM(index.row()));
            value = rb_funcall(record, subscribe, 1, ID2SYM(mColumnIDs[role]));
        });
        result = value.toVariant();
    });
    return result;
}
Esempio n. 2
0
template <> QVariant Conversion<QVariant>::from(RubyValue x)
{
    return x.toVariant();
}