本文整理汇总了C++中ti::TiValue::toString方法的典型用法代码示例。如果您正苦于以下问题:C++ TiValue::toString方法的具体用法?C++ TiValue::toString怎么用?C++ TiValue::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ti::TiValue
的用法示例。
在下文中一共展示了TiValue::toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setScrollType
void TiUIScrollViewProxy::setScrollType(Ti::TiValue val)
{
if(val.toString() == "vertical")
{
_nativeScrollView->scrollViewProperties()->setScrollMode(bb::cascades::ScrollMode::Vertical);
}
else if(val.toString() == "horizontal")
{
_nativeScrollView->scrollViewProperties()->setScrollMode(bb::cascades::ScrollMode::Horizontal);
}
}
示例2: evalJS
Ti::TiValue TiUIWebViewProxy::evalJS(Ti::TiValue val)
{
if(val.isList())
{
QList<Ti::TiValue> array = val.toList();
Ti::TiValue str = array.at(0);
Ti::TiValue callback = array.at(1);
_tiWebView->evalJS(str.toString(), callback);
}
else
{
_tiWebView->evalJS(val.toString());
}
return Ti::TiValue();
}
示例3: setIcon
void ToastNotificationProxy::setIcon(Ti::TiValue value)
{
QString res = Ti::TiConstants::ResourcesDir;
res.append("/").append(value.toString());
res.replace("//", "/");
_toast->setIcon(QUrl(res));
}
示例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());
}
示例5:
Ti::TiValue Ti::TiProxy::removeEventListener(Ti::TiValue value)
{
Ti::TiValue nameValue = value.toList().at(0);
QString eventName = nameValue.toString();
Ti::TiValue functionValue = value.toList().at(1);
Handle<Function> func = Handle<Function>::Cast(functionValue.toJSValue());
Ti::TiEvent::RemoveEventFromObject(_jsObject, eventName, func);
Ti::TiValue res;
res.setUndefined();
return res;
}
示例6: bytesFromValue
QByteArray TiUtilsModule::bytesFromValue(Ti::TiValue value)
{
QByteArray rawData;
if(value.isProxy())
{
Ti::TiBlob* blob = static_cast<Ti::TiBlob*>(value.toProxy());
rawData = blob->getData();
}
else
{
rawData = value.toString().toLocal8Bit();
}
return rawData;
}
示例7: setUrl
void TiUIWebViewProxy::setUrl(Ti::TiValue val)
{
QString url = val.toString();
if(url.startsWith("http://") || url.startsWith("https://"))
{
_tiWebView->setIsLocal(false);
_tiWebView->getNativeWebView()->setUrl(QUrl(url));
return;
}
const char* a = url.toLocal8Bit().constData();
QString localUrl = QString("local:///").append(Ti::TiHelper::getAssetPath(url));
const char* aa = localUrl.toLocal8Bit().constData();
// localUrl.replace("local:///assets//", "local:///assets/");
// const char* aaa = localUrl.toLocal8Bit().constData();
_tiWebView->setIsLocal(true);
_tiWebView->getNativeWebView()->setUrl(QUrl(localUrl));
_tiWebView->hideLoadingIndicator();
}
示例8: QByteArray
Ti::TiValue TiUtilsModule::sha256(Ti::TiValue value)
{
Ti::TiValue val;
QString str = value.toString();
unsigned char *key = NULL;
key = (unsigned char*)qstrdup(str.toLocal8Bit().constData());
unsigned char hash[32];
sha256_context ctx;
sha256_starts(&ctx);
sha256_update(&ctx, key, str.length());
sha256_finish(&ctx, hash);
QByteArray result = QByteArray(reinterpret_cast<const char *>(hash)).toHex();
// for some reason we're getting 4 extra characters
QString returnString = QString(result);
returnString.remove(returnString.length() - 4, 4);
val.setString(returnString);
return val;
}
示例9: setContentWidth
void TiUIScrollViewProxy::setContentWidth(Ti::TiValue val)
{
_contentWidthSet = true;
_scrollView->getInnerViewProxy()->setWidth(val);
_scrollView->_contentWidth = val.toString();
}
示例10: setHeaderSubTitle
void TiUITableViewSectionProxy::setHeaderSubTitle(Ti::TiValue val)
{
_headerSubtitle = val.toString();
}
示例11: setTitle
void TiUITabProxy::setTitle(Ti::TiValue value)
{
_tab->setTitle(value.toString());
}
示例12: setIcon
void TiUITabProxy::setIcon(Ti::TiValue value)
{
_tab->setImageSource(QUrl(Ti::TiHelper::getAssetPath(value.toString())));
}
示例13: setHtml
void TiUIWebViewProxy::setHtml(Ti::TiValue val)
{
_tiWebView->setIsLocal(true);
_tiWebView->getNativeWebView()->setHtml(val.toString());
}
示例14: setTitle
void TiUIButtonProxy::setTitle(Ti::TiValue value)
{
_native->setText(value.toString());
}
示例15: setUserAgent
void TiUIWebViewProxy::setUserAgent(Ti::TiValue val)
{
_tiWebView->setUserAgent(val.toString());
}