本文整理汇总了C++中kjs::JSObject::getPropertyNames方法的典型用法代码示例。如果您正苦于以下问题:C++ JSObject::getPropertyNames方法的具体用法?C++ JSObject::getPropertyNames怎么用?C++ JSObject::getPropertyNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kjs::JSObject
的用法示例。
在下文中一共展示了JSObject::getPropertyNames方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertToVariant
QMap<QString, QVariant> KJSEmbed::convertArrayToMap(KJS::ExecState *exec, KJS::JSValue *value)
{
QMap<QString, QVariant> returnMap;
KJS::JSObject *obj = value->toObject(exec);
KJS::PropertyNameArray lst;
obj->getPropertyNames(exec, lst);
KJS::PropertyNameArrayIterator idx = lst.begin();
for (; idx != lst.end(); idx++) {
KJS::Identifier id = *idx;
KJS::JSValue *val = obj->get(exec, id);
returnMap[toQString(id)] = convertToVariant(exec, val);
}
return returnMap;
}
示例2: index
QModelIndex KJSObjectModel::index(int row, int column, const QModelIndex &parent ) const
{
KJS::JSObject *parentInstance = 0;
Node *childItem = 0;
KJS::ExecState *exec = m_js->globalExec();
if (!parent.isValid())
{
if (m_root)
parentInstance = m_root;
else
return QModelIndex();
}
else
parentInstance = static_cast<Node*>(parent.internalPointer())->instance;
int idx = 0;
KJS::PropertyNameArray props;
parentInstance->getPropertyNames(exec, props);
for( KJS::PropertyNameArrayIterator ref = props.begin(); ref != props.end(); ref++)
{
if( idx == row)
{
childItem = new Node;
childItem->name = ref->ascii(); //### M.O.: this is wrong, can be unicode.
childItem->instance = parentInstance->get( exec,
childItem->name.constData() )->toObject(exec);
childItem->parent = static_cast<Node*>(parent.internalPointer());
break;
}
++idx;
}
if (childItem)
return createIndex(row, column, childItem);
return QModelIndex();
}