本文整理汇总了C++中ti::TiValue::toMap方法的典型用法代码示例。如果您正苦于以下问题:C++ TiValue::toMap方法的具体用法?C++ TiValue::toMap怎么用?C++ TiValue::toMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ti::TiValue
的用法示例。
在下文中一共展示了TiValue::toMap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setContentOffset
void TiUIScrollViewProxy::setContentOffset(Ti::TiValue arg)
{
if(!arg.isList()) return;
QList<Ti::TiValue> args = arg.toList();
// Thanks for this ssaracut
// https://github.com/appcelerator/titanium_mobile_blackberry/pull/217
Ti::TiValue position = args.at(0);
if(!position.isMap()) return;
QMap<QString, Ti::TiValue> positionMap = position.toMap();
Ti::TiValue xPos = positionMap.value(QString("x"));
Ti::TiValue yPos = positionMap.value(QString("y"));
float x = xPos.toNumber();
float y = yPos.toNumber();
bool isAnimated = true;
if(args.size() > 1)
{
Ti::TiValue animated = args.at(1);
if(animated.isMap())
{
QMap<QString, Ti::TiValue> animatedMap = animated.toMap();
Ti::TiValue animatedValue = animatedMap.value(QString("animated"));
isAnimated = animatedValue.toBool();
}
}
_nativeScrollView->scrollToPoint((float)x, (float)y, isAnimated ? bb::cascades::ScrollAnimation::Default : bb::cascades::ScrollAnimation::None);
}
示例2:
void Ti::TiViewProxy::setAnchorPoint(Ti::TiValue value)
{
if(!value.isMap()) return;
QMap<QString, Ti::TiValue> map = value.toMap();
Ti::TiValue xValue = map.value("x");
Ti::TiValue yValue = map.value("y");
view->setPivot(xValue.toNumber(), yValue.toNumber());
}
示例3: close
Ti::TiValue TiUITabProxy::close(Ti::TiValue value)
{
Ti::TiValue val;
val.setUndefined();
Ti::TiWindowProxy* windowProxy;
bool animated = true;
if(value.isList())
{
QList<Ti::TiValue> vs = value.toList();
Ti::TiValue v = vs.at(0);
windowProxy = static_cast<TiUIWindowProxy*>(v.toProxy());
Ti::TiValue optionsValue = vs.at(1);
if(optionsValue.isMap())
{
QMap<QString, Ti::TiValue> options = optionsValue.toMap();
if(options.contains("animated"))
{
animated = options["animated"].toBool();
}
}
}
else if(value.isProxy())
{
windowProxy = static_cast<TiUIWindowProxy*>(value.toProxy());
}
else
{
return val;
}
if(_windows.last() == windowProxy && animated == true)
{
_navigationPane->pop();
}
else
{
_navigationPane->remove(static_cast<bb::cascades::Page*>(windowProxy->getPane()));
Ti::TiEventParameters _params;
windowProxy->fireEvent(Ti::TiConstants::EventClose, _params);
windowProxy->makeWeak();
}
_windows.removeOne(windowProxy);
return val;
}
示例4: if
// TODO: Finish this
Ti::TiValue Ti::TiProxy::fireEvent(Ti::TiValue value)
{
QString eventName;
Ti::TiEventParameters eventParams;
if(value.isList()) {
Ti::TiValue eName = value.toList().at(0);
Ti::TiValue eParams = value.toList().at(1);
eventName = eName.toString();
if(eParams.isMap())
{
QMap<QString, Ti::TiValue> map = eParams.toMap();
QList<QString> keys = map.keys();
int len = keys.size();
while(len--)
{
QString name = keys.at(len);
Ti::TiValue val = map[name];
if(val.isNumber())
{
eventParams.addParam(name, val.toNumber());
}
else if (val.isProxy())
{
eventParams.addParam(name, val.toProxy());
}
else // if(val.isString())
{
eventParams.addParam(name, val.toString());
}
}
}
}
else
{
eventName = value.toString();
}
fireEvent(eventName, eventParams);
return Ti::TiValue(Undefined());
}